Merge pull request #5908 from timvandermeij/read-package-json

Read jshint version from package.json
This commit is contained in:
Jonas Jenwald 2015-04-04 17:37:13 +02:00
commit b85a51d072

10
make.js
View File

@ -1459,7 +1459,15 @@ target.lint = function() {
var jshintPath = path.normalize('./node_modules/.bin/jshint'); var jshintPath = path.normalize('./node_modules/.bin/jshint');
if (!test('-f', jshintPath)) { if (!test('-f', jshintPath)) {
echo('jshint is not installed -- installing...'); 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. // Lint the Firefox specific *.jsm files.
var options = '--extra-ext .jsm'; var options = '--extra-ext .jsm';