Skip to content
Merged

Dev1 #134

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ Changelog

* No changes.

Version 0.1.58 -- 2026-Jun-26
-----------------------------

* Block malicious HTML in source code/Markdown documents.
* Update @codemirror/view after
[bug fix](https://code.haverbeke.berlin/codemirror/dev/issues/1717).

Version 0.1.58 -- 2026-Jun-22
-----------------------------

Expand Down
51 changes: 47 additions & 4 deletions builder/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ clap = { version = "4", features = ["derive"] }
cmd_lib = "2.0.0"
current_platform = "0.2.0"
dunce = "1.0.5"
open = "5"
path-slash = "0.2.1"
regex = "1.11.1"
52 changes: 41 additions & 11 deletions builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ enum Commands {
},
/// Run lints and tests.
Test,
/// Repeatedly run the `overall_*` tests until one fails. Useful for
/// shaking out intermittent test failures.
RunUntilFail,
/// Build everything.
Build,
/// Build the Client.
Expand Down Expand Up @@ -270,6 +273,7 @@ fn copy_file<P: AsRef<Path> + std::fmt::Debug>(src: P, dest: P) -> io::Result<()
}

fn remove_dir_all_if_exists<P: AsRef<Path> + std::fmt::Display>(path: P) -> io::Result<()> {
println!("Removing {path}...");
if Path::new(path.as_ref()).try_exists().unwrap() {
fs::remove_dir_all(path.as_ref())?;
}
Expand Down Expand Up @@ -324,17 +328,9 @@ fn patch_file(patch: &str, before_patch: &str, file_path: &str) -> io::Result<()
}
Ok(())
}

/// After updating files in the client's Node files, perform some fix-ups.
fn patch_client_libs() -> io::Result<()> {
// Apply a the fixes described in
// [issue 27](https://github.com/bjones1/CodeChat_Editor/issues/27).
patch_file(
"
selectionNotFocus = this.view.state.facet(editable) ? focused : hasSelection(this.dom, this.view.observer.selectionRange)",
" let selectionNotFocus = !focused && !(this.view.state.facet(editable) || this.dom.tabIndex > -1) &&
hasSelection(this.dom, this.view.observer.selectionRange) && !(activeElt && this.dom.contains(activeElt));",
&format!("{CLIENT_PATH}/node_modules/@codemirror/view/dist/index.js")
)?;
// In
// [older releases](https://www.tiny.cloud/docs/tinymce/5/6.0-upcoming-changes/#options),
// TinyMCE allowed users to change `whitespace_elements`; the whitespace
Expand Down Expand Up @@ -538,6 +534,33 @@ fn run_test() -> io::Result<()> {
Ok(())
}

/// Repeatedly run the `overall_*` integration tests until one fails, to expose
/// intermittent failures. This is a translation of `server/run_until_fail.ps1`.
fn run_until_fail() -> io::Result<()> {
// Provide a backtrace on a failing test, matching the script's
// `RUST_BACKTRACE=1`.
unsafe {
env::set_var("RUST_BACKTRACE", "1");
}
let tests = ["overall_1", "overall_2", "overall_3", "overall_4"];
let mut iteration = 0;
loop {
iteration += 1;
// Clear the screen so only the current iteration's output is visible.
print!("\x1b[2J\x1b[H");
println!("--- Iteration {iteration} ---");
for test in tests {
// `run_cmd!` returns an error if `cargo test` exits non-zero, which
// breaks out of the loop -- the same behavior as the script.
run_cmd!(cargo test --test $test).map_err(|err| {
io::Error::other(format!(
"Test {test} failed on iteration {iteration}: {err}"
))
})?;
}
}
}

fn run_build() -> io::Result<()> {
run_cmd!(
info "Builder: cargo build";
Expand Down Expand Up @@ -807,8 +830,14 @@ fn run_postrelease(target: &str, tag: &str) -> io::Result<()> {
fn run_coverage() -> io::Result<()> {
run_cmd!(
info "cargo tarpaulin --skip-clean --out=html --target-dir=tarpaulin";
cargo tarpaulin --skip-clean --out=html --target-dir=tarpaulin;
)
cargo tarpaulin --skip-clean --out=html --out=json --target-dir=tarpaulin;
)?;

// Open the resulting coverage report in the default web browser. The current
// working directory is `server/` (see `main`), so the report lives at
// `server/tarpaulin-report.html`.
let report = Path::new("tarpaulin-report.html");
open::that(report)
}

// CLI implementation
Expand All @@ -823,6 +852,7 @@ impl Cli {
Commands::Update => run_update(),
Commands::Flint { check } => run_format_and_lint(*check),
Commands::Test => run_test(),
Commands::RunUntilFail => run_until_fail(),
Commands::Build => run_build(),
Commands::ClientBuild(build_options) => {
run_client_build(build_options.dist, build_options.skip_check_errors)
Expand Down
25 changes: 20 additions & 5 deletions client/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@
// `.eslintrc.yml` -- Configure ESLint for this project
// ====================================================
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import css from "@eslint/css";
import eslint from "@eslint/js";
import { defineConfig } from "eslint/config";
import tseslint from "typescript-eslint";
import globals from "globals";

// Glob matching the JS/TS files the JavaScript/TypeScript configs below should
// apply to. Without this, those configs (and their core rules) also run against
// `.css` files, which crashes since CSS uses a different language.
const jsFiles = ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"];

export default defineConfig(
eslint.configs.recommended,
tseslint.configs.recommended,
eslintPluginPrettierRecommended,
{ files: jsFiles, extends: [eslint.configs.recommended] },
{ files: jsFiles, extends: [tseslint.configs.recommended] },
{ files: jsFiles, extends: [eslintPluginPrettierRecommended] },
defineConfig([
{
// This must be the only key in this dict to be treated as a global
Expand All @@ -37,10 +43,11 @@ export default defineConfig(
},
{
name: "local",
files: jsFiles,
languageOptions: {
globals: {
...globals.browser
}
...globals.browser,
},
},
rules: {
"no-unused-vars": "off",
Expand All @@ -58,5 +65,13 @@ export default defineConfig(
],
},
},
{
name: "css",
files: ["**/*.css"],
ignores: ["src/third-party/**"],
language: "css/css",
plugins: { css },
extends: ["css/recommended"],
},
]),
);
19 changes: 10 additions & 9 deletions client/package.json5
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
url: 'https://github.com/bjones1/CodeChat_editor',
},
type: 'module',
version: '0.1.58',
version: '0.1.59',
dependencies: {
'@codemirror/commands': '^6.10.3',
'@codemirror/commands': '^6.10.4',
'@codemirror/lang-cpp': '^6.0.3',
'@codemirror/lang-css': '^6.3.1',
'@codemirror/lang-go': '^6.0.1',
Expand All @@ -60,10 +60,10 @@
'@codemirror/lang-sql': '^6.10.0',
'@codemirror/lang-xml': '^6.1.0',
'@codemirror/lang-yaml': '^6.1.3',
'@codemirror/language': '^6.12.3',
'@codemirror/language': '^6.12.4',
'@codemirror/legacy-modes': '^6.5.3',
'@codemirror/state': '^6.6.0',
'@codemirror/view': '~6.38.8',
'@codemirror/state': '^6.7.0',
'@codemirror/view': '^6.43.3',
'@hpcc-js/wasm-graphviz': '^1.22.2',
'@mathjax/mathjax-newcm-font': '^4.1.2',
codemirror: '^6.0.2',
Expand All @@ -74,27 +74,28 @@
'toastify-js': '^1.12.0',
},
devDependencies: {
'@eslint/css': '^1.3.0',
'@eslint/js': '^10.0.1',
'@types/chai': '^5.2.3',
'@types/dom-navigation': '^1.0.7',
'@types/js-beautify': '^1.14.3',
'@types/mocha': '^10.0.10',
'@types/node': '^24.13.2',
'@types/toastify-js': '^1.12.4',
'@typescript-eslint/eslint-plugin': '^8.61.1',
'@typescript-eslint/parser': '^8.61.1',
'@typescript-eslint/eslint-plugin': '^8.62.0',
'@typescript-eslint/parser': '^8.62.0',
chai: '^6.2.2',
esbuild: '^0.28.1',
eslint: '^10.5.0',
'eslint-config-prettier': '^10.1.8',
'eslint-plugin-import': '^2.32.0',
'eslint-plugin-prettier': '^5.5.6',
globals: '^17.6.0',
globals: '^17.7.0',
mocha: '^11.7.6',
'npm-check-updates': '^22.2.7',
prettier: '^3.8.4',
typescript: '^6.0.3',
'typescript-eslint': '^8.61.1',
'typescript-eslint': '^8.62.0',
},
scripts: {
test: 'echo "Error: no test specified" && exit 1',
Expand Down
Loading
Loading