- Node 18.x (check
.github/workflows/build.yml
to see what we're building with) - pre-commit
Once you clone the repo, run pre-commit install
to connect the pre-commit hooks.
# Restore packages.
npm install
# Do the lint/test cycle.
npm run build
There are Mocha tests that can be run to validate things at a unit test level.
# Run tests.
npm run test
You can interactively test the CLI support by running it through node.
# Show help.
node json-sort.js
node json-sort.js --help
# Run with some options.
node json-sort.js --autofix file.json
You can test the pre-commit hook using the pre-commit try-repo
command.
- Clone this repo somewhere like
~/dev/json-sort-cli
. - Set up another repo with pre-commit.
- While in the other repo, run
pre-commit try-repo ~/dev/json-sort-cli json-sort
to try out the hook. You can pass parameters at the end of the line. For example,pre-commit try-repo ~/dev/json-sort-cli json-sort --verbose
turns on verbose output so you'll see the hook logs even if it passes.
You can't pass arguments to try-repo
. You'd need to actually set up a separate pre-commit hook configuration pointed to your local clone at a specific commit hash.
GitHub Actions is set up to take care of the publishing side of things when a new release is published to GitHub.
- Update the version in
package.json
. - Tag the repo.
- Create the release in GitHub and publish the release.