- Node.js >= 18
- npm >= 9
npm installRe-generates the parser from the Peggy Grammar. Run this whenever changing the grammar.
Compiles the library to dist/ using tsup. Outputs both CommonJS (dist/index.js) and ESM (dist/index.mjs) formats, along with TypeScript declaration files.
Runs tsc --noEmit to check types without emitting any files.
Runs the Vitest test suite. See the tests/ README for more information on testing.
Runs ESLint across all source files.
Runs ESLint and automatically fixes any fixable issues.
Print this library's parse / format / explain output for a raw SQL string (--sql "SELECT 1") or for one or more reference cases in tests/clickhouse-reference/ (a .sql filename, comma-separated list, or glob). Run via tsx against src/, so no build is needed.
Show this library's output, the expected output committed in tests/clickhouse-reference/, and a diff between them for the given reference case(s) — useful for debugging reference test failures. Accept the same reference selector plus --diff-only, --actual-only, --expected-only, --only-diffs, and --no-color. Pass -h to any of these scripts for full usage.
Publishes the package to npm with public access. Requires you to be authenticated (npm login) and have publish rights to the package.
prepublishOnlyruns automatically before publishing and executestypecheck,lint,test, andbuildin sequence. The publish will abort if any of these fail.
- Make changes in
src/. - Add or update tests in
tests/*.test.ts. - Run
npm testto verify tests pass. - Run
npm run typecheckto verify types. - Run
npm run lint:fixto clean up style (Prettier runs via ESLint). - Run
npm run buildto verify the build succeeds.
- Update the version in
package.jsonfollowing semver. - Authenticate with npm if needed:
npm login - Run
npm run release.
The prepublishOnly script will run all checks automatically before publishing.