JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 193127
  • Score
    100M100P100Q159891F
  • 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 github releases for simple-pre-commit documentation

Usage

Add simple-git-hooks to the project:

  1. Install the simple-git-hooks as dev dependency

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

    There are more ways to configure the package. Check out [additional configuration](#Additional configuration options)

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

  1. Change the configuration

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