https://github.com/frontsideair/yarnhook
Run `yarn install`, `npm install` or `pnpm install` on git hooks automatically
https://github.com/frontsideair/yarnhook
command-line git git-hooks hacktoberfest nodejs npm yarn
Last synced: about 1 month ago
JSON representation
Run `yarn install`, `npm install` or `pnpm install` on git hooks automatically
- Host: GitHub
- URL: https://github.com/frontsideair/yarnhook
- Owner: frontsideair
- License: mit
- Created: 2017-12-17T14:21:19.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-02-19T14:12:01.000Z (about 1 year ago)
- Last Synced: 2025-04-04T01:08:29.860Z (about 1 month ago)
- Topics: command-line, git, git-hooks, hacktoberfest, nodejs, npm, yarn
- Language: JavaScript
- Homepage:
- Size: 221 KB
- Stars: 217
- Watchers: 4
- Forks: 17
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yarnhook [](https://badge.fury.io/js/yarnhook)

`yarnhook` keeps your `node_modules` up-to-date when your `yarn.lock`, `package-lock.json` or
`shrinkwrap.yaml` changes due to git operations like `checkout`, `merge`, `rebase`, `pull` etc.# Easy installation
You can install `yarnhook` to your project with [mrm](https://mrm.js.org/).
```sh
npx mrm yarnhook
```# Manual installation
This package should be used with [husky](https://www.npmjs.com/package/husky).
```sh
yarn add --dev yarnhook husky
# or
npm install --save-dev yarnhook husky
# or
pnpm install --save-dev yarnhook husky
```## Configuration
You should let `yarnhook` handle git hooks that change the dependencies. Example `package.json` is
as follows:```json
{
"husky": {
"hooks": {
"post-checkout": "yarnhook",
"post-merge": "yarnhook",
"post-rewrite": "yarnhook"
}
}
}
```# Flags
Prepend these flags to your git command to use them.
* `YARNHOOK_BYPASS`: Run git command bypassing yarnhook completely
* `YARNHOOK_DEBUG`: Print debug information
* `YARNHOOK_DRYRUN`: Don't install dependencies, only notifyAn example:
```sh
YARNHOOK_BYPASS=true git checkout feature-branch
```# Artwork
Project logo: @anilkilic
Font: PT Sans