-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
executable file
·103 lines (95 loc) · 2.43 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
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
"use strict";
const buildTools = require("demurgos-web-build-tools"); // Going meta
const gulp = require("gulp");
const typescript = require("typescript");
// Project-wide options
const projectOptions = Object.assign(
{},
buildTools.config.DEFAULT_PROJECT_OPTIONS,
{
root: __dirname
}
);
// `lib` target
const libTarget = Object.assign(
{},
buildTools.config.LIB_TARGET,
{
name: "lib-es2015",
typescript: {
compilerOptions: {
skipLibCheck: true,
target: "es2015",
lib: ["es2015", "dom"]
},
typescript: typescript,
tsconfigJson: ["lib/tsconfig.json"]
}
}
);
// `lib-es5` target
const es5Target = Object.assign(
{},
buildTools.config.LIB_TARGET,
{
name: "lib-es5",
typescript: {
compilerOptions: {
skipLibCheck: true,
target: "es5",
lib: ["es2015", "dom"]
},
typescript: typescript,
tsconfigJson: ["lib/es5.tsconfig.json"]
}
}
);
// `lib-test` target
const libTestTarget = Object.assign(
{},
buildTools.config.LIB_TEST_TARGET,
{
name: "lib-test",
scripts: ["test/**/*.ts", "lib/**/*.ts"],
typescript: {
compilerOptions: {
skipLibCheck: true,
target: "es2015"
},
typescript: typescript,
tsconfigJson: ["test/tsconfig.json"]
}
}
);
// `main` target
const mainTarget = Object.assign(
{},
buildTools.config.LIB_TARGET,
{
name: "main",
scripts: ["main/**/*.ts", "lib/**/*.ts", "!**/*.spec.ts"],
typescript: {
compilerOptions: {
skipLibCheck: true,
target: "es2015"
},
typescript: typescript,
tsconfigJson: ["main/tsconfig.json"]
},
copy: [
{
name: "html",
root: "../static",
files: ["**/*.html"]
}
]
}
);
buildTools.projectTasks.registerAll(gulp, projectOptions);
buildTools.targetGenerators.node.generateTarget(gulp, projectOptions, mainTarget);
buildTools.targetGenerators.node.generateTarget(gulp, projectOptions, libTarget);
buildTools.targetGenerators.node.generateTarget(gulp, projectOptions, es5Target);
buildTools.targetGenerators.test.generateTarget(gulp, projectOptions, libTestTarget);
gulp.task("all:tsconfig.json", gulp.parallel("lib-es2015:tsconfig.json", "lib-test:tsconfig.json", "main:tsconfig.json"));
gulp.task("all:build", gulp.parallel("lib-es2015:build", "lib-es5:build"));
gulp.task("all:dist", gulp.parallel("lib-es2015:dist", "lib-es5:dist"));