Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Node.js & npm versions defined in engines section of package.json #29

Open
ntwb opened this issue Jul 11, 2017 · 1 comment
Open

Comments

@ntwb
Copy link

ntwb commented Jul 11, 2017

A package.json file can have an engines section where Node.js and npm required versions can be defined, it would be great if check-dependencies supported this.

Ref: https://docs.npmjs.com/files/package.json#engines

Example:

"engines": {
  "node": ">=6.9.1",
  "npm": "^5.2.0"
}

The above is what I plan on changing a few projects I work on and if grunt-check-dependencies were to then throw a warning that a user has an older npm 3.x or 4.x, 5.0.x or 5.1.x installed that would be fantastic.

@mgol
Copy link
Owner

mgol commented Jul 26, 2017

I think I'd be fine with such a feature. A few notes, though, before anyone tries to have a shot at this:

  1. This should be hidden behind an option as not all people will need it.
  2. I'm worried about performance. You can check the current Node version quickly by reading process.versions.node but with npm you'll have to spawn npm --version or use its kinda inofficial Node API. That will require require('npm'), though, not sure how quick it is. The whole purpose of this package was to make checking for the packages quick. On an average project with 30 dependencies, all correctly installed check-dependencies currently takes about 0.3s; npm --version itself takes about that much so this could increase the time required for check-dependencies to finish which is worrying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants