-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.ts
218 lines (189 loc) · 4.63 KB
/
gulpfile.ts
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/// <reference path="typings/tsd.d.ts" />
var config = require('./conf/gulpconf.js').config,
func = require('./conf/gulpfunc.js').func,
connect = require('gulp-connect'),
gulp = require('gulp');
gulp.task('default', [
'build'
]);
gulp.task('build', [
'build:bower',
'build:ts:main',
'build:ts:test',
'build:ts:e2e',
'build:ts:doc',
'build:sass',
'build:json',
'build:html'
]);
// Bower related tasks
gulp.task('build:bower', function ()
{
return func.build.bower(
config.paths.build.development + '/vendor',
config.filters.bower,
false,
false);
});
// TypeScript relates tasks
gulp.task('build:ts:main', function ()
{
return func.build.typescript(
config.paths.build.development,
config.paths.source.typescript.main,
config.typescript,
false,
false).pipe(connect.reload());
});
gulp.task('build:ts:test', function ()
{
return func.build.typescript(
config.paths.build.development,
config.paths.source.typescript.test,
config.typescript,
false,
false).pipe(connect.reload());
});
gulp.task('build:ts:e2e', function ()
{
return func.build.typescript(
config.paths.build.development,
config.paths.source.typescript.e2e,
config.typescript,
false,
false).pipe(connect.reload());
});
// TypeScript Doc
gulp.task('build:ts:doc', function ()
{
return func.build.typedoc(
config.paths.build.development,
config.paths.source.typescript.typedoc,
config.typedoc
);
});
// Sass related tasks
gulp.task('build:sass', function ()
{
return func.build.scss(
config.paths.build.development + '/css',
config.paths.source.scss,
false,
false).pipe(connect.reload());
});
// HTML related tasks
gulp.task('build:html', function ()
{
return func.build.copy(
config.paths.build.development,
config.paths.source.html,
false,
false).pipe(connect.reload());
});
// json related tasks
gulp.task('build:json', function ()
{
return func.build.copyJSON(
config.paths.build.development,
config.paths.source.json,
false,
false).pipe(connect.reload());
});
// RequireJS related tasks
gulp.task('build:release', ['build'], function ()
{
func.build.scss(
config.paths.build.release + '/css',
config.paths.source.scss,
true,
false).pipe(connect.reload());
func.build.copy(
config.paths.build.release,
config.paths.source.html).pipe(connect.reload());
func.build.copy(
config.paths.build.release + '/vendor/fonts',
config.paths.build.development + '/vendor/fonts/*').pipe(connect.reload());
func.build.copyCSS(
config.paths.build.release + '/vendor/css',
config.paths.build.development + '/vendor/css/*',
true,
false).pipe(connect.reload());
func.build.copyJS(
config.paths.build.release,
config.paths.build.development + '/config.js',
true,
false).pipe(connect.reload());
func.build.copyJSON(
config.paths.build.release,
config.paths.build.development + '/*.json',
false,
false).pipe(connect.reload());
func.build.copyJSON(
config.paths.build.release,
config.paths.build.development + '/**/*.json',
false,
false).pipe(connect.reload());
func.build.copyJS(
config.paths.build.release + '/vendor/js',
config.paths.build.development + '/vendor/js/require.js',
true,
false).pipe(connect.reload());
return func.build.requirejs(
'boot.js',
config.paths.build.release,
config.paths.build.development,
'boot',
[
],
true,
false).pipe(connect.reload());
});
// Unit test related tasks
gulp.task('run:test:unit', function ()
{
return func.test.unit(
'./conf/karma.conf.js',
false
);
});
gulp.task('run:test:unit:ci', function ()
{
return func.test.unit(
'./conf/karma-ci.conf.js',
false
);
});
// E2E test related tasks
gulp.task('run:test:e2e', function ()
{
return func.test.e2e('./conf/protractor.conf.js');
});
// Server related tasks
gulp.task('run:server', function ()
{
return func.server(
config.paths.build.development,
9000
);
});
gulp.task('run:server:release', function ()
{
return func.server(
config.paths.build.release,
8000
);
});
// Watch related tasks
gulp.task('watch', ['run:server'], function ()
{
gulp.watch(config.paths.source.typescript.main, ['build:ts:main']);
gulp.watch(config.paths.source.typescript.test, ['build:ts:test']);
gulp.watch(config.paths.source.typescript.e2e, ['build:ts:e2e']);
gulp.watch(config.paths.source.scss, ['build:sass']);
gulp.watch(config.paths.source.html, ['build:html']);
gulp.watch(config.paths.source.json, ['build:json']);
return func.test.unit(
'./conf/karma.conf.js',
true
);
});