Skip to content

Latest commit

 

History

History
49 lines (31 loc) · 1.24 KB

README.md

File metadata and controls

49 lines (31 loc) · 1.24 KB

max-engines-versions

Find the maximum version for each engine (specified in package.json) among all dependencies. :warning: It only works if npm install or yarn install have been successfully run before.

It is useful because not specifying the supported engines explicitly may result in some incompatible packages crashing at runtime instead when install your package. Dynamic imports/requires that require unnoticed incompatible packages may not be executed during testing or non-edge case usage.

Installation

npm install -save-dev max-engines-versions

or

yarm add --dev max-engines-versions

Usage

It looks for all package.json files in current working directories node_modules folder and parses the matched files's .engines property.

cli

npx max-engines-versions

Node

const maxEnginesVersions = require('max-engines-versions')

async function f() {
    const [versions, reasons] = await main()
    // 'versions' is the object you're looking for, e.g.
    //  {node: '10.0.0'}
    // 'reasons' is an object with the package names for each type of engine,
    // e.g. {node: 'this-package-requires-node-10'}
}

Example

Clone this repo, run npm install and then npm test.