Skip to content

Run `yarn install`, `npm install` or `pnpm install` on git hooks automatically

License

Notifications You must be signed in to change notification settings

frontsideair/yarnhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yarnhook npm version

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.

npx mrm yarnhook

Manual installation

This package should be used with husky.

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:

{
  "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 notify

An example:

YARNHOOK_BYPASS=true git checkout feature-branch

Artwork

Project logo: @anilkilic

Font: PT Sans