-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dnt.ts
83 lines (78 loc) · 1.92 KB
/
dnt.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import { build, emptyDir } from "@deno/dnt";
import metadata from "./deno.json" with { type: "json" };
await emptyDir("./npm");
const importMap = ".dnt-import-map.json";
await Deno.writeTextFile(
importMap,
JSON.stringify({
imports: {
...metadata.imports,
"@fedify/fedify": metadata.imports["@fedify/fedify"]
.replace(/^jsr:/, "npm:")
.replace(/\+.+$/, ""),
"@logtape/logtape": metadata.imports["@logtape/logtape"]
.replace(/^jsr:/, "npm:")
.replace(/\+.+$/, ""),
},
}),
);
await build({
package: {
// package.json properties
name: metadata.name,
version: Deno.args[0] ?? metadata.version,
description: "Redis drivers for Fedify",
keywords: ["fedify", "redis"],
license: "MIT",
author: {
name: "Hong Minhee",
email: "[email protected]",
url: "https://hongminhee.org/",
},
homepage: "https://github.com/dahlia/fedify-redis",
repository: {
type: "git",
url: "git+https://github.com/dahlia/fedify-redis.git",
},
bugs: {
url: "https://github.com/dahlia/fedify-redis/issues",
},
funding: [
"https://github.com/sponsors/dahlia",
],
},
outDir: "./npm",
entryPoints: [
"./mod.ts",
{ name: "./kv", path: "./src/kv.ts" },
{ name: "./mq", path: "./src/mq.ts" },
],
importMap,
shims: {
deno: true,
custom: [
{
package: {
name: "@js-temporal/polyfill",
version: "^0.4.4",
},
globalNames: [
{
name: "Temporal",
exportName: "Temporal",
},
],
},
],
},
typeCheck: "both",
declaration: "separate",
declarationMap: true,
test: Deno.env.get("DNT_TEST") !== "false",
async postBuild() {
await Deno.copyFile("LICENSE", "npm/LICENSE");
await Deno.copyFile("README.md", "npm/README.md");
},
});
await Deno.remove(importMap);
// cSpell: ignore Minhee