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 github releases forsimple-pre-commit
documentation
Usage
Add simple-git-hooks to the project:
Install the simple-git-hooks as dev dependency
npm install simple-git-hooks --save-dev
Add the
simple-git-hooks
to yourpackage.json
. Fill it with git hooks and 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](#Additional configuration options)
Run the CLI script to update the git hooks with commands from config
npx simple-git-hooks
Now all git hooks are created
Update git hooks command
Change the configuration
Run
npx simple-git-hooks
from root of your project
Note that you should manually run npx simple-git-hooks
every time you change the command
Additional configuration options
You can also add the .simple-git-hooks.json
or simple-git-hooks.json
to the project and write the configuration inside it
That way, .simple-git-hooks.json
or simple-git-hooks.json
should look like this and package.json
may not have simple-git-hooks
configuration inside it
{
"pre-commit":"npx lint staged",
"pre-push": "cd ../../ && npm run format"
}
Uninstall pre-commit-hook
Uninstallation will remove all existing git hooks
npm uninstall --save-dev simple-git-hooks