JSPM

strict-npm-engines

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 376
  • Score
    100M100P100Q92838F
  • License MIT

Enforce the NPM and Node versions specified in the package.json 'engines' property.

Package Exports

  • strict-npm-engines

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (strict-npm-engines) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

strict-npm-engines

Enforce the NPM and Node versions specified in the package.json "engines" property.

Install

npm install strict-npm-engines --save-dev
yarn add strict-npm-engines --dev

Requirements

Requires node 7.6 or higher for Async/Await.

How to use

  1. Add the engines field to your package.json, like this:
{
  "engines": {
    "node": ">=8",
    "npm": ">6"
  }
}

You can read more about engines in the npm documentation

  1. Install strict-npm-engines (documentation above)

  2. Add strict-npm-engines to your npm scripts.

{
  "scripts": {
    "start": "strict-npm-engines && node ./index.js"
  }
}

If an incorrect npm or node version is used, an error message will be printed, and the process will exit with an error. Like this:

Invalid node version. Expected >=12 but got 8.16.0.

If the engines satisfy the range, the process will exit without an error.