-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ts
61 lines (56 loc) · 1.31 KB
/
build.ts
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
import { build, emptyDir } from "@deno/dnt";
// @deno-types="https://deno.land/x/esbuild@v0.19.4/mod.d.ts"
import * as esbuild from "https://deno.land/x/esbuild@v0.23.0/mod.js";
console.debug("Start dnt ...");
const outDir = "./npm";
await emptyDir(outDir);
await build({
entryPoints: ["./mod.ts"],
outDir,
typeCheck: false,
test: false,
declaration: false,
esModule: false,
shims: {
deno: true,
},
package: {
// Dummy package.json
name: "The name of your action here",
version: "0.1.0",
description: "Provide a description here",
},
});
console.log("Start esbuild ...");
const distDir = "./dist";
await emptyDir(distDir);
console.log("Start esbuild to Node");
const nodedistDir = "./dist/node";
await esbuild.build({
entryPoints: ["./npm/src/mod.ts"],
outdir: nodedistDir,
// bundle: false,
bundle: true,
platform: "node",
target: "node20",
format: "cjs",
minify: true,
sourcemap: false,
}).finally(() => {
esbuild.stop();
});
console.log("Start esbuild to browser");
const browserdistDir = "./dist/browser";
await esbuild.build({
entryPoints: ["./npm/src/mod.ts"],
outdir: browserdistDir,
bundle: true,
platform: "browser",
target: "es2015",
format: "cjs",
minify: true,
sourcemap: false,
}).finally(() => {
esbuild.stop();
});
console.log("Complete!");