Skip to content

Instantly share code, notes, and snippets.

@frank-dspeed
Forked from jareware/package-json-engines.md
Created February 16, 2018 14:06
Show Gist options
  • Select an option

  • Save frank-dspeed/a6144211d076ded3f89ecd8e23abb08f to your computer and use it in GitHub Desktop.

Select an option

Save frank-dspeed/a6144211d076ded3f89ecd8e23abb08f to your computer and use it in GitHub Desktop.
Enforcing the engines property of package.json

Document your target environment with:

"engines": {
  "npm": ">=3.3.12 <4",
  "node": ">=5.5.0 <6"
},

Then install this:

"devDependencies": {
  "check-node-version": "1.1.0"
}

And barf when running on an incompatible platform:

"scripts": {
  "build": "check-node-version --package && ...",
  "watch": "check-node-version --package && ..."
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment