-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
66 lines (59 loc) · 2 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
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
nodemon: {
dev: {
script: 'server.js'
},
options: {
ignore: ['node_modules/**', 'Gruntfile.js'],
env: {
PORT: '8181'
}
}
},
watch: {
scripts: {
files: ['server.ts', '!node_modules/**/*.ts'], // the watched files
tasks: ["newer:tslint:all", "ts:build"], // the task to run
options: {
spawn: false // makes the watch task faster
}
}
},
concurrent: {
watchers: {
tasks: ['nodemon', 'watch'],
options: {
logConcurrentOutput: true
}
}
},
tslint: {
options: {
configuration: grunt.file.readJSON("tslint.json")
},
all: {
src: ["server.ts", "!node_modules/**/*.ts", "!obj/**/*.ts", "!typings/**/*.ts"] // avoid linting typings files and node_modules files
}
},
ts: {
build: {
src: ["server.ts", "!node_modules/**/*.ts"], // Avoid compiling TypeScript files in node_modules
options: {
module: 'commonjs', // To compile TypeScript using external modules like NodeJS
fast: 'never' // You'll need to recompile all the files each time for NodeJS
}
}
}
});
grunt.loadNpmTasks("grunt-ts");
grunt.loadNpmTasks("grunt-tslint");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-nodemon");
grunt.loadNpmTasks("grunt-concurrent");
// Default tasks.
grunt.registerTask("serve", ["concurrent:watchers"]);
grunt.registerTask('default', ["tslint:all", "ts:build"]);
};