Skip to content

Compares your lockfile with installed dependencies and triggers an installation on mismatches. Works with npm, yarn 1 and pnpm.

Notifications You must be signed in to change notification settings

manuschillerdev/sync-deps

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sync-deps

TLDR; Compares your lockfile with installed dependencies and triggers an installation on mismatches. Works with npm, yarn and pnpm.

Tired of your local dev-server not starting after you checked out a branch that has different dependencies than you previous one? Normally you would have to manually update your dependencies. sync-deps can automate this step.

Based on your lockfile it automatically detects whether you use npm, yarn or pnpm and acts accordingly.

heavily inspired by this gist!

Usage

Install as devDependency (adds ~1MB to your node_modules): yarn add -D sync-deps

Option one: add as pre-hook of your dev task:

In this case sync-deps checks your dependencies before your dev server starts.

Example - in a NextJS environment:

{
  "scripts": {
    "predev": "sync-deps",
    "dev": "next dev"
  }
}

Option two: usage with husky on post-checkout

In this case sync-deps checks your dependencies, whenever you check out a different branch via git.

with yarn:

yarn add -D husky
yarn husky install
yarn husky add .husky/post-checkout "sync-deps"

with npx:

npm install husky --save-dev
npx husky install
npx husky add .husky/post-checkout "sync-deps"

About

Compares your lockfile with installed dependencies and triggers an installation on mismatches. Works with npm, yarn 1 and pnpm.

Resources

Stars

Watchers

Forks

Packages

No packages published