[tools] rust = { version = "1.98.0", components = "clippy,rustfmt" } bun = "1.4.4" taplo = "0.10.0" yamlfmt = "0.21.0" [env] CARGO_TARGET_DIR = "{{config_root}}/target" [tasks.build] description = "Build the library and CLI" run = "cargo build --workspace --exclude tidy_napi" [tasks."build:napi"] description = "Build the Node addon for this platform" dir = "crates/tidy_napi" run = "bunx napi build --platform --release --esm" [tasks.fmt] description = "Check formatting" run = "cargo fmt --all --check" [tasks."fmt:fix"] description = "Format all crates" run = "cargo fmt --all" [tasks.clippy] description = "Lint with warnings denied" run = "cargo clippy --workspace --all-targets -- -D warnings" [tasks.test] description = "Run all tests" run = ["cargo test --workspace", "bun test --cwd crates/tidy_napi"] depends = ["build:napi"] [tasks.check] description = "Format, lint, and test" depends = ["fmt", "clippy", "test"] [tasks.bench] description = "Compare against other formatters: mise run bench -- " run = "bun bench/run.ts" [tasks."bench:parse"] description = "Compare tidy's parsers with Rust crates: mise run bench:parse -- [--runs ] [--only ] []" dir = "bench/parse" run = "cargo run --release -q --" [tasks."bench:ab"] description = "Time the working tree against a git revision: mise run bench:ab -- [--rev ] ..." run = "bun bench/ab.ts" [tasks."oracle:json"] description = "Compare JSON with Prettier: mise run oracle:json -- [filter] [--show=n] [--oss=]" run = "bun tests/oracle/json.ts" depends = ["build:napi"] [tasks."oracle:json:cases"] description = "Record what Prettier prints for crates/tidy/tests/json.json" run = "bun tests/oracle/json-cases.ts" [tasks."oracle:toml"] description = "Compare TOML with taplo: mise run oracle:toml -- files ... | cases crates/tidy/tests/toml.json | lex [count] | values " dir = "tests/oracle/toml" run = "cargo run --release --" [tasks."oracle:yaml"] description = "Compare YAML with yaml 2.9.0 and Prettier: its syntax tree, what parses, its tree, and the output" dir = "tests/oracle/yaml" run = [ "bun cst.ts > ../../../target/yaml-cst.json", "bun accepts.ts > ../../../target/yaml-accepts.json", "bun ast.ts > ../../../target/yaml-ast.json", "bun format.ts > ../../../target/yaml-format.json", "for mode in cst accepts ast format; do cargo run --release -q -- $mode ../../../target/yaml-$mode.json; done", ] [tasks."oracle:markdown:corpus"] description = "Copy the Markdown files of git repos into a corpus: mise run oracle:markdown:corpus -- ..." run = "bun tests/oracle/markdown/corpus.ts" [tasks."oracle:markdown:corpora"] description = "Build the Markdown corpora A to D in target/corpus/markdown from local checkouts, after removing them" run = [ "rm -rf target/corpus/markdown", "bun tests/oracle/markdown/corpus.ts target/corpus/markdown/a ~/repos/oss/vite ~/repos/oss/storybook ~/repos/oss/shadcn-svelte", "bun tests/oracle/markdown/corpus.ts target/corpus/markdown/b ~/repos/oss/bun ~/repos/personal/starship.io/starship", "bun tests/oracle/markdown/corpus.ts target/corpus/markdown/c ~/repos/oss/angular-html-parser ~/repos/oss/rolldown ~/repos/oss/jest ~/repos/oss/v ~/repos/oss/deno ~/repos/oss/deno_lint ~/repos/oss/oxc ~/repos/oss/prettier ~/repos/testing/bootstrap ~/repos/testing/everything-claude-code", "bun tests/oracle/markdown/corpus.ts target/corpus/markdown/d ~/repos/oss/prettier:tests/format", ] [tasks."oracle:markdown:prettier"] description = "Count Markdown files that match Prettier and sort the rest: mise run oracle:markdown:prettier -- ..." run = "bun tests/oracle/markdown/prettier.ts" depends = ["build:napi"] [tasks."oracle:markdown:semantics"] description = "Check that formatting Markdown keeps its meaning, on the corpora in TIDY_MARKDOWN_CORPUS" env = { TIDY_MARKDOWN_CORPUS = "{{config_root}}/target/corpus/markdown/a:{{config_root}}/target/corpus/markdown/b:{{config_root}}/target/corpus/markdown/c:{{config_root}}/target/corpus/markdown/d" } run = "cargo test -p tidy --release --test markdown_semantics" [tasks."oracle:markdown:divergences"] description = "Write markdown-divergences.md from the cases in tests/oracle/markdown/divergences" run = "bun tests/oracle/markdown/divergences.ts" depends = ["build:napi"] [tasks."oracle:markdown:shrink"] description = "Shrink a Markdown file that formatting breaks: mise run oracle:markdown:shrink -- [--