UNPKG

2.4 kBJavaScriptView Raw
1"use strict";
2
3const buildTools = require("demurgos-web-build-tools"); // Going meta
4// const buildTools = require("./build/lib/lib/index");
5const gulp = require("gulp");
6const typescript = require("typescript");
7
8// Project-wide options
9const projectOptions = Object.assign(
10 {},
11 buildTools.config.DEFAULT_PROJECT_OPTIONS,
12 {
13 root: __dirname,
14 tslint: {
15 files: ["src/**/*.ts", "!src/e2e/*/*/**/*.ts"],
16 configuration: {
17 rules: {
18 "whitespace": [
19 true,
20 "check-branch",
21 "check-decl",
22 "check-operator",
23 "check-separator",
24 "check-type",
25 "check-typecast",
26 "check-preblock"
27 ]
28 }
29 }
30 }
31 }
32);
33
34// `lib` target
35const libTarget = Object.assign(
36 {},
37 buildTools.config.LIB_TARGET,
38 {
39 typescript: {
40 compilerOptions: {
41 skipLibCheck: true,
42 target: "es2015"
43 },
44 typescript: typescript,
45 tsconfigJson: ["lib/tsconfig.json"]
46 }
47 }
48);
49
50// `lib-es5` target
51const es5Target = Object.assign(
52 {},
53 buildTools.config.LIB_TARGET,
54 {
55 name: "lib-es5",
56 typescript: {
57 compilerOptions: {
58 skipLibCheck: true,
59 target: "es5"
60 },
61 typescript: typescript,
62 tsconfigJson: ["lib/es5.tsconfig.json"]
63 }
64 }
65);
66
67// `lib-test` target
68const libTestTarget = Object.assign(
69 {},
70 buildTools.config.LIB_TEST_TARGET,
71 {
72 name: "lib-test",
73 scripts: ["test/**/*.ts", "lib/**/*.ts", "e2e/*/*.ts"],
74 typescript: {
75 compilerOptions: {
76 skipLibCheck: true,
77 target: "es2015"
78 },
79 typescript: typescript,
80 tsconfigJson: ["test/tsconfig.json"]
81 },
82 copy: [
83 {
84 name: "e2e",
85 src: "e2e",
86 // <project-name>/(project|test-resources)/<any>
87 files: ["*/project/**/*", "*/test-resources/**/*"],
88 dest: "e2e"
89 }
90 ]
91 }
92);
93
94buildTools.projectTasks.registerAll(gulp, projectOptions);
95buildTools.targetGenerators.node.generateTarget(gulp, projectOptions, libTarget);
96buildTools.targetGenerators.node.generateTarget(gulp, projectOptions, es5Target);
97buildTools.targetGenerators.test.generateTarget(gulp, projectOptions, libTestTarget);
98
99gulp.task("all:tsconfig.json", gulp.parallel("lib:tsconfig.json", "lib-test:tsconfig.json"));
100gulp.task("all:dist", gulp.parallel("lib:dist", "lib-es5:dist"));