mgol / check-dependencies

Checks if currently installed npm dependencies are installed in the exact same versions that are specified in package.json
MIT License
115 stars 30 forks source link

Yarn support and/or callback #26

Open taoeffect opened 7 years ago

taoeffect commented 7 years ago

Per your request, re-opening here.

Currently this package doesn't support Yarn. This could be ameliorated either by:

OliverJAsh commented 7 years ago

How would this be different from yarn check?

mgol commented 7 years ago

@OliverJAsh Mostly in that the check is blazingly fast:

$ time check-dependencies
check-dependencies  0.14s user 0.02s system 105% cpu 0.156 total

Meanwhile:

$ time yarn check
yarn check v0.24.6
warning "selenium-webdriver#ws@^1.0.1" could be deduped from "1.1.2" to "ws@1.1.2"
warning "bower#insight#request@^2.40.0" could be deduped from "2.79.0" to "request@2.79.0"
warning "chokidar#fsevents#node-pre-gyp@^0.6.29" could be deduped from "0.6.33" to "node-pre-gyp@0.6.33"
warning "insight#inquirer#chalk@^0.5.0" could be deduped from "0.5.1" to "insight#chalk@0.5.1"
info Found 4 warnings.
success Folder in sync.
✨  Done in 3.35s.
yarn check  3.05s user 0.87s system 108% cpu 3.615 total

Tests were performed on current AngularJS master with all dependencies installed.

3.05s vs 0.15s is a pretty significant difference!

Obviously, this doesn't come without drawbacks. I assume yarn check does more work and is able to correct more scenarios, whereas check-dependencies will only check top-level packages and will report success if someone has messed-up node_modules otherwise. But it works good as a quick check "Do I have current dependencies or do I have to invoke yarn/npm install before running my gulp task?".

kuceb commented 5 years ago

yarn check --verify-tree should be a lot faster than a yarn check, but unfortunately does not work for yarn workspaces where you have hoisted node_modules.

This package doesn't support that either, though.

root
    package.json
    node_modules/
        a-module-dep
    packages/
        a-module
        package.json