tshyfor building typescriptubq(theubqtestpackage) for testingnpmfor package management and running project scriptsoxlintfor lintingprettierfor formatting
- A fast and featureful bash-compatible glob matcher in JavaScript
./src/*.tsSource files./test/*.tsubq test files./test/fixtures/test fixtures./scripts/various project scripts
- Running tests:
npm test - Running tests, updating snapshots:
npm snap - Building code:
npm run prepare - Running benchmarks:
npm run bench - Linting:
npm run lint - Formatting code:
npm run format - Regenerating Bash behavior test fixtures:
npm run test-regenIMPORTANT This should only be run on systems with a recentBash 5.3build as the defaultbashbinary. - Benchmarking:
npm run bench - Benchmarking in a Docker container that is limited to 4 CPUs
and 8GB of memory, with the median of 3 runs:
npm run bench:docker(setBENCH_RUNS,BENCH_CPUS, andBENCH_MEMORYto change these) - Profiling:
npm run prof - Generating docs:
npm run typedoc
Use TypeScript exclusively; avoid any.
Every class must be in its own css-case-named file under src.
For example, a class named AsyncHookManager would live in
src/async-hook-manager.ts.
Do not duplicate functions, methods, or objects unnecessarily.
Prefer to consolidate and reuse code whenever possible.
NEVER add new methods, objects, or functions, without explicit human direction. When asked to do so, make the smallest possible increase to the API surface area.
- 100% test coverage is critically important.
- Every patch must include a test that fails without the patch, and passes with the patch.
- Tests should be human readable.
- Prefer adding to an existing set of test cases rather than writing a new test, if possible.
- All new features require matching tests in the
/testsdirectory. - Run
npm testbefore proposing a solution to ensure no regressions. - Mock external API calls using
mockImportfromubqtest.
Export all types.
Every public method and option must have a JSDoc comment.
Do not use "semantic commits". Whether it is a feature, fix, or chore, should be evident from context.
The first line of the commit message should summarize the change in less than 50 characters
Write commit messages in the present tense imperative voice,
describing what the patch does without qualifiers or referring to
the patch itself. For example: add whiz deduplication for performance, not patch adds whiz deduplication, which should improve performance somewhat.
The body of the commit message, if necessary, should explain the reasoning behind the change, with hard line-breaks at 80 characters.
If there are breaking behavior changes for users, these MUST be described in the commit message body.
The commit message should only very rarely mention the implementation – that should be evident from the code change itself. However, it may be worthwhile to explain why a given implementation is chosen, when alternatives exist.
Commit messages, like code, should be as minimal as possible to accomplish their goal.
- NEVER link to or reference IDs of bugs, issues, or other objects in issue trackers other than the GitHub issue tracker for this repository.
- DO include a
fix: #1234link to any GitHub issues that this patch fixes, orre: #1234link to any GitHub issues or pull requests that are relevant to this change.
- DO NOT modify anything in the
/scriptsdirectory. - DO NOT commit secrets or
.envfiles. - NEVER use
forceflags when running Git commands. - If a task requires a new dependency, ask the human to perform the command.
- DO NOT modify
package.jsonorpackage-lock.json. - Run
npm run benchbefore and after any significant patches, to ensure that there are no performance regressions.