-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathGruntfile.js
113 lines (101 loc) · 2.27 KB
/
Gruntfile.js
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
module.exports = function (grunt) {
grunt.initConfig({
ts: {
options: grunt.file.readJSON("tsconfig.json").compilerOptions,
devlib: {
src: ["lib/**/*.ts", "typings/**/*.ts"],
reference: "lib/.d.ts"
},
devall: {
src: ["lib/**/*.ts", "test/**/*.ts", "typings/**/*.ts"],
reference: "lib/.d.ts"
},
release_build: {
src: ["lib/**/*.ts", "test/**/*.ts", "typings/**/*.ts"],
reference: "lib/.d.ts",
options: {
sourceMap: false,
removeComments: true
}
}
},
tslint: {
build: {
files: {
src: ["lib/**/*.ts", "test/**/*.ts", "typings/**/*.ts", "!**/*.d.ts"]
},
options: {
configuration: grunt.file.readJSON("./tslint.json"),
project: "tsconfig.json"
}
}
},
watch: {
devall: {
files: ["lib/**/*.ts", 'test/**/*.ts'],
tasks: [
'ts:devall',
'shell:npm_test'
],
options: {
atBegin: true,
interrupt: true
}
},
ts: {
files: ["lib/**/*.ts", "test/**/*.ts"],
tasks: [
'ts:devall'
],
options: {
atBegin: true,
interrupt: true
}
}
},
shell: {
options: {
stdout: true,
stderr: true,
failOnError: true
},
build_package: {
command: "npm pack"
},
npm_test: {
command: "npm test"
}
},
clean: {
src: ["test/**/*.js*", "lib/**/*.js*", "!lib/hooks/**/*.js", "!Gruntfile.js", "*.tgz"]
}
});
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-shell");
grunt.loadNpmTasks("grunt-ts");
grunt.loadNpmTasks("grunt-tslint");
grunt.registerTask("delete_coverage_dir", function () {
var done = this.async();
var rimraf = require("rimraf");
rimraf("coverage", function (err) {
if (err) {
console.log("Error while deleting coverage directory from the package: ", err);
done(false);
}
done();
});
});
grunt.registerTask("test", ["ts:devall", "shell:npm_test"]);
grunt.registerTask("pack", [
"clean",
"ts:release_build",
"shell:npm_test",
"delete_coverage_dir",
"shell:build_package"
]);
grunt.registerTask("lint", ["tslint:build"]);
grunt.registerTask("all", ["clean", "test", "lint"]);
grunt.registerTask("rebuild", ["clean", "ts:devlib"]);
grunt.registerTask("default", "ts:devlib");
};