build(deps-dev): apply updates
[e-mobility-charging-stations-simulator.git] / build-requirements.js
CommitLineData
66a7748d 1import chalk from 'chalk'
8f801a93 2import { satisfies } from 'semver'
66a7748d
JB
3import packageJson from './package.json' assert { type: 'json' }
4import { version, exit } from 'node:process'
1f7fa4de 5
67623aa6 6/**
fc040c43 7 * Check if the current node version match the required engines version.
67623aa6 8 */
1cee0015 9export const checkNodeVersion = () => {
66a7748d 10 const enginesNodeVersion = packageJson.engines.node
8f801a93 11 if (satisfies(version, enginesNodeVersion) === false) {
67623aa6
JB
12 console.error(
13 chalk.red(
412cece8 14 `Required node version ${enginesNodeVersion} not satisfied with current version ${version}`
66a7748d
JB
15 )
16 )
ef85c95a 17 // eslint-disable-next-line n/no-process-exit
66a7748d 18 exit(1)
67623aa6 19 }
66a7748d 20}
67623aa6 21
66a7748d 22checkNodeVersion()