-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
62 lines (55 loc) · 1.79 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
const gulp = require("gulp");
const ts = require("gulp-typescript");
const nodemon = require("gulp-nodemon");
const JSON_FILES = ["src/*.json", "src/**/*.json"];
const TEST_FILES = ["src/**/*.spec.ts", "src/**/*.test.ts"];
const CONFIG_FILES = ["src/config/**/*"];
const SCHEMA_FILES = ["src/schemas/**/*"];
const SOURCE_FILES = ["src/**/*.ts", "!" + TEST_FILES];
// pull in the project TypeScript config
const tsProject = ts.createProject("tsconfig.json");
gulp.task("compile", () => {
const tsResult = gulp.src(SOURCE_FILES).pipe(
tsProject("./tsconfig.json", {
logLevel: 1,
compilerOptions: {
listFiles: true,
},
}),
);
return tsResult.js.pipe(gulp.dest("dist"));
});
gulp.task("watch", done => {
return nodemon({
script: "dist",
watch: SOURCE_FILES,
ext: "ts",
tasks: changedFiles => {
console.log("files changed", changedFiles);
return ["compile"];
},
done,
}).on("restart", () => console.log("Restart!"));
});
gulp.task("doc", function() {
const typedoc = require("gulp-typedoc");
return gulp.src(SOURCE_FILES).pipe(
typedoc({
module: "commonjs",
target: "es6",
includeDeclarations: true,
exclude: "**/*+(index|.spec|.e2e).ts",
out: "./docs/",
name: "ugamela api",
theme: "default",
ignoreCompilerErrors: false,
version: true,
}),
);
});
gulp.task("copy:config", () => gulp.src(CONFIG_FILES).pipe(gulp.dest("dist/config")));
gulp.task("copy:schema", () => gulp.src(SCHEMA_FILES).pipe(gulp.dest("dist/schemas")));
gulp.task("copy:json", () => gulp.src(JSON_FILES).pipe(gulp.dest("dist")));
gulp.task("assets", gulp.series(["copy:config", "copy:schema", "copy:json"]));
gulp.task("build", gulp.series("assets", "compile"));
gulp.task("default", gulp.series("build", "watch"));