This repository has been archived by the owner on Nov 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
188 lines (166 loc) · 4.61 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*
* App-related tasks
*/
"use strict";
module.exports = function (grunt) {
// Show elapsed time at the end
require("time-grunt")(grunt);
// Load all grunt tasks
require("load-grunt-tasks")(grunt);
grunt.initConfig({
watch: {
express: {
files: [],
tasks: [],
options: {
spawn: false
}
}
},
// Clean Config
clean: {
dist: {
files: [
{
dot: true,
src: [
".tmp",
"dist/*",
"server/dist"
]
}
]
},
server: {
files: [
{
dot: true,
src: [
"server/dist/*"
]
}
]
}
},
// Express Config
express: {
options: {
// Override defaults here
},
dev: {
options: {
script: "server/dist/server.js",
debug: true
}
},
prod: {
options: {
script: "server/dist/server.js",
debug: false
}
}
},
mochaTest: {
service: {
options: {
reporter: "spec",
require: ["test/globals/globals.js"],
timeout: 10000,
colors: true
},
src: ["test/service/**/*.js"]
},
api: {
options: {
reporter: "spec",
colors: true,
timeout: 10000,
require: "test/_ts-loader"
},
src: ["test/_app-loader.ts", "test/api/**/*.ts"]
}
},
env: {
test: {
NODE_ENV: "test"
},
local: {
NODE_ENV: "local",
//BW_DATA_URL: "https://dss-aws-staging.ucsc-cgp-dev.org"
// BW_DATA_URL: "https://carlos.ucsc-cgp-dev.org"
//BW_DATA_URL: "https://ucsc-cgp.org"
//BW_DATA_URL: "https://jesse.ucsc-cgp-dev.org/"
}
},
compress: {
dist: {
options: {
archive: './boardwalk.zip',
mode: 'zip'
},
files: [
{src: './package.json', dest: '/'},
{src: './views/home.html', dest: '/'},
{src: './server/dist/**/*.js', dest: '/'},
{src: './dist/**/*.*', dest: '/'}
]
}
},
exec: {
clearTests: {
command: "rm -rf ./test/integration/test/test-results"
},
buildServer: {
command: "cd server && tsc || true"
},
cleanServer: {
command: "rm -rf server/dist"
}
},
spawn: {
buildSpa: {
command: "npm",
commandArgs: ["run", "build"],
passThrough: true,
opts: {
cwd: __dirname + "/spa"
}
}
},
tslint: {
options: {
configuration: "tslint.json",
force: true // Build errors will be reported, but not prevent completion
},
files: [
"server/src/**/*.ts"
]
}
});
// Register Tasks
// Workon
grunt.registerTask("workon", "Start working on this project!", [
"clean:server",
"exec:buildServer",
"env:local",
"express:dev",
"watch"
]);
// Build
grunt.registerTask("build", "Build production ready assets and views", [
"clean:dist",
"tslint",
"spawn:buildSpa",
"exec:buildServer",
"compress:dist"
]);
// Used for delaying livereload until after server has restarted
grunt.registerTask("wait", function () {
grunt.log.ok("Waiting for server reload...");
var done = this.async();
setTimeout(function () {
grunt.log.writeln("Done waiting!");
done();
}, 2000);
});
};