-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-deno.ts
46 lines (42 loc) · 1.17 KB
/
build-deno.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
import { build, emptyDir } from "https://deno.land/x/[email protected]/mod.ts";
import { moveSync } from "https://deno.land/[email protected]//fs/mod.ts";
await emptyDir("./jsr");
await emptyDir("./npm");
await build({
scriptModule: false,
importMap: "./deno.json",
typeCheck: "both",
entryPoints: ["./src/index.ts"],
declaration: 'separate',
compilerOptions: {
sourceMap: true,
lib: ["ESNext", "DOM"],
},
test: false,
outDir: "./npm",
packageManager: "pnpm",
shims: {
// see JS docs for overview and more options
deno: false
},
package: {
// package.json properties
name: "rdt-utils",
version: Deno.args[0],
description: "Library of typescript utilities",
license: "MIT",
type: "module"
},
postBuild() {
moveSync("./npm/esm", "./jsr", { overwrite: true });
Deno.writeTextFileSync("./jsr/package.json",
Deno
.readTextFileSync("./npm/package.json")
.replaceAll('./esm/', './')
);
Deno.removeSync("./npm", { recursive: true });
Deno.copyFileSync("./LICENSE", "./jsr/LICENSE");
Deno.copyFileSync("./README.md", "./jsr/README.md");
Deno.copyFileSync("./.npmignore", "./jsr/.npmignore");
}
});