simple-git-hooks

    2.6.1 • Public • Published

    simple-git-hooks

    Tests

    A tool that lets you easily manage git hooks

    • Zero dependency
    • Small configuration (1 object in package.json)
    • Lightweight:

    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",
      
          // All unused hooks will be removed automatically by default
          // but you can use the `preserveUnused` option like following to prevent this behavior
      
          // if you'd prefer preserve all unused hooks
          "preserveUnused": true,
      
          // if you'd prefer preserve specific unused hooks
          "preserveUnused": ["commit-msg"]
        }
      }

      This configuration is going to run all linters on every commit and formatter on push.

    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.

    Install

    npm i simple-git-hooks

    DownloadsWeekly Downloads

    27,998

    Version

    2.6.1

    License

    MIT

    Unpacked Size

    11 kB

    Total Files

    7

    Last publish

    Collaborators

    • toplenboren