-
Notifications
You must be signed in to change notification settings - Fork 2
/
gruntfile.js
106 lines (102 loc) · 3.08 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
module.exports = function (grunt) {
"use strict";
grunt.initConfig({
// Copy dir and files
copy: {
build: {
files: [
{
expand: true,
cwd: "./src/",
src: [".sequelizerc"],
dest: "./dist/"
}
]
}
},
// Compile ts files and copy them on dist folder
ts: {
app: {
files: [{
src: ["src/\*\*/\*.ts", "src/\*\*/\*.js", "!src/.baseDir.ts"],
dest: "./dist"
}],
options: {
module: "commonjs",
target: "es6",
sourceMap: false,
rootDir: "src",
allowJs: true,
listFiles: false,
esModuleInterop: true
}
}
},
yaml: {
your_target: {
options: {
ignored: /^_/,
space: 4,
customTypes: {
'!include scalar': function (value, yamlLoader) {
return yamlLoader(value);
},
'!max sequence': function (values) {
return Math.max.apply(null, values);
},
'!extend mapping': function (value, yamlLoader) {
return _.extend(yamlLoader(value.basePath), value.partial);
}
}
},
files: [
{ expand: true, cwd: './src/resources/swagger', src: ['**/*.yaml'], dest: './src/resources/swagger' }
]
},
},
// Watch file changes and reboot the server
watch: {
ts: {
files: ["src/\*\*/\*.ts"],
tasks: ["ts", "shell"]
}
},
// Start the node server using compiled js files
shell: {
options: {
stderr: true
},
target: {
command: 'node ./dist/server/server.js'
},
another: 'node ./dist/server/server.js' // Shorthand
},
// Run concurrent commands
concurrent: {
concurrent_tasks: {
tasks: ['watch', 'shell'],
options: {
logConcurrentOutput: true
}
}
},
});
// Load NPM Tasks
grunt.loadNpmTasks("grunt-yaml")
grunt.loadNpmTasks("grunt-contrib-copy")
grunt.loadNpmTasks("grunt-contrib-watch")
grunt.loadNpmTasks("grunt-ts")
grunt.loadNpmTasks('grunt-shell')
grunt.loadNpmTasks("grunt-concurrent")
grunt.registerTask("default", [
"ts",
"copy",
"yaml",
"concurrent:concurrent_tasks"
]);
grunt.registerTask("build", [
"ts",
"copy",
"yaml"
]);
};