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.checkDependenciescommand finds all of yourpackage.jsoninside the current workspace, and tells if all node dependency is in-sync. - Running
packageWatch.installDependenciescommand executes eitheryarn install --check-filesornpm install, and finally runspackageWatch.checkDependenciescommand. - When a workspace containing
package.jsonis opened,packageWatch.checkDependenciescommand is triggered automatically. - When
package.json,package-lock.jsonoryarn.lockgets added/modified,packageWatch.checkDependenciescommand is triggered automatically. - The extension supports Yarn Workspace out of the box. It runs
yarn installonly 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.jsonandyarn.lockare found. - The extension prefers
yarn install, if neitherpackage-lock.jsonnoryarn.lockare found andwhich yarnresults in a success. - After running
packageWatch.installDependenciescommand, if the node dependencies are still not in-sync, the second try will execute eitheryarn install --check-files --forceornpm install --force.
