wlxml: fix tests - extensions needs to be registered before querying nodes
[fnpeditor.git] / pre-commit.template.js
1 /* jshint node: true */
2 'use strict';
3
4 var exec = require('child_process').exec;
5 var fs = require('fs');
6
7 exec('git diff --cached --name-status', function (err, stdout) {
8     void(err);
9     var toLint = [];
10     stdout.split('\n').forEach(function(line) {
11         var filePath = line.split('\t')[1];
12         if(filePath && filePath.substr(-3) === '.js' && fs.existsSync(filePath)) {
13             toLint.push(filePath);
14         }
15     });
16     if(toLint.length) {
17         exec('grunt {{task}} {{args}} --jshint-targets=' + toLint.join(','), function (err, stdout) {
18             console.log(stdout);
19             process.exit(err ? -1 : 0);
20         });
21     }
22 });