Package Exports
- simple-git-hooks
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (simple-git-hooks) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
simple-git-hooks
A tool that lets you easily manage git hooks
The package was recently renamed from
simple-pre-commit
. See Releases for thesimple-pre-commit
documentation.
Usage
Add simple-git-hooks to the project
Install simple-git-hooks as a dev dependency:
npm install simple-git-hooks --save-dev
Add
simple-git-hooks
to yourpackage.json
. Fill it with git hooks and the corresponding commands.For example:
"simple-git-hooks": { "pre-commit": "npx lint-staged", "pre-push": "cd ../../ && npm run format" }
This configuration is going to run all linters on every
commit
and formatter onpush
.There are more ways to configure the package. Check out Additional configuration options.
Run the CLI script to update the git hooks with the commands from the config:
npx simple-git-hooks
Now all the git hooks are created.
Update git hooks command
Change the configuration.
Run
npx simple-git-hooks
from the root of your project.
Note that you should manually run npx simple-git-hooks
every time you change a command.
Additional configuration options
You can also add a .simple-git-hooks.json
or simple-git-hooks.json
file to the project and write the configuration inside it.
That way, .simple-git-hooks.json
or simple-git-hooks.json
should look like the following and package.json
may not contain the simple-git-hooks
configuration.
{
"pre-commit": "npx lint staged",
"pre-push": "cd ../../ && npm run format"
}
Uninstall simple-git-hooks
Uninstallation will remove all the existing git hooks.
npm uninstall simple-git-hooks