Skip to content

Commit

Permalink
chore(doc): update CONTRIBUTING per new pjson
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobJingleheimer committed Dec 7, 2024
1 parent 166c85a commit 34b57fe
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,18 @@ A recipe generally has a few things:
* A `README.md` explaining its purpose and use (including any options, and required and optional
files).
* Tests via node's test runner (min coverage: 80%)
* unit tests ; there must be a `"test:unit"` command within it package.json's like:
```json
{
"scripts": {
"test:unit": "node --test './src/**/*.spec.ts"
}
}
```
* end-to-end test(s) for accepted use-cases; there must be a `"test:e2e"` command within it package.json's like:
```json
{
"scripts": {
"test:e2e": "node --test './src/**/*.e2e.ts"
}
}
```
* unit tests
* end-to-end test(s) for accepted use-cases
* a `test` command in `package.json`; there may be sub-commands like `test:unit` & `test:e2e`, but there must be a parent that combines them.
* Include `--import='../../build/snapshots.mts` to standardise the filename (`${original_base_name}.snap.cjs`) across recipes.
* Ensure `--test-coverage-include` and `--test-coverage-exclude` are set correctly for the recipe's workspace. The root repo handles setting coverage rules like minimum line coverage.
* Code comments (js docs, etc)
* Types (either via typescript or jsdoc)

CI will run lint & type checking and all included test files against all PRs.

> [!NOTE]
> snapshots will be generated with the file extension `.snap.cjs`.

New recipes are added under `./recipes` in their own folder, succinctly named for what it does. General-purpose recipes have simple names like `correct-ts-specifiers`. A suite of migrations has a name like `migrate from 18 to 20`, and more specific migrations are named like `migrate fs.readFile from 18 to 20`.
New recipes are added under `./recipes` in their own folder, succinctly named for what they do. General-purpose recipes have simple names like `correct-ts-specifiers`. A suite of migrations has a name like `migrate from 18 to 20`, and more specific migrations are named like `migrate-fs-readFile-from-18-to-20`.

## Before pushing a commit

A convenient superset of checks is available via `node --run pre-commit`, which automatically fixes formatting and linting issues, checks types, and runs unit and end-to-end tests. Changes resulting from this should be committed.
A convenient superset of checks is available via `node --run pre-commit`, which automatically fixes formatting and linting issues (that are safe to fix), checks types, and runs tests. Changes resulting from this should be committed.

0 comments on commit 34b57fe

Please sign in to comment.