-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
61 lines (53 loc) · 1.38 KB
/
gulpfile.js
File metadata and controls
61 lines (53 loc) · 1.38 KB
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
const del = require("del");
const { series, src, dest, parallel } = require("gulp");
const { exec } = require("child_process");
const path = require("path");
const { createProject } = require("gulp-typescript");
const merge = require("merge2");
const wasmProj = "./wasm/BrowserCSharp.csproj";
const wasmSrc = "./wasm/bin/Release/netstandard2.1/publish/wwwroot/_framework"
const wasmDest = "./out/_framework";
const tsConfig = "./tsconfig.json"
const tsDest = "./out/"
const tsTypings = "./typings";
const wasmClean = () => {
return del(wasmDest, { force: true });
};
exports["wasm-clean"] = wasmClean;
const wasmMove = () => {
return src("**/*", { cwd: wasmSrc })
.pipe(dest(wasmDest));
};
exports["wasm-move"] = wasmMove;
const wasmBuild = series(
wasmClean,
cb => {
exec(
`dotnet publish -c Release ${wasmProj}`,
(err, stdout, stderr) => {
console.log(stdout);
console.error(stderr);
cb(err);
}
);
},
wasmMove
);
exports["wasm-build"] = wasmBuild;
const tsClean = parallel(
() => del(path.join(tsDest, "*.js"), { force: true }),
() => del(tsTypings, { force: true })
);
exports["ts-clean"] = tsClean;
const tsBuild = series(
tsClean,
() => {
const tsProj = createProject(tsConfig);
const tsResult = tsProj.src().pipe(tsProj());
return merge(
tsResult.js.pipe(dest(tsDest)),
tsResult.dts.pipe(dest(tsTypings))
);
}
);
exports["ts-build"] = tsBuild;