Package Watch is a Visual Studio Code extension that checks and installs the local node dependencies. It monitors your package.json
, package-lock.json
or yarn.lock
, and installs the missing/outdated node dependencies using yarn
or npm
automatically.
As soon as Package Watch is installed, the extension offers the following features:
- Running
packageWatch.checkDependencies
command finds all of yourpackage.json
inside the current workspace, and tells if all node dependency is in-sync. - Running
packageWatch.installDependencies
command executes eitheryarn install --check-files
ornpm install
, and finally runspackageWatch.checkDependencies
command. - When a workspace containing
package.json
is opened,packageWatch.checkDependencies
command is triggered automatically. - When
package.json
,package-lock.json
oryarn.lock
gets added/modified,packageWatch.checkDependencies
command is triggered automatically. - The extension supports Yarn Workspace out of the box. It runs
yarn install
only once for those linked directories. - The extension checks if a dependency is in-sync by reading the version numbers from
package.json
,package-lock.json
/yarn.lock
, andnode_modules/*/package.json
. - The extension prefers
yarn install
, if bothpackage-lock.json
andyarn.lock
are found. - The extension prefers
yarn install
, if neitherpackage-lock.json
noryarn.lock
are found andwhich yarn
results in a success. - After running
packageWatch.installDependencies
command, if the node dependencies are still not in-sync, the second try will execute eitheryarn install --check-files --force
ornpm install --force
.