-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
70 lines (56 loc) · 2.32 KB
/
gulpfile.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
const gulp = require('gulp');
const path = require('path');
const config = {
projectDir: __dirname,
srcDir: path.join(__dirname, 'src'),
buildDir: path.join(__dirname, 'dist'),
taskDir: path.join(__dirname, 'tasks'),
testDir: path.join(__dirname, '.test')
};
const reportsDir = '_reports';
config.reportsDirRel = path.join(path.basename(config.testDir), reportsDir);
config.reportsDirAbs = path.join(config.testDir, reportsDir);
const coverageDir = 'coverage';
config.coverageDirRel = path.join(config.reportsDirRel, coverageDir);
config.coverageDirAbs = path.join(config.reportsDirAbs, coverageDir);
// Cleanup.
gulp.task('clean:build', require('./tasks/clean')(gulp, config.buildDir));
gulp.task('clean', gulp.series('clean:build'));
// TypeScript compilation.
gulp.task('compile', gulp.series('clean', require('./tasks/compile')(gulp, config)));
// AngularJS postprocessing.
gulp.task('ng:directives', gulp.series('compile', require('./tasks/ngdirectives')(gulp, config)));
gulp.task('ng:annotate', gulp.series('ng:directives', require('./tasks/ngannotate')(gulp, config)));
// Meta task.
gulp.task('prepare', gulp.series('ng:annotate'));
gulp.task('prepare:production', gulp.series(
(callback) => {
// Enable production compilation.
process.env['RESOLWE_PRODUCTION'] = '1';
callback();
},
'prepare'
));
// TypeScript lint.
gulp.task('tslint', require('./tasks/tslint')(gulp, config));
// API typecheck.
gulp.task('api-typecheck', require('./tasks/api_typecheck')(gulp, config));
// All source code checks.
gulp.task('check', gulp.parallel('tslint', 'api-typecheck'));
// TypeScript documentation.
gulp.task('typedoc', require('./tasks/typedoc')(gulp, config));
// Unit tests.
gulp.task('test:bare', require('./tasks/test')(gulp, config));
gulp.task('test', gulp.series('prepare', 'test:bare'));
// Helper task when writing unit tests.
// Serves karma server so unit tests and app can be run at the same time.
// 'serve' task has to be running prior to running this task (handles compiling).
// Task has to be restarted when adding new *.ts files.
gulp.task('test-serve', require('./tasks/test_serve')(gulp, config));
gulp.task('sanity', gulp.parallel('check', 'test'));
// Build production version.
gulp.task('build', gulp.series('prepare:production'))
// Exports.
module.exports = {
config: config
};