husky
Advanced tools
Comparing version 4.3.1 to 4.3.2
@@ -38,3 +38,3 @@ "use strict"; | ||
const { name, version } = which_pm_runs_1.default(); | ||
throw new Error(`INIT_CWD is not set, please upgrade your package manager (${name} ${version})`); | ||
throw new Error(`INIT_CWD is not set, please check that your package manager supports it (${name} ${version})`); | ||
} | ||
@@ -63,4 +63,7 @@ debug_1.debug(`INIT_CWD is set to ${INIT_CWD}`); | ||
} | ||
const INIT_CWD = getInitCwdEnv(); | ||
const userPkgDir = getUserPkgDir(INIT_CWD); | ||
let cwd = process.argv[3]; | ||
if (cwd === undefined) { | ||
cwd = getInitCwdEnv(); | ||
} | ||
const userPkgDir = getUserPkgDir(cwd); | ||
checkGitDirEnv_1.checkGitDirEnv(); | ||
@@ -67,0 +70,0 @@ const { absoluteGitCommonDir, relativeUserPkgDir } = getDirs(userPkgDir); |
{ | ||
"name": "husky", | ||
"version": "4.3.1", | ||
"version": "4.3.2", | ||
"description": "Prevents bad commit or push (git hooks, pre-commit/precommit, pre-push/prepush, post-merge/postmerge and all that stuff...)", | ||
"bin": { | ||
"husky": "./husky.js", | ||
"husky-run": "./bin/run.js", | ||
@@ -7,0 +8,0 @@ "husky-upgrade": "./lib/upgrader/bin.js" |
@@ -9,4 +9,6 @@ # Husky | ||
__Announcement: Husky v5 (alpha) has been published, to view v5 docs click [here](https://typicode.github.io/husky).__ | ||
**Announcement: Husky v5 has been published, to view v5 docs click [here](https://typicode.github.io/husky).** | ||
**Note for npm 7 users** Currently `INIT_CWD` environment variable is missing in npm v7 and is required for Husky v4 to auto-install (https://github.com/npm/cli/issues/2033). To manually install husky v4, run `npx --no-install husky install .` or upgrade to husky v5. | ||
## Install | ||
@@ -53,3 +55,3 @@ | ||
### Companies ($100+/month) | ||
### Companies (\$100+/month) | ||
@@ -120,6 +122,6 @@ <!-- for (let i = 0; i < 40; i++) console.log(`[![Husky Sponsor](https://opencollective.com/husky/backer/${i}/avatar)](https://opencollective.com/husky/backer/${i}/website)`) --> | ||
* [webpack](https://github.com/webpack/webpack) | ||
* [babel](https://github.com/babel/babel) | ||
* [create-react-app](https://github.com/facebook/create-react-app) | ||
* ... and many other awesome projects | ||
- [webpack](https://github.com/webpack/webpack) | ||
- [babel](https://github.com/babel/babel) | ||
- [create-react-app](https://github.com/facebook/create-react-app) | ||
- ... and many other awesome projects | ||
@@ -130,19 +132,19 @@ ## Guides | ||
* [Upgrading from 0.14](#upgrading-from-014) | ||
* [Supported hooks](#supported-hooks) | ||
* [Access Git params and stdin](#access-git-params-and-stdin) | ||
* [Skip all hooks (rebase)](#skip-all-hooks-rebase) | ||
* [Disable auto-install](#disable-auto-install) | ||
* [CI servers](#ci-servers) | ||
* [Monorepos](#monorepos) | ||
* [Node version managers](#node-version-managers) | ||
* [Local commands (~/.huskyrc)](#local-commands-huskyrc) | ||
* [Multiple commands](#multiple-commands) | ||
* [Troubleshoot](#troubleshoot) | ||
+ [Debug messages](#debug-messages) | ||
+ [Hooks aren't running](#hooks-arent-running) | ||
+ [Commits aren't blocked](#commits-arent-blocked) | ||
+ [Commits are slow](#commits-are-slow) | ||
+ [Testing husky in a new repo](#testing-husky-in-a-new-repo) | ||
+ [ENOENT error 'node_modules/husky/.git/hooks'](#enoent-error-node_moduleshuskygithooks) | ||
- [Upgrading from 0.14](#upgrading-from-014) | ||
- [Supported hooks](#supported-hooks) | ||
- [Access Git params and stdin](#access-git-params-and-stdin) | ||
- [Skip all hooks (rebase)](#skip-all-hooks-rebase) | ||
- [Disable auto-install](#disable-auto-install) | ||
- [CI servers](#ci-servers) | ||
- [Monorepos](#monorepos) | ||
- [Node version managers](#node-version-managers) | ||
- [Local commands (~/.huskyrc)](#local-commands-huskyrc) | ||
- [Multiple commands](#multiple-commands) | ||
- [Troubleshoot](#troubleshoot) | ||
- [Debug messages](#debug-messages) | ||
- [Hooks aren't running](#hooks-arent-running) | ||
- [Commits aren't blocked](#commits-arent-blocked) | ||
- [Commits are slow](#commits-are-slow) | ||
- [Testing husky in a new repo](#testing-husky-in-a-new-repo) | ||
- [ENOENT error 'node_modules/husky/.git/hooks'](#enoent-error-node_moduleshuskygithooks) | ||
@@ -221,3 +223,3 @@ <!-- tocstop --> | ||
If you have a multi-package repository, it's __recommended__ to use tools like [lerna](https://github.com/lerna/lerna) and have husky installed ONLY in the root `package.json` to act as the source of truth. | ||
If you have a multi-package repository, it's **recommended** to use tools like [lerna](https://github.com/lerna/lerna) and have husky installed ONLY in the root `package.json` to act as the source of truth. | ||
@@ -260,2 +262,3 @@ Generally speaking, you should AVOID defining husky in multiple `package.json`, as each package would overwrite previous husky installation. | ||
For macOS and Linux users: | ||
- if you're running `git` commands in the terminal, husky will use the version defined in your shell `PATH`. In other words, if you're a `nvm` user, husky will use the version that you've set with `nvm`. | ||
@@ -277,3 +280,3 @@ - if you're using a GUI client and `nvm`, it may have a different `PATH` and not load `nvm`, in this case the highest `node` version installed by `nvm` will usually be picked. You can also check `~/.node_path` to see which version is used by GUIs and edit if you want to use something else. | ||
By design and just like `scripts` defined in `package.json`, husky will run hook scripts as a single command. | ||
By design and just like `scripts` defined in `package.json`, husky will run hook scripts as a single command. | ||
@@ -287,11 +290,8 @@ ```json | ||
```js | ||
const tasks = arr => arr.join(' && ') | ||
const tasks = (arr) => arr.join(' && ') | ||
module.exports = { | ||
'hooks': { | ||
'pre-commit': tasks([ | ||
'cmd', | ||
'cmd' | ||
]) | ||
} | ||
hooks: { | ||
'pre-commit': tasks(['cmd', 'cmd']), | ||
}, | ||
} | ||
@@ -358,5 +358,5 @@ ``` | ||
* [pkg-ok](https://github.com/typicode/pkg-ok) - Prevents publishing a module with bad paths or incorrect line endings | ||
* [please-upgrade-node](https://github.com/typicode/please-upgrade-node) - Show a message to upgrade Node instead of a stacktrace in your CLIs | ||
* [pinst](https://github.com/typicode/pinst) - dev only postinstall hook | ||
- [pkg-ok](https://github.com/typicode/pkg-ok) - Prevents publishing a module with bad paths or incorrect line endings | ||
- [please-upgrade-node](https://github.com/typicode/please-upgrade-node) - Show a message to upgrade Node instead of a stacktrace in your CLIs | ||
- [pinst](https://github.com/typicode/pinst) - dev only postinstall hook | ||
@@ -363,0 +363,0 @@ ## Patreon |
623
194391
25