fix: fix worker set elementsPerWorker sanity check
[e-mobility-charging-stations-simulator.git] / build-requirements.js
1 import chalk from 'chalk'
2 import { satisfies } from 'semver'
3 import packageJson from './package.json' assert { type: 'json' }
4 import { version, exit } from 'node:process'
5
6 /**
7 * Check if the current node version match the required engines version.
8 */
9 export const checkNodeVersion = () => {
10 const enginesNodeVersion = packageJson.engines.node
11 if (satisfies(version, enginesNodeVersion) === false) {
12 console.error(
13 chalk.red(
14 `Required node version ${enginesNodeVersion} not satisfied with current version ${version}`
15 )
16 )
17 // eslint-disable-next-line n/no-process-exit
18 exit(1)
19 }
20 }
21
22 checkNodeVersion()