summaryrefslogtreecommitdiffstats
path: root/scripts/verifyVersion.js
blob: 8ad2d192a666d8006ddfe9d5a1977773099f154a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* istanbul ignore file */

const [major, minor, patch] = process.versions.node.split('.').map(v => Number(v))
const required = process.argv.pop().split('.').map(v => Number(v))

const badMajor = major < required[0]
const badMinor = major === required[0] && minor < required[1]
const badPatch = major === required[0] && minor === required[1] && patch < required[2]

if (badMajor || badMinor || badPatch) {
  console.log(`Required Node.js >=${required.join('.')}, got ${process.versions.node}`)
  console.log('Skipping')
} else {
  process.exit(1)
}