From 25299904da20d857468af2daf8b2fd73c7ec5fc0 Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Fri, 3 Apr 2015 22:12:21 +0200 Subject: [PATCH] Read jshint version from package.json --- make.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/make.js b/make.js index ff4c151f0..b480ceebb 100644 --- a/make.js +++ b/make.js @@ -1459,7 +1459,15 @@ target.lint = function() { var jshintPath = path.normalize('./node_modules/.bin/jshint'); if (!test('-f', jshintPath)) { echo('jshint is not installed -- installing...'); - exec('npm install jshint@2.4.x'); // TODO read version from package.json + // Read the jshint version to be installed from package.json. + try { + var rawConfiguration = fs.readFileSync('package.json', 'utf8'); + var configuration = JSON.parse(rawConfiguration); + exec('npm install jshint@' + configuration.devDependencies.jshint); + } catch (e) { + echo('package.json does not exist -- aborting...'); + return; + } } // Lint the Firefox specific *.jsm files. var options = '--extra-ext .jsm';