Skip to content

Commit b8f04fd

Browse files
committed
fix(package): ensure all submodule paths are included in the npm package
1 parent 6db3f03 commit b8f04fd

File tree

3 files changed

+18
-92
lines changed

3 files changed

+18
-92
lines changed

deno.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@std/encoding": "jsr:@std/encoding@1",
5656
"@std/http": "jsr:@std/http@^1.0.13",
5757
"@std/json": "jsr:@std/json@^1.0.0",
58+
"@std/jsonc": "jsr:@std/jsonc@^1.0.2",
5859
"@std/testing": "jsr:@std/testing@^1.0.9",
5960
"@takker/md5": "jsr:@takker/[email protected]",
6061
"@takker/onp": "./vendor/raw.githubusercontent.com/takker99/onp/0.0.1/mod.ts",

deno.lock

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/build_npm.ts

Lines changed: 8 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { build, emptyDir } from "@deno/dnt";
2+
import { parse } from "@std/jsonc";
23

34
await emptyDir("./npm");
45

@@ -18,101 +19,16 @@ await Deno.writeTextFile(
1819
),
1920
);
2021

22+
const config = parse(await Deno.readTextFile("./deno.jsonc")) as {
23+
exports: Record<string, string>;
24+
};
25+
2126
await build({
2227
entryPoints: [
2328
"./mod.ts",
24-
{
25-
name: "./browser",
26-
path: "./browser/mod.ts",
27-
},
28-
{
29-
name: "./browser/dom",
30-
path: "./browser/dom/mod.ts",
31-
},
32-
{
33-
name: "./browser/websocket",
34-
path: "./websocket/mod.ts",
35-
},
36-
{
37-
name: "./parseAbsoluteLink",
38-
path: "./parseAbsoluteLink.ts",
39-
},
40-
{
41-
name: "./rest",
42-
path: "./rest/mod.ts",
43-
},
44-
{
45-
name: "./text",
46-
path: "./text.ts",
47-
},
48-
{
49-
name: "./title",
50-
path: "./title.ts",
51-
},
52-
{
53-
name: "./websocket",
54-
path: "./websocket/mod.ts",
55-
},
56-
{
57-
name: "./unstable-api",
58-
path: "./api.ts",
59-
},
60-
{
61-
name: "./unstable-api/pages",
62-
path: "./api/pages.ts",
63-
},
64-
{
65-
name: "./unstable-api/pages/project",
66-
path: "./api/pages/project.ts",
67-
},
68-
{
69-
name: "./unstable-api/pages/project/replace",
70-
path: "./api/pages/project/replace.ts",
71-
},
72-
{
73-
name: "./unstable-api/pages/project/replace/links",
74-
path: "./api/pages/project/replace/links.ts",
75-
},
76-
{
77-
name: "./unstable-api/pages/project/search",
78-
path: "./api/pages/project/search.ts",
79-
},
80-
{
81-
name: "./unstable-api/pages/project/search/query",
82-
path: "./api/pages/project/search/query.ts",
83-
},
84-
{
85-
name: "./unstable-api/pages/project/search/titles",
86-
path: "./api/pages/project/search/titles.ts",
87-
},
88-
{
89-
name: "./unstable-api/pages/project/title",
90-
path: "./api/pages/project/title.ts",
91-
},
92-
{
93-
name: "./unstable-api/pages/projects",
94-
path: "./api/projects.ts",
95-
},
96-
{
97-
name: "./unstable-api/pages/projects/project",
98-
path: "./api/projects/project.ts",
99-
},
100-
{
101-
name: "./unstable-api/pages/project/title/text",
102-
path: "./api/pages/project/title/text.ts",
103-
},
104-
{
105-
name: "./unstable-api/pages/project/title/icon",
106-
path: "./api/pages/project/title/icon.ts",
107-
},
108-
{
109-
name: "./unstable-api/users",
110-
path: "./api/users.ts",
111-
},
112-
{
113-
name: "./unstable-api/users/me",
114-
path: "./api/users/me.ts",
115-
},
29+
...Object.entries(config.exports).flatMap(
30+
([name, path]) => name === "." ? [] : [{ name, path }],
31+
),
11632
],
11733
outDir: "./npm",
11834
shims: { deno: "dev" },

0 commit comments

Comments
 (0)