@cosmicdrift/kumiko-cli 0.417.0 → 0.418.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +12 -12
- package/src/changes.json +6 -0
- package/src/handbuch/build.ts +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.418.0",
|
|
4
4
|
"description": "CLI for Kumiko apps. `bunx @cosmicdrift/kumiko-cli new app <name>` scaffolds a runnable workspace; `add feature <name>` mounts a feature; `check` runs boot validation plus the guard suites with the step list derived from kumiko.json; `agent lint`, `project` and `consumer` operate on an existing app; `handbuch build` renders the HTML handbuch.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@cosmicdrift/kumiko-dev-server": "0.
|
|
40
|
-
"@cosmicdrift/kumiko-feature-ast": "0.
|
|
41
|
-
"@cosmicdrift/kumiko-guards": "0.
|
|
42
|
-
"@cosmicdrift/kumiko-server-runtime": "0.
|
|
43
|
-
"@cosmicdrift/kumiko-testing": "0.
|
|
39
|
+
"@cosmicdrift/kumiko-dev-server": "0.418.0",
|
|
40
|
+
"@cosmicdrift/kumiko-feature-ast": "0.418.0",
|
|
41
|
+
"@cosmicdrift/kumiko-guards": "0.418.0",
|
|
42
|
+
"@cosmicdrift/kumiko-server-runtime": "0.418.0",
|
|
43
|
+
"@cosmicdrift/kumiko-testing": "0.418.0",
|
|
44
44
|
"marked": "^18.1.2",
|
|
45
45
|
"zod": "^4.6.7"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"sharp": "^0.35.5",
|
|
49
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
50
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
51
|
-
"@cosmicdrift/kumiko-renderer": "0.
|
|
49
|
+
"@cosmicdrift/kumiko-bundled-features": "0.418.0",
|
|
50
|
+
"@cosmicdrift/kumiko-framework": "0.418.0",
|
|
51
|
+
"@cosmicdrift/kumiko-renderer": "0.418.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
54
54
|
"sharp": {
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
69
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
70
|
-
"@cosmicdrift/kumiko-renderer": "0.
|
|
68
|
+
"@cosmicdrift/kumiko-bundled-features": "0.418.0",
|
|
69
|
+
"@cosmicdrift/kumiko-framework": "0.418.0",
|
|
70
|
+
"@cosmicdrift/kumiko-renderer": "0.418.0",
|
|
71
71
|
"sharp": "^0.35.5"
|
|
72
72
|
},
|
|
73
73
|
"publishConfig": {
|
package/src/changes.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.418.0",
|
|
4
|
+
"type": "fix",
|
|
5
|
+
"title": "Handbook chapter links resolve on static hosting",
|
|
6
|
+
"detail": "`kumiko handbuch build` now writes `<id>/index.html` for each chapter, a small page that redirects to `../#<id>` in the single handbook page, so the `<publicPath>/<id>` links from handbook-knowledge resolve without a rewrite rule."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.415.0",
|
|
4
10
|
"type": "breaking",
|
package/src/handbuch/build.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { mkdirSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, join, resolve } from "node:path";
|
|
3
|
+
import { escapeHtmlAttr } from "@cosmicdrift/kumiko-renderer/headless";
|
|
4
|
+
import { writeStaticHtmlPages } from "@cosmicdrift/kumiko-server-runtime";
|
|
3
5
|
import { collectBuildInfo, type WallClock } from "./buildinfo";
|
|
4
6
|
import type { HandbuchConfig } from "./config";
|
|
5
7
|
import { buildModel, type Model } from "./model";
|
|
@@ -45,6 +47,13 @@ async function convertImages(sharp: Sharp, outDir: string, images: ImagePlan): P
|
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
// Knowledge pages link to `<publicPath>/<chapterId>`; chapters are only anchors in the single page.
|
|
51
|
+
function chapterRedirectHtml(chapterId: string, title: string): string {
|
|
52
|
+
const target = `../#${escapeHtmlAttr(chapterId)}`;
|
|
53
|
+
const label = escapeHtmlAttr(title);
|
|
54
|
+
return `<!doctype html><html><head><meta charset="utf-8"><title>${label}</title><meta http-equiv="refresh" content="0; url=${target}"><link rel="canonical" href="${target}"></head><body><a href="${target}">${label}</a></body></html>`;
|
|
55
|
+
}
|
|
56
|
+
|
|
48
57
|
function directorySize(dir: string): number {
|
|
49
58
|
let total = 0;
|
|
50
59
|
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
@@ -92,6 +101,15 @@ export async function buildHandbuch(
|
|
|
92
101
|
mkdirSync(options.outDir, { recursive: true });
|
|
93
102
|
await convertImages(sharp, options.outDir, images);
|
|
94
103
|
writeFileSync(join(options.outDir, "index.html"), html);
|
|
104
|
+
await writeStaticHtmlPages(
|
|
105
|
+
options.outDir,
|
|
106
|
+
model.groups.flatMap((group) =>
|
|
107
|
+
group.chapters.map((chapter) => ({
|
|
108
|
+
path: chapter.id,
|
|
109
|
+
html: chapterRedirectHtml(chapter.id, chapter.screenTitle ?? chapter.id),
|
|
110
|
+
})),
|
|
111
|
+
),
|
|
112
|
+
);
|
|
95
113
|
|
|
96
114
|
return {
|
|
97
115
|
outDir: options.outDir,
|