-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.mjs
34 lines (24 loc) · 857 Bytes
/
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
import { exec } from "child_process";
import gulp from "gulp";
import connect from "gulp-connect";
import del from "del";
const { series, parallel, src, dest } = gulp;
const folders = ["core", "wasm", "interface"];
const clean = () => del("./dist");
const wasm = () => exec("wasm-pack build --target web --out-dir '../dist' wasm");
const bundle = () => src("./interface/**/*").pipe(dest("./dist")).pipe(connect.reload());
const rebuild = series(wasm, bundle, () => del("./dist/package.json"));
export const build = series(clean, rebuild);
export const watch = () =>
gulp.watch(
folders.map((folder) => `${folder}/**/*`),
rebuild
);
export const serve = () => {
connect.server({
root: "./dist",
livereload: true,
});
};
export const dev = series(build, parallel(watch, serve));
export default build;