JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 193127
  • Score
    100M100P100Q159906F
  • License MIT

A simple, zero dependency tool for setting up git hooks for small projects

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 the simple-pre-commit documentation.

Usage

Add simple-git-hooks to the project

  1. Install simple-git-hooks as a dev dependency:

    npm install simple-git-hooks --save-dev
  2. Add simple-git-hooks to your package.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 on push.

    There are more ways to configure the package. Check out Additional configuration options.

  3. 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

  1. Change the configuration.

  2. 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