-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.mjs
43 lines (35 loc) · 1.04 KB
/
gulpfile.mjs
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
import gulp from "gulp";
import { rimraf as rm } from "rimraf";
import jeditor from "gulp-json-editor";
import { resolve } from "path";
import { execaCommandSync } from "execa";
import ts from "gulp-typescript";
const outputDir = "./dist";
const inputDir = "./src";
const { src, dest, series } = gulp;
const assets = ["**/*.js", "**/*.vue", "**/*.css", "**/*.scss", "**/*.svg"];
const version = execaCommandSync("git describe --tags", {
shell: true,
all: true,
}).stdout;
const tsc = () => {
const tsProject = ts.createProject("tsconfig.json");
return tsProject.src().pipe(tsProject()).pipe(dest(outputDir));
};
const cleanOut = () => rm(outputDir);
const cpAssets = () =>
Promise.all(
assets.map((e) => src(resolve(inputDir, e)).pipe(dest(outputDir)))
);
const cpPackageJson = () => {
return src("package.json")
.pipe(
jeditor({
version: version,
})
)
.pipe(src("readme.md"))
.pipe(src("LICENSE"))
.pipe(dest(outputDir));
};
export const build = series(cleanOut, tsc, cpAssets, cpPackageJson);