Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details →
Socket
Book a DemoInstallSign in
Socket

git-scripts

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-scripts

Git hooks integration for Node.js projects

latest
Source
npmnpm
Version
0.6.4
Version published
Weekly downloads
1K
22.6%
Maintainers
2
Weekly downloads
 
Created
Source

git-scripts NPM Version

NPM

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.

Installation

$ npm install git-scripts

NOTE: .git/hooks of your project is replaced when installed. You can restore it by uninstalling the module.

Description

git-scripts supports all hooks including the following:

  • applypatch-msg
  • pre-applypatch
  • post-applypatch
  • pre-commit
  • prepare-commit-msg
  • commit-msg
  • post-commit
  • pre-rebase
  • post-checkout
  • post-merge
  • pre-receive
  • update
  • post-receive
  • post-update
  • pre-auto-gc
  • post-rewrite
  • pre-push

CLI

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

Using Programmatically

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.');
  });
});

Documentation

var scripts = require('git-scripts');
var project = scripts('somewhere/yourproject');

scripts([path])

Create a git-scripts instance for path.

project.install([callback])

Install git-scripts.

project.uninstall([callback])

Uninstall git-scripts.

project.run(name, [args ...], [callback])

Run an arbitrary command of name.

Author

Naoyuki Kanezawa naoyuki.kanezawa@gmail.com

Maintainer

Huan LI (李卓桓) zixia@zixia.net

License

MIT

Keywords

git

FAQs

Package last updated on 14 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts