forked from Minds/front
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.ts
114 lines (101 loc) · 2.53 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
import * as gulp from 'gulp';
import { runSequence } from './tools/utils';
import { argv } from 'yargs';
// --------------
// Build
gulp.task('build', done => {
if (argv.aot && argv.all) {
// [Wrapper] Batch app, embed and locale production build --aot --all
return runSequence('build.aot.all', done);
} else if (argv.aot && argv.locales) {
// [Wrapper] Batch locale production build --aot --locales=XX,YY,ZZ
return runSequence('build.aot.locales', done);
} else if (argv.aot && argv.shims) {
// Production vendor bundles (--aot --shims)
return runSequence('build.bundles', done);
} else if (argv.aot && argv.index) {
// Production indexes only (--aot --index)
return runSequence('build.index', done);
} else if (argv.aot) {
// Production build (--aot)
let tasks = [
'clean.tmp',
'prepare.prod'
];
let buildIndex = !argv['ignore-index'];
if (argv.locale) {
// Locale production build --aot --locale=XX
tasks.push('build.aot.locale');
} else if (argv.embed) {
// Embed module production build --aot --embed
tasks.push('build.aot.embed');
buildIndex = false;
} else {
// App module production build --aot
tasks.push('build.aot');
}
if (buildIndex) {
tasks.push('build.index');
}
return runSequence(...tasks, 'clean.tmp', done);
} else if (argv.dev) {
// Development build (--dev)
let tasks = [
'build.plugins',
[
'build.assets',
'build.sass',
'build.js'
],
[
'build.bundles',
'build.bundles.app'
]
];
if (!argv['ignore-index']) {
tasks.push('build.index');
}
return runSequence(...tasks, 'clean.tmp', done);
} else {
done(Error('Unknown build mode: use --aot or --dev'));
}
});
// --------------
// Prepare (AoT - Production and extractions)
gulp.task('prepare.prod', done =>
runSequence(
'build.plugins',
[
'build.sass',
'build.assets'
],
done));
// --------------
// Test.
gulp.task('test', done =>
runSequence(
//'clean.test',
'tslint',
//'build.test',
//'karma.start',
done));
// --------------
// Extract to XLF
gulp.task('extract.i18n', done =>
runSequence(
'prepare.prod',
'extract.i18n.xlf',
'clean.tmp',
done));
// --------------
// Import XLF
gulp.task('import.i18n', done =>
runSequence(
'import.i18n.xlf',
done));
// --------------
// Lint Source XLF
gulp.task('lint.i18n', done =>
runSequence(
'lint.i18n.xlf',
done));