forked from KnorpelSenf/oson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ts
50 lines (46 loc) · 1.14 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
import { build, emptyDir } from "https://deno.land/x/dnt@0.32.0/mod.ts";
const version = Deno.args[0];
if (!version) {
let previous: string | undefined = undefined;
try {
previous = JSON.parse(Deno.readTextFileSync("./npm/package.json")).version;
} catch {
// ignore
} finally {
previous ??= "unknown";
}
throw new Error(`Provide a version number! Last one is: ${previous}`);
}
await emptyDir("./npm");
await build({
entryPoints: ["./mod.ts"],
outDir: "./npm",
shims: {
deno: true,
custom: [{
globalNames: ["TextEncoder", "TextDecoder"],
module: "util",
}],
},
package: {
// package.json properties
name: "o-son",
version: Deno.args[0],
description: "oson structured object notation",
license: "MIT",
repository: {
type: "git",
url: "git+https://github.com/KnorpelSenf/oson.git",
},
bugs: {
url: "https://github.com/KnorpelSenf/oson/issues",
},
},
});
// post build steps
Deno.copyFileSync("LICENSE", "npm/LICENSE");
Deno.copyFileSync("README.md", "npm/README.md");
const process = Deno.run({
cmd: ["git", "tag", version],
});
await process.status();