1.0.0 • Published 7 years ago

npm-git-hooks v1.0.0

Weekly downloads
4
License
ISC
Repository
github
Last release
7 years ago

npm-git-hooks

Main git hooks with nodejs implementation for npm projects

Information

This project is largely inspired by Gleb Bahmutov pre-git package.
However, it was missing some important features, such as:

  • Possibility to have multiple npm projects in your git repository
  • Restrict the running tasks to specific file types or folders
  • Disable the hook for specific users (ex: jenkins)

Installation

$ npm install --save-dev npm-git-hooks

Configuration

You need to fill the 'npm-git-hooks' config object in you package.json file.

{
  "scripts": {
    "build": "webpack --config webpack.conf.js",
    "test": "karma start"
  },
  "npm-git-hooks": {
    "enabled": true,
    "skip-users": ["jenkins"],
    "restrictions": {
      "fileTypes": ["js", "html"],
      "folders": ["src/app"]
    },
    "commit-msg": ".+",
    "post-checkout": ["npm install"],
    "post-commit": [],
    "post-merge": [],
    "pre-commit": ["npm run test"],
    "pre-push": ["npm run test", "npm run build"]
  }
}