-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprecommit.js
More file actions
43 lines (30 loc) · 896 Bytes
/
precommit.js
File metadata and controls
43 lines (30 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// precommit.js
var exec = require('child_process').exec;
// https://npmjs.org/package/execSync
// Executes shell commands synchronously
var sh = require('sync-exec').run;
console.log("test");
var dirname = __dirname;
dirname = dirname.replace(/\.git\\hooks/g, "bower\\Gruntfile.js");
console.log(dirname);
exec('echo "hello world"', function (err, stdout, stderr) {
exec('grunt', function (err, stdout, stderr) {
console.log(0);
console.log(err);
console.log(stdout);
exec('git add .', function (err, stdout, stderr) {
console.log(1);
console.log(err);
console.log(stdout);
var exitCode = 0;
process.exit(exitCode);
/*exec("grunt --gruntfile " + dirname, function (err, stdout, stderr) {
console.log(2);
console.log(err);
console.log(stdout);
var exitCode = 0;
process.exit(exitCode);
});*/
});
});
});