forked from unisat-wallet/ord-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
34 lines (31 loc) · 816 Bytes
/
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
const gulp = require("gulp");
const babel = require("gulp-babel");
const ts = require("gulp-typescript");
const tsProject = ts.createProject("tsconfig.json");
const SRC_PATH = "src";
const BUILD_MODE = {
ESM: {
PATH: "es",
},
CJS: {
PATH: "lib",
},
};
const CURRENT_MODE = BUILD_MODE[process.env.BABEL_ENV.toUpperCase()];
gulp.task("build-esm", () => {
return gulp
.src([`${SRC_PATH}/**/*.ts`])
.pipe(babel())
.pipe(gulp.dest(BUILD_MODE.ESM.PATH));
});
gulp.task("build-cjs", () => {
return gulp
.src([`${SRC_PATH}/**/*.ts`])
.pipe(tsProject())
.pipe(gulp.dest(BUILD_MODE.CJS.PATH));
});
if (CURRENT_MODE == BUILD_MODE.ESM) {
gulp.task("build", gulp.series("build-esm"));
} else if (CURRENT_MODE == BUILD_MODE.CJS) {
gulp.task("build", gulp.series("build-cjs"));
}