husky
Advanced tools
Comparing version 0.10.2 to 0.11.0
// Run when package is installed | ||
var fs = require('fs') | ||
var husky = require('../src/') | ||
var hooks = require('../hooks.json') | ||
var hooks = require('../src/hooks.json') | ||
console.log('\033[36m%s\033[0m', 'husky') | ||
console.log(' setting up hooks in .git/hooks/') | ||
console.log('\033[4;36m%s\033[0m', 'husky') | ||
console.log('setting up hooks in .git/hooks') | ||
@@ -17,4 +17,4 @@ husky.hooksDir(function(err, dir) { | ||
}) | ||
console.log(' done\n') | ||
console.log('done\n') | ||
} | ||
}) |
// Run when package is uninstalled | ||
var husky = require('../src/') | ||
var hooks = require('../hooks.json') | ||
var hooks = require('../src/hooks.json') | ||
console.log('\033[36m%s\033[0m', 'husky') | ||
console.log(' uninstalling') | ||
console.log('\033[4;36m%s\033[0m', 'husky') | ||
console.log('uninstalling') | ||
@@ -13,4 +13,4 @@ husky.hooksDir(function(err, dir) { | ||
}) | ||
console.log(' done\n') | ||
console.log('done\n') | ||
} | ||
}) |
{ | ||
"name": "husky", | ||
"version": "0.10.2", | ||
"version": "0.11.0", | ||
"description": "Prevents bad commit or push (git hooks, pre-commit/precommit, pre-push/prepush, post-merge/postmerge and all that stuff...)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,8 +28,22 @@ # husky [![](http://img.shields.io/npm/dm/husky.svg?style=flat)](https://www.npmjs.org/package/husky) [![npm version](https://badge.fury.io/js/husky.svg)](http://badge.fury.io/js/husky) [![Build Status](https://travis-ci.org/typicode/husky.svg?branch=master)](https://travis-ci.org/typicode/husky) | ||
Existing hooks aren't replaced and adding `--no-verify` to your git commands lets you bypass hooks. You can also use [any](https://github.com/typicode/husky/blob/master/hooks.json) Git hook. | ||
Existing hooks aren't replaced and adding `--no-verify` to your git commands lets you bypass hooks. You can also use [any Git hook](HOOKS.md). | ||
To uninstall husky, simply run `npm rm husky --save-dev` | ||
## Debug | ||
If you need to debug hooks, use `npm run <script-name>`. For example: | ||
```bash | ||
npm run precommit | ||
``` | ||
## Uninstall | ||
To uninstall husky and Git hooks, simply run: | ||
```bash | ||
npm uninstall husky --save-dev | ||
``` | ||
## License | ||
MIT - [typicode](https://github.com/typicode) |
@@ -34,7 +34,2 @@ var fs = require('fs') | ||
// Needed on OS X / Linux when nvm is used and committing from Sublime Text | ||
if (process.platform !== 'win32') { | ||
arr.push('PATH="' + process.env.PATH + '"') | ||
} | ||
// Assuming that this file is in node_modules/husky/src | ||
@@ -56,2 +51,3 @@ var packageDir = path.join(__dirname, '..', '..', '..') | ||
'cd ' + normalizedPath, | ||
// Fix for issue #16 #24 | ||
@@ -62,2 +58,25 @@ // Test if script is defined in package.json | ||
'[ $? -ne 0 ] && exit 0', | ||
]) | ||
// On OS X and Linux, try to use nvm if it's installed | ||
if (process.platform !== 'win32') { | ||
// ~ is unavaible, so $HOME is used | ||
var home = process.env.HOME | ||
// If nvm is installed, try to load it | ||
// This will load default version | ||
arr = arr.concat([ | ||
'export NVM_DIR="' + home + '/.nvm"', | ||
'[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"' | ||
]) | ||
} | ||
// Can't find npm message | ||
var npmNotFound = 'husky - can\'t find npm in PATH. Skipping ' + cmd + ' script in package.json' | ||
arr = arr.concat([ | ||
// Test if npm is in PATH | ||
'command -v npm >/dev/null 2>&1 || { echo >&2 "' + npmNotFound + '"; exit 0; }', | ||
// Run script | ||
'npm run ' + cmd, | ||
@@ -69,3 +88,4 @@ 'if [ $? -ne 0 ]; then', | ||
' exit 1', | ||
'fi' | ||
'fi', | ||
'' | ||
]) | ||
@@ -84,3 +104,3 @@ | ||
} else { | ||
console.log(' skipping .git/hooks/' + name + ' (existing user hook)') | ||
console.log('skipping .git/hooks/' + name + ' (existing user hook)') | ||
} | ||
@@ -87,0 +107,0 @@ } |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
9075
11
171
49