refactor: ensure ATG will not start a transaction if one is already
[e-mobility-charging-stations-simulator.git] / build-requirements.js
CommitLineData
66a7748d
JB
1import chalk from 'chalk'
2import semVer from 'semver'
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
10687422 11 if (semVer.satisfies(version, enginesNodeVersion) === false) {
67623aa6
JB
12 console.error(
13 chalk.red(
66a7748d
JB
14 `Required node version ${enginesNodeVersion} not satisfied with current version ${version}.`
15 )
16 )
ef85c95a 17 // eslint-disable-next-line n/no-process-exit
66a7748d 18 exit(1)
67623aa6 19 }
66a7748d 20}
67623aa6 21
66a7748d 22checkNodeVersion()