From d8ddbcf9399359ecc95480aec12d94686e0cc8ef Mon Sep 17 00:00:00 2001 From: zepumph Date: Thu, 24 Oct 2019 15:10:45 -0800 Subject: [PATCH] error out if using node less than 8.10, https://github.com/phetsims/chipper/issues/737 --- js/grunt/Gruntfile.js | 1 + js/grunt/checkNodeVersion.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 js/grunt/checkNodeVersion.js diff --git a/js/grunt/Gruntfile.js b/js/grunt/Gruntfile.js index f3e266f1..ae99d1c9 100644 --- a/js/grunt/Gruntfile.js +++ b/js/grunt/Gruntfile.js @@ -11,6 +11,7 @@ // grunt tasks const assert = require( 'assert' ); +require( './checkNodeVersion' ); const checkoutDependencies = require( '../common/checkoutDependencies' ); const checkoutMaster = require( '../common/checkoutMaster' ); const checkoutMasterAll = require( './checkoutMasterAll' ); diff --git a/js/grunt/checkNodeVersion.js b/js/grunt/checkNodeVersion.js new file mode 100644 index 00000000..71415d57 --- /dev/null +++ b/js/grunt/checkNodeVersion.js @@ -0,0 +1,17 @@ +// Copyright 2019, University of Colorado Boulder + +/** + * Error out if Node version is out of date. Uses process.version + * + * @author Michael Kauzmann (PhET Interactive Simulations) + */ + +'use strict'; + +// constants +const NODE_VERSION_STRING_PARTS = process.version.replace( 'v', '' ).split( '.' ); +const NODE_MAJOR_VERSION = parseInt( NODE_VERSION_STRING_PARTS[ 0 ], 10 ); +const NODE_MINOR_VERSION = parseInt( NODE_VERSION_STRING_PARTS[ 1 ], 10 ); +if ( NODE_MAJOR_VERSION < 8 || ( NODE_MAJOR_VERSION === 8 && NODE_MINOR_VERSION < 10 ) ) { + throw new Error( 'Node 8.10 or greater is needed to run PhET build tools' ); +}