forked from denoland/eszip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_npm.ts
47 lines (43 loc) · 1.25 KB
/
build_npm.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
import { build, emptyDir } from "https://deno.land/x/[email protected]/mod.ts";
await emptyDir("./npm");
Deno.mkdirSync("npm/esm", { recursive: true });
Deno.mkdirSync("npm/script");
Deno.copyFileSync("js/eszip_wasm_bg.wasm", "npm/esm/eszip_wasm_bg.wasm");
// todo(dsherret): how to not include two copies of this in the npm
// package? Does using a symlink work?
Deno.copyFileSync("js/eszip_wasm_bg.wasm", "npm/script/eszip_wasm_bg.wasm");
await build({
entryPoints: ["./js/mod.ts"],
outDir: "./npm",
shims: {
deno: true,
undici: true,
},
package: {
name: "@deno/eszip",
version: Deno.args[0],
description:
"A utility that can download JavaScript and TypeScript module graphs and store them locally in a special zip file",
license: "MIT",
repository: {
type: "git",
url: "git+https://github.com/denoland/eszip.git",
},
bugs: {
url: "https://github.com/denoland/eszip/issues",
},
},
compilerOptions: {
lib: ["dom", "es2021"],
},
filterDiagnostic(diagnostic) {
if (
diagnostic.file?.fileName.endsWith("[email protected]/loader.ts")
) {
return false;
}
return true;
},
});
Deno.copyFileSync("LICENSE", "npm/LICENSE");
Deno.copyFileSync("README.md", "npm/README.md");