| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Manage git hooks with the "git.scripts" field of the package.json like npm-scripts.
{
"name": "your-project",
"version": "0.0.0",
"description": "",
"devDependencies": {
"git-scripts": "*"
},
"git": {
"scripts": {
"pre-commit": "npm test",
"post-merge": "npm install"
}
}
}See also this module's package.json as an example.
$ npm install git-scripts
NOTE: .git/hooks of your project is replaced when installed. You can restore it by uninstalling the module.
git-scripts supports all hooks including the following:
$ npm install -g git-scripts
Usage: git-scripts <command> [options]
Options:
-h, --help output usage information
-V, --version output the version number
Commands:
install [path] install git-scripts
uninstall [path] uninstall git-scripts
run <name> [args ...] run arbitrary scripts
NOTE: Usually, you don't need CLI. Hooks are enabled automatically when you install the module locally.
If you would like to use git-scripts programmatically, you can do that.
var scripts = require('git-scripts');
var project = scripts('somewhere/yourproject');
project.install(function(err) {
if (err) throw err;
console.log('git-scripts was installed.');
project.run('pre-commit', function(err) {
if (err) throw err;
console.log('pre-commit script succeeded.');
});
});var scripts = require('git-scripts');
var project = scripts('somewhere/yourproject');Create a git-scripts instance for path.
Install git-scripts.
Uninstall git-scripts.
Run an arbitrary command of name.
Naoyuki Kanezawa naoyuki.kanezawa@gmail.com
MIT
| Back | FazBrowse Home | New Git URL |