zeit/git-hooks

Name: git-hooks

Owner: ZEIT

Description: No nonsense Git hook management

Created: 2017-11-13 11:14:51.0

Updated: 2018-05-15 11:02:34.0

Pushed: 2018-05-23 20:49:27.0

Homepage: null

Size: 220

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

@zeit/git-hooks

No nonsense Git hook management.

Usage

Install this module, preferably as a dev-dependency:

 add --dev @zeit/git-hooks

That's it. You can now use the module in two ways:


cripts": {
"git-pre-commit": "eslint"


The above will run a single command line, just like running npm run git-pre-commit or yarn git-pre-commit, every time you git commit.

Alternatively, if you'd like to run several scripts in succession upon a hook, you may define a git top-level property and specify an array of scripts to run:


it": {
"pre-commit": "lint"


or


it": {
"pre-commit": ["lint", "test"]


Note that any "scripts" hooks supplant any corresponding "git" hooks. That is to say, if you define both a {"scripts": {"git-pre-commit": "..."}} hook and a {"git": {"pre-commit": []}} hook, the hook in "scripts" will be the only hook that is executed.

Why? There are hundreds of these.

*Caveat: The package manager needs to be npm compliant in terms of environment variables. Worst case, define the environment variables npm_node_execpath (node binary) and npm_execpath (package manager entry point) as environment variables prior to installing.

License

Copyright © 2018 by ZEIT, Inc. Released under the MIT License.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.