-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.ts
43 lines (37 loc) · 981 Bytes
/
version.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
export const VERSION = "0.9.10";
/** `prepublish` will be invoked before publish, return `false` to prevent the publish */
export async function prepublish(version: string): Promise<boolean> {
const codeTxt = await Deno.readTextFile("mod.ts");
new Deno
.Command("deno", {
args: [
"run",
"-A",
`${Deno.cwd()}/scripts/build_npm.ts`,
version,
],
stdout: "inherit",
stderr: "inherit",
stdin: "inherit",
}).outputSync();
new Deno
.Command("npm", {
args: [
"publish",
],
cwd: `${Deno.cwd()}/npm`,
stdout: "inherit",
stderr: "inherit",
stdin: "inherit",
}).outputSync();
await Deno.writeTextFile(
"source-code.md",
`${"```ts\n// version:"}${version}\n${codeTxt}${"```\n"}`,
);
return true;
}
/** `postpublish` will be invoked after published */
// deno-lint-ignore require-await
export async function postpublish(version: string) {
console.log("on postpublish", version);
}