UNPKG

@sap/cds

Version:

SAP Cloud Application Programming Model - CDS for Node.js

12 lines (10 loc) 624 B
const cmp = exports.compare = (x,y) => x.localeCompare (y, undefined, { numeric: true }) const check = exports.check = (x, min, max) => (!min || cmp(x,min) >= 0) && (!max || cmp(x,max) <= 0) exports.checkNodeVersion = (cds = require ('../../package.json')) => { let required = cds.engines?.node?.slice(2) //> e.g. >=22 let current = process.version.slice(1) //> e.g. v24.4.1 if (check(current, required)) return; else process.stderr.write (` Node.js version ${required} or higher is required for @sap/cds v${cds.version}. Current version ${current} does not satisfy this. \n\n`) return process.exit(1) }