Files
cypress/scripts/check-node-version.js
Gleb Bahmutov 586d677b3d ci: use Node 8.2.1 to build binary on Windows CI #1390 (#1391)
* ci: use Node 8.2.1 to build binary on Windows CI #1390

* use Node 8.2.1 on Mac buildkite

* add comment

* source bashrc

* print home folder

* do not source bashrc

* install nvm using curl

* back to nvm using bash_profile

* hmm, maybe it is using different shell

* hmm, login into bash

* remove nvm commands

* chore: add script to check Node version against .node-version
2018-02-28 15:37:43 -05:00

21 lines
751 B
JavaScript

// TODO make this check a 3rd party little tool
// we want to ensure we are building using the same major version
// as the one specified in ../.node-version file
const read = require('fs').readFileSync
const join = require('path').join
const nodeVersionNeededString = read(join(__dirname, '..', '.node-version'), 'utf8')
const nodeVersionNeeded = nodeVersionNeededString.split('.')
const nodeVersion = process.versions.node.split('.')
// check just major version for now
if (nodeVersionNeeded[0] !== nodeVersion[0]) {
/* eslint-disable no-console */
console.error('🛑 .node-version specified %s', nodeVersionNeededString)
console.error('but current Node is %s', process.versions.node)
/* eslint-enable no-console */
process.exit(1)
}