Skip to content
Permalink
Browse files

chore(gruntfile): check the node version before starting

We specify the node version that is required to run the build in the `.nvmrc`
file. So let's check that the current node version satisfies this and report
a helpful message if it is not.
  • Loading branch information
petebacondarwin committed Oct 21, 2016
1 parent a6118df commit eeb9ef09f9972ec1850549f06a324f150b732873
Showing with 8 additions and 0 deletions.
  1. +8 −0 Gruntfile.js
@@ -9,6 +9,14 @@ var versionInfo = require('./lib/versions/version-info');
var path = require('path');
var e2e = require('./test/e2e/tools');

var semver = require('semver');
var fs = require('fs');

var useNodeVersion = fs.readFileSync('.nvmrc', 'utf8');
if (!semver.satisfies(process.version, useNodeVersion)) {
throw new Error('Invalid node version; please use node v' + useNodeVersion);
}

module.exports = function(grunt) {
//grunt plugins
require('load-grunt-tasks')(grunt);

0 comments on commit eeb9ef0

Please sign in to comment.
You can’t perform that action at this time.