2021-10-18 19:31:15 +00:00
import { engines } from '../../package.json'
export async function checkEngines ( ) {
2021-11-02 15:56:12 +00:00
const satisfies = await import ( 'semver/functions/satisfies.js' )
. then ( r = > r . default || r as any as typeof import ( 'semver/functions/satisfies.js' ) ) // npm/node-semver#381
2021-10-18 19:31:15 +00:00
const currentNode = process . versions . node
const nodeRange = engines . node
2021-11-02 09:43:08 +00:00
if ( ! satisfies ( currentNode , nodeRange ) ) {
2021-10-18 19:31:15 +00:00
console . warn ( ` Current version of Node.js ( \` ${ currentNode } \` ) is unsupported and might cause issues. \ n Please upgrade to a compatible version ( ${ nodeRange } ). ` )
}
}