create-zudo-doc 3.2.0 → 4.0.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/README.md +3 -2
- package/dist/api.d.ts +2 -0
- package/dist/api.js +9 -1
- package/dist/claude-md-gen.d.ts +8 -0
- package/dist/claude-md-gen.js +44 -26
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +11 -1
- package/dist/compose.d.ts +14 -20
- package/dist/compose.js +15 -25
- package/dist/constants.d.ts +6 -0
- package/dist/constants.js +123 -1
- package/dist/features/body-foot-util.d.ts +8 -4
- package/dist/features/body-foot-util.js +8 -4
- package/dist/features/claude-resources.d.ts +9 -0
- package/dist/features/claude-resources.js +10 -6
- package/dist/features/design-token-panel.d.ts +0 -12
- package/dist/features/design-token-panel.js +32 -93
- package/dist/features/doc-history.d.ts +19 -3
- package/dist/features/doc-history.js +49 -60
- package/dist/features/doc-tags.d.ts +9 -13
- package/dist/features/doc-tags.js +10 -26
- package/dist/features/dynamic-page-transition.d.ts +19 -30
- package/dist/features/dynamic-page-transition.js +21 -209
- package/dist/features/footer-taglist.d.ts +1 -1
- package/dist/features/footer-taglist.js +1 -1
- package/dist/features/footer.d.ts +3 -2
- package/dist/features/footer.js +3 -2
- package/dist/features/i18n.d.ts +13 -8
- package/dist/features/i18n.js +14 -9
- package/dist/features/image-enlarge.d.ts +7 -26
- package/dist/features/image-enlarge.js +7 -26
- package/dist/features/index.js +2 -0
- package/dist/features/llms-txt.d.ts +3 -5
- package/dist/features/llms-txt.js +3 -5
- package/dist/features/search.d.ts +7 -3
- package/dist/features/search.js +7 -3
- package/dist/features/sidebar-resizer.d.ts +4 -8
- package/dist/features/sidebar-resizer.js +4 -8
- package/dist/features/sidebar-toggle.d.ts +7 -7
- package/dist/features/sidebar-toggle.js +7 -7
- package/dist/features/tag-governance.d.ts +3 -8
- package/dist/features/tag-governance.js +37 -9
- package/dist/features/tauri.d.ts +13 -10
- package/dist/features/tauri.js +16 -52
- package/dist/features/theme-pack-switcher.d.ts +11 -0
- package/dist/features/theme-pack-switcher.js +13 -0
- package/dist/features/versioning.d.ts +12 -24
- package/dist/features/versioning.js +13 -39
- package/dist/index.js +5 -3
- package/dist/preset.d.ts +2 -0
- package/dist/preset.js +12 -1
- package/dist/prompts.d.ts +2 -0
- package/dist/prompts.js +22 -1
- package/dist/scaffold.d.ts +13 -6
- package/dist/scaffold.js +97 -78
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +14 -0
- package/dist/zfb-config-gen.d.ts +32 -20
- package/dist/zfb-config-gen.js +410 -53
- package/package.json +2 -2
- package/templates/base/pages/docs/[[...slug]].tsx +64 -0
- package/templates/base/pages/index.tsx +6 -41
- package/templates/base/src/styles/global.css +15 -340
- package/templates/base/tsconfig.json +3 -26
- package/templates/features/i18n/files/pages/[locale]/docs/[[...slug]].tsx +92 -0
- package/dist/settings-gen.d.ts +0 -2
- package/dist/settings-gen.js +0 -320
- package/templates/base/.htmlvalidate.json +0 -5
- package/templates/base/.zfb/doc-history-meta.json +0 -1
- package/templates/base/pages/_data.ts +0 -160
- package/templates/base/pages/lib/_body-end-islands.tsx +0 -165
- package/templates/base/pages/lib/_chrome.ts +0 -167
- package/templates/base/pages/lib/_details.tsx +0 -29
- package/templates/base/pages/lib/_doc-route-entries.ts +0 -10
- package/templates/base/pages/lib/_extract-headings.ts +0 -37
- package/templates/base/pages/lib/_frontmatter-preview-data.ts +0 -27
- package/templates/base/pages/lib/_nav-source-cache.ts +0 -100
- package/templates/base/pages/lib/_nav-source-docs.ts +0 -17
- package/templates/base/pages/lib/_preset-generator.tsx +0 -81
- package/templates/base/pages/lib/_route-context.ts +0 -32
- package/templates/base/pages/lib/_search-widget.tsx +0 -17
- package/templates/base/pages/lib/doc-page-props.ts +0 -30
- package/templates/base/pages/lib/locale-merge.ts +0 -59
- package/templates/base/scripts/run-b4push.sh +0 -102
- package/templates/base/src/components/ai-chat-modal.tsx +0 -18
- package/templates/base/src/components/content/code-group.tsx +0 -3
- package/templates/base/src/components/content/content-admonition.tsx +0 -4
- package/templates/base/src/components/desktop-sidebar-toggle.tsx +0 -15
- package/templates/base/src/components/doc-history.tsx +0 -21
- package/templates/base/src/components/image-enlarge.tsx +0 -24
- package/templates/base/src/components/preset-generator.tsx +0 -14
- package/templates/base/src/components/sidebar-toggle.tsx +0 -6
- package/templates/base/src/components/sidebar-tree.tsx +0 -6
- package/templates/base/src/config/color-scheme-utils.ts +0 -69
- package/templates/base/src/config/color-schemes.ts +0 -165
- package/templates/base/src/config/docs-schema.ts +0 -95
- package/templates/base/src/config/frontmatter-preview-defaults.ts +0 -27
- package/templates/base/src/config/frontmatter-preview-renderers.tsx +0 -46
- package/templates/base/src/config/i18n.ts +0 -239
- package/templates/base/src/config/settings-types.ts +0 -45
- package/templates/base/src/config/sidebars.ts +0 -66
- package/templates/base/src/config/tag-vocabulary-types.ts +0 -4
- package/templates/base/src/config/tag-vocabulary.ts +0 -20
- package/templates/base/src/config/z-index-tokens.ts +0 -128
- package/templates/base/src/types/docs-entry.ts +0 -28
- package/templates/base/src/types/heading.ts +0 -5
- package/templates/base/src/types/locale.ts +0 -10
- package/templates/base/src/utils/base.ts +0 -164
- package/templates/base/src/utils/docs.ts +0 -446
- package/templates/base/src/utils/git-info.ts +0 -70
- package/templates/base/src/utils/github.ts +0 -22
- package/templates/base/src/utils/nav-scope.ts +0 -34
- package/templates/base/src/utils/sidebar.ts +0 -36
- package/templates/base/src/utils/slug.ts +0 -10
- package/templates/base/src/utils/smart-break.tsx +0 -12
- package/templates/base/src/utils/tags.ts +0 -83
- package/templates/base/zfb-shim.d.ts +0 -183
- package/templates/features/bodyFootUtil/files/src/utils/github.ts +0 -22
- package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/escape-for-mdx.test.ts +0 -42
- package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/generate.test.ts +0 -752
- package/templates/features/claudeResources/files/src/integrations/claude-resources/escape-for-mdx.ts +0 -97
- package/templates/features/claudeResources/files/src/integrations/claude-resources/generate.ts +0 -735
- package/templates/features/designTokenPanel/files/src/components/design-token-panel-bootstrap.tsx +0 -15
- package/templates/features/designTokenPanel/files/src/config/design-token-panel-config.ts +0 -435
- package/templates/features/designTokenPanel/files/src/config/design-tokens-manifest.ts +0 -174
- package/templates/features/designTokenPanel/files/src/lib/design-token-panel-bootstrap.ts +0 -30
- package/templates/features/docHistory/files/src/components/doc-history.tsx +0 -10
- package/templates/features/docHistory/files/src/types/doc-history.ts +0 -7
- package/templates/features/dynamicPageTransition/files/src/components/client-router-bootstrap.tsx +0 -72
- package/templates/features/i18n/files/pages/[locale]/index.tsx +0 -72
- package/templates/features/imageEnlarge/files/src/components/image-enlarge.tsx +0 -11
- package/templates/features/sidebarToggle/files/src/components/desktop-sidebar-toggle.tsx +0 -6
- package/templates/features/tagGovernance/files/scripts/tags-audit.ts +0 -131
- package/templates/features/tagGovernance/files/scripts/tags-suggest.ts +0 -428
- package/templates/features/tauri/files/src/components/find-bar.tsx +0 -122
- package/templates/features/tauri/files/src/components/find-in-page-init.tsx +0 -59
- package/templates/features/tauri/files/src/utils/find-in-page.ts +0 -175
package/dist/scaffold.js
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
import fs from "fs-extra";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
|
-
import { generateSettingsFile } from "./settings-gen.js";
|
|
5
4
|
import { generateZfbConfig } from "./zfb-config-gen.js";
|
|
6
5
|
import { generateCLAUDEFile } from "./claude-md-gen.js";
|
|
7
6
|
import { composeFeatures } from "./compose.js";
|
|
8
7
|
import { featureModules } from "./features/index.js";
|
|
9
|
-
import { capitalize, getSecondaryLang } from "./utils.js";
|
|
8
|
+
import { capitalize, getSecondaryLang, pmRunCommand } from "./utils.js";
|
|
10
9
|
export { getSecondaryLang };
|
|
11
10
|
/**
|
|
12
|
-
* Pinned `@takazudo/zudo-doc` version used
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* Pinned `@takazudo/zudo-doc` version used by `generatePackageJson()`.
|
|
12
|
+
* Hoisted as a shared constant (kept even though it now has a single
|
|
13
|
+
* call site) because `scripts/check-pin-parity.mjs` resolves this exact
|
|
14
|
+
* declaration below via its constant-reference regex form (see that
|
|
15
|
+
* script's `readScaffoldPin()`) — keep the declaration line's shape
|
|
16
|
+
* parseable (const name, `=`, a quoted literal) and do NOT repeat that
|
|
17
|
+
* exact pattern anywhere earlier in this file (a comment containing the
|
|
18
|
+
* literal text would false-match the same regex, since it isn't anchored
|
|
19
|
+
* to a real `export const` statement).
|
|
15
20
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
21
|
+
* `.zudo-doc.json` is NO LONGER seeded here (locked decision #2653 #6 —
|
|
22
|
+
* lazy-create on first `zudo-doc eject`; `packages/zudo-doc/src/eject/index.ts`
|
|
23
|
+
* already tolerates its absence and writes the file on first successful eject).
|
|
18
24
|
*
|
|
19
25
|
* Bumped in lockstep by scripts/release-create-zudo-doc.sh.
|
|
20
26
|
*/
|
|
21
|
-
export const ZUDO_DOC_PIN = "^
|
|
27
|
+
export const ZUDO_DOC_PIN = "^4.0.0";
|
|
22
28
|
/**
|
|
23
29
|
* Files in `templates/base/**` that must not be copied by the unconditional
|
|
24
30
|
* base mirror. Each entry is matched against the path relative to
|
|
@@ -107,7 +113,7 @@ sidebar_position: 2
|
|
|
107
113
|
|
|
108
114
|
## Requirements
|
|
109
115
|
|
|
110
|
-
- Node.js
|
|
116
|
+
- Node.js 22 or later
|
|
111
117
|
- pnpm (recommended), npm, yarn, or bun
|
|
112
118
|
|
|
113
119
|
## Create a New Project
|
|
@@ -135,7 +141,7 @@ sidebar_position: 2
|
|
|
135
141
|
|
|
136
142
|
## 動作要件
|
|
137
143
|
|
|
138
|
-
- Node.js
|
|
144
|
+
- Node.js 22 以降
|
|
139
145
|
- pnpm(推奨)、npm、yarn、または bun
|
|
140
146
|
|
|
141
147
|
## 新しいプロジェクトを作成する
|
|
@@ -283,21 +289,17 @@ export async function scaffold(choices) {
|
|
|
283
289
|
await fs.outputFile(path.join(targetDir, `src/content/docs-${secondaryLang}/changelog/index.mdx`), secondaryChangelogContent);
|
|
284
290
|
}
|
|
285
291
|
}
|
|
286
|
-
// 3. Generate
|
|
287
|
-
|
|
288
|
-
|
|
292
|
+
// 3. Generate the one config file. There is no more src/config/settings.ts —
|
|
293
|
+
// every user choice rides straight into zudoDoc({...}) in zfb.config.ts
|
|
294
|
+
// (locked decision #2653 #2 — diff-from-defaults single config).
|
|
289
295
|
const zfbConfigContent = generateZfbConfig(choices);
|
|
290
296
|
await fs.outputFile(path.join(targetDir, "zfb.config.ts"), zfbConfigContent);
|
|
291
297
|
const pkg = generatePackageJson(choices);
|
|
292
298
|
await fs.outputFile(path.join(targetDir, "package.json"), JSON.stringify(pkg, null, 2) + "\n");
|
|
293
|
-
//
|
|
294
|
-
//
|
|
295
|
-
//
|
|
296
|
-
//
|
|
297
|
-
await fs.outputFile(path.join(targetDir, ".zudo-doc.json"), JSON.stringify({
|
|
298
|
-
packageVersion: ZUDO_DOC_PIN.replace(/^\^/, ""),
|
|
299
|
-
ejected: {},
|
|
300
|
-
}, null, 2) + "\n");
|
|
299
|
+
// .zudo-doc.json is intentionally NOT seeded (locked decision #2653 #6 —
|
|
300
|
+
// lazy-create on first `zudo-doc eject`). `packages/zudo-doc/src/eject/index.ts`
|
|
301
|
+
// already tolerates its absence (defaults to `{ packageVersion: "unknown",
|
|
302
|
+
// ejected: {} }`) and writes the file itself on first successful eject.
|
|
301
303
|
const gitignoreLines = [
|
|
302
304
|
"# Build output",
|
|
303
305
|
"node_modules",
|
|
@@ -363,8 +365,10 @@ export async function scaffold(choices) {
|
|
|
363
365
|
}
|
|
364
366
|
function generatePackageJson(choices) {
|
|
365
367
|
// Intentionally absent from scaffolded deps:
|
|
366
|
-
// @takazudo/zudo-doc-md-plugins —
|
|
367
|
-
//
|
|
368
|
+
// @takazudo/zudo-doc-md-plugins — the legacy JS remark/rehype pipeline it
|
|
369
|
+
// would have named was retired outright (packages/md-plugins/ deleted,
|
|
370
|
+
// #2683); its parity coverage lives in e2e/smoke-markdown-features.spec.ts.
|
|
371
|
+
// Zero references in generator templates/source.
|
|
368
372
|
const deps = {
|
|
369
373
|
// zfb engine — distributed as published npm packages (the prebuilt binary
|
|
370
374
|
// ships via an optionalDependency of @takazudo/zfb-<platform>); pinned to
|
|
@@ -411,9 +415,9 @@ function generatePackageJson(choices) {
|
|
|
411
415
|
// disabled, reproducible CSS-Modules scoped names (project-relative paths),
|
|
412
416
|
// dev-mode git-restore detection, Tailwind temp-file cleanup, and a
|
|
413
417
|
// near-miss `"use client"` directive scanner.
|
|
414
|
-
// next.33 added
|
|
418
|
+
// next.33 added hierarchical heading IDs
|
|
415
419
|
// (Takazudo/zudo-front-builder#871): `markdown.features.headingIds.strategy`.
|
|
416
|
-
//
|
|
420
|
+
// zudo-doc now uses that strategy unconditionally in its package preset.
|
|
417
421
|
// next.35 fixes resolve_links rewriting bare same-page `[text](#anchor)` /
|
|
418
422
|
// `[text](?query)` links to `/<parent-dir>/#anchor` (zudolab/zudo-doc#1948,
|
|
419
423
|
// upstream Takazudo/zudo-front-builder#875).
|
|
@@ -443,23 +447,24 @@ function generatePackageJson(choices) {
|
|
|
443
447
|
// extraWatchPaths rebuilds, and TS-config-loader path canonicalization
|
|
444
448
|
// (Takazudo/zudo-front-builder#1036–#1043). next.45: docs-only. next.46:
|
|
445
449
|
// opt-in dev boot-lazy mode (#1057) + client-router timer lifecycle fixes —
|
|
446
|
-
// dev-server-only.
|
|
450
|
+
// dev-server-only. Historical dual light/dark theme support (themeLight/
|
|
447
451
|
// themeDark on CodeHighlightConfig, --shiki-light/--shiki-dark, #1067) plus
|
|
448
452
|
// stricter build-start validation that rejects unknown theme names. next.48:
|
|
449
453
|
// re-export @takazudo/zfb/config from the zfb-shim.d.ts type shim — type-only
|
|
450
454
|
// fix, additive. next.49: client-router WebKit bfcache fix —
|
|
451
455
|
// re-sync the history index + originalLocation on a bfcache restore so
|
|
452
456
|
// browser Back after an SPA navigation returns to the previous page instead
|
|
453
|
-
// of skipping an entry — runtime-only bug fix, additive. next.50
|
|
454
|
-
//
|
|
457
|
+
// of skipping an entry — runtime-only bug fix, additive. next.50:
|
|
458
|
+
// client-router fix to commit the SPA history entry BEFORE the View
|
|
455
459
|
// Transition, so on WebKit/iOS a single browser Back after an SPA navigation
|
|
456
460
|
// creates a distinct history entry instead of falling off the site —
|
|
457
|
-
// runtime-only bug fix, additive. next.51
|
|
461
|
+
// runtime-only bug fix, additive. next.51: additive public-API
|
|
458
462
|
// surface — VNode/VNodeArray/VNodeObject are now exported from
|
|
459
463
|
// "@takazudo/zfb" (#972) — plus removal of the no-op linkValidation.allowExternal
|
|
460
|
-
// knob (#925); both are non-breaking for a fresh scaffold.
|
|
461
|
-
//
|
|
462
|
-
//
|
|
464
|
+
// knob (#925); both are non-breaking for a fresh scaffold. Highlight config
|
|
465
|
+
// is package-preset-owned: fresh scaffolds delegate to zudoDoc(), whose
|
|
466
|
+
// preset selects class mode without emitting theme names project-side.
|
|
467
|
+
// next.52 adds the
|
|
463
468
|
// `ClientRouter({ preserveHtmlAttrs })` option (zfb#1104) — consumers can
|
|
464
469
|
// declare runtime `<html>` attribute names to preserve across SPA swaps so
|
|
465
470
|
// e.g. `data-sidebar-hidden` / `data-theme` survive (zudolab/zudo-doc#2200).
|
|
@@ -497,14 +502,22 @@ function generatePackageJson(choices) {
|
|
|
497
502
|
// next.76: routine toolchain bump from next.75, adopted in
|
|
498
503
|
// lockstep with the root package.json pins. No consumer-facing / CLI change.
|
|
499
504
|
// next.77: router persistence/history fixes and runtime island remount
|
|
500
|
-
// support
|
|
501
|
-
//
|
|
502
|
-
//
|
|
503
|
-
|
|
504
|
-
|
|
505
|
+
// support. next.78 added production HTML minification. next.81 added the
|
|
506
|
+
// package-root semantic highlight API plus island resource delivery
|
|
507
|
+
// (zfb#1633/#1643). next.83 completes bundle.exclude dependency staging
|
|
508
|
+
// for package-owned overlay routes (zfb#1645/#1649); next.84 canonicalizes
|
|
509
|
+
// linked package-route identity so SSR shares one framework singleton
|
|
510
|
+
// (zfb#1650/#1651). next.85 also remaps absolute project imports from
|
|
511
|
+
// virtual host modules into the staged project graph, preserving that
|
|
512
|
+
// singleton across host-callable wiring (zfb#1652/#1653). The zfb family
|
|
513
|
+
// must stay in lockstep because the WASM browser entry depends on its
|
|
514
|
+
// resource-aware island pipeline.
|
|
515
|
+
"@takazudo/zfb": "0.1.0-next.87",
|
|
516
|
+
"@takazudo/zfb-runtime": "0.1.0-next.87",
|
|
505
517
|
// zfb-adapter-cloudflare — required for any route with `prerender = false`.
|
|
506
518
|
// Pinned in lockstep with @takazudo/zfb.
|
|
507
|
-
"@takazudo/zfb-adapter-cloudflare": "0.1.0-next.
|
|
519
|
+
"@takazudo/zfb-adapter-cloudflare": "0.1.0-next.87",
|
|
520
|
+
"@takazudo/zfb-md-wasm": "0.1.0-next.87",
|
|
508
521
|
// @takazudo/zudo-doc — published from this monorepo via
|
|
509
522
|
// .github/workflows/publish-zudo-doc.yml. The pin here is bumped in
|
|
510
523
|
// lockstep by scripts/release-create-zudo-doc.sh whenever zudo-doc's
|
|
@@ -539,6 +552,7 @@ function generatePackageJson(choices) {
|
|
|
539
552
|
// compiles. Same pin as host. Caught by W6B (#1735) consumer-build
|
|
540
553
|
// verification.
|
|
541
554
|
"preact-render-to-string": "^6.6.6",
|
|
555
|
+
// Retained until #2742 atomically moves HTML Preview to zfb-md-wasm.
|
|
542
556
|
shiki: "^4.0.2",
|
|
543
557
|
"@shikijs/transformers": "^4.0.0",
|
|
544
558
|
"gray-matter": "^4.0.0",
|
|
@@ -564,6 +578,26 @@ function generatePackageJson(choices) {
|
|
|
564
578
|
// missing copy produces no `pnpm install` warning — which is why this gap
|
|
565
579
|
// shipped silently and only surfaced at build time.
|
|
566
580
|
diff: "^8.0.3",
|
|
581
|
+
// @takazudo/zdtp — SAME "unconditional at build time despite being an
|
|
582
|
+
// optional peer" class as `diff` above, discovered empirically while
|
|
583
|
+
// verifying this generator's own barebone (designTokenPanel: OFF) output
|
|
584
|
+
// (epic zudolab/zudo-doc#2651, #2660 self-review — a genuine package-level
|
|
585
|
+
// coupling, not a generator bug; flagged loudly on #2660's completion
|
|
586
|
+
// comment for a package-side follow-up). Since the #2658 gate-2 fix,
|
|
587
|
+
// `chrome/derive.tsx`'s `deriveBodyEndIslands` statically imports the REAL
|
|
588
|
+
// `DesignTokenPanelBootstrap` as the default for EVERY `createChrome`
|
|
589
|
+
// consumer (so the island auto-mounts with zero host wiring when the
|
|
590
|
+
// setting is on) — and that component imports `@takazudo/zdtp` at module
|
|
591
|
+
// scope. So every page that goes through `createChrome` — which is every
|
|
592
|
+
// page in this project — pulls the zdtp import into the esbuild bundle
|
|
593
|
+
// graph, `designTokenPanel` setting or not; only RENDERING is gated on
|
|
594
|
+
// the setting, not the import. Without this dep, `zfb build` fails with
|
|
595
|
+
// "Could not resolve '@takazudo/zdtp'" even on a fully barebone project.
|
|
596
|
+
// `preact ^10.29.1` (see the floor comment above) is required for the
|
|
597
|
+
// same reason. This is the ACCEPTED, permanent contract per #2668 — see
|
|
598
|
+
// the "@takazudo/zdtp dep implication" note in
|
|
599
|
+
// packages/zudo-doc/docs/adr/route-injection-seam.md.
|
|
600
|
+
"@takazudo/zdtp": "0.4.9",
|
|
567
601
|
};
|
|
568
602
|
const devDeps = {
|
|
569
603
|
"@tailwindcss/vite": "^4.2.0",
|
|
@@ -571,7 +605,8 @@ function generatePackageJson(choices) {
|
|
|
571
605
|
typescript: "^5.9.0",
|
|
572
606
|
"@types/node": "^22.0.0",
|
|
573
607
|
"@types/react": "^19.2.0", // needed for preact/compat type resolution
|
|
574
|
-
|
|
608
|
+
// html-validate dropped — check:html is no longer a default script
|
|
609
|
+
// (see the scripts block below; `.htmlvalidate.json` no longer ships).
|
|
575
610
|
};
|
|
576
611
|
if (choices.features.includes("search")) {
|
|
577
612
|
deps["minisearch"] = "^7.2.0";
|
|
@@ -583,11 +618,11 @@ function generatePackageJson(choices) {
|
|
|
583
618
|
// required regardless of this feature flag.)
|
|
584
619
|
// @takazudo/zudo-doc has @takazudo/zudo-doc-history-server as an optional
|
|
585
620
|
// peer dep. When docHistory is selected the zfb plugin
|
|
586
|
-
// (@takazudo/zudo-doc/plugins/doc-history) eagerly imports
|
|
587
|
-
//
|
|
621
|
+
// (@takazudo/zudo-doc/plugins/doc-history) eagerly imports its internal
|
|
622
|
+
// doc-history helpers, which in turn import
|
|
588
623
|
// @takazudo/zudo-doc-history-server/git-history. Without this dep the
|
|
589
624
|
// plugin host fails at init with ERR_MODULE_NOT_FOUND — W8A (#1739).
|
|
590
|
-
deps["@takazudo/zudo-doc-history-server"] = "^
|
|
625
|
+
deps["@takazudo/zudo-doc-history-server"] = "^4.0.0";
|
|
591
626
|
// tsx is no longer needed here: the relocated package plugin imports the
|
|
592
627
|
// runner directly (no `tsx -e` spawn) since the package ships compiled
|
|
593
628
|
// dist/ — package-first migration #2321 (#2337).
|
|
@@ -595,46 +630,27 @@ function generatePackageJson(choices) {
|
|
|
595
630
|
// claudeResources: tsx is no longer needed. The relocated package plugin
|
|
596
631
|
// (@takazudo/zudo-doc/plugins/claude-resources) imports the runner directly
|
|
597
632
|
// since the package ships compiled dist/ — package-first migration #2321 (#2337).
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
devDeps["string-similarity"] = "^4.0.4";
|
|
607
|
-
devDeps["@types/string-similarity"] = "^4.0.2";
|
|
608
|
-
devDeps["pluralize"] = "^8.0.0";
|
|
609
|
-
devDeps["@types/pluralize"] = "^0.0.33";
|
|
610
|
-
devDeps["picocolors"] = "^1.1.1";
|
|
611
|
-
devDeps["@inquirer/prompts"] = "^8.4.2";
|
|
612
|
-
devDeps["tsx"] = "^4.21.0";
|
|
613
|
-
}
|
|
633
|
+
// check:html and gen:z-index/check:z-index are DROPPED from the default
|
|
634
|
+
// scaffold (locked decision, epic #2651 #2660 work item 6):
|
|
635
|
+
// - `.htmlvalidate.json` no longer ships — html-validate becomes an
|
|
636
|
+
// opt-in extend step (documented in #2664).
|
|
637
|
+
// - z-index tokens ship unconditionally from `@takazudo/zudo-doc/theme.css`
|
|
638
|
+
// (13 default tiers, epic #2655) — a project only needs its own
|
|
639
|
+
// `src/config/z-index-tokens.ts` + codegen scripts when it overrides a
|
|
640
|
+
// tier, which is an eject-time decision, not a scaffold-time one.
|
|
614
641
|
const scripts = {
|
|
615
642
|
dev: "zfb dev",
|
|
616
643
|
build: "zfb build",
|
|
617
644
|
preview: "zfb preview",
|
|
618
645
|
check: "zfb check",
|
|
619
|
-
// NOTE: no `check:pages` here — the host repo's pages/ typecheck
|
|
620
|
-
// (tsconfig.pages.json, #2018) is host-only for now. The base template's
|
|
621
|
-
// no-op feature stubs (e.g. doc-history.tsx) are not type-clean against
|
|
622
|
-
// the pages/lib call sites, so emitting the script would fail on a fresh
|
|
623
|
-
// scaffold. Revisit once the template stubs carry typed props.
|
|
624
|
-
"check:html": "html-validate \"dist/**/*.html\"",
|
|
625
|
-
// Z-index token codegen (#2148): regenerate the GENERATED:Z_INDEX @theme
|
|
626
|
-
// block in src/styles/global.css from src/config/z-index-tokens.ts, and a
|
|
627
|
-
// drift check for pre-push/CI. Both ship in base — the z-index token system
|
|
628
|
-
// is part of every scaffold. Bin provided by @takazudo/zudo-doc (S9b #2334).
|
|
629
|
-
"gen:z-index": "gen-z-index",
|
|
630
|
-
"check:z-index": "gen-z-index --check",
|
|
631
646
|
};
|
|
632
647
|
if (choices.features.includes("tagGovernance")) {
|
|
633
|
-
//
|
|
634
|
-
//
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
scripts["tags:suggest"] =
|
|
648
|
+
// Both package-owned bins load the same explicit project config. `--`
|
|
649
|
+
// supplied by pnpm/npm is preserved by the runners for forwarded options.
|
|
650
|
+
scripts["tags:audit"] =
|
|
651
|
+
"tags-audit --config src/config/tag-vocabulary.ts";
|
|
652
|
+
scripts["tags:suggest"] =
|
|
653
|
+
"tags-suggest --config src/config/tag-vocabulary.ts";
|
|
638
654
|
}
|
|
639
655
|
if (choices.features.includes("skillSymlinker")) {
|
|
640
656
|
scripts["setup:doc-skill"] = "bash scripts/setup-doc-skill.sh";
|
|
@@ -647,17 +663,17 @@ function generatePackageJson(choices) {
|
|
|
647
663
|
scripts["setup:doc-skill:both"] =
|
|
648
664
|
"bash scripts/setup-doc-skill.sh --target both";
|
|
649
665
|
}
|
|
650
|
-
const
|
|
666
|
+
const pm = choices.packageManager;
|
|
651
667
|
// claudeSkills ships the zudo-doc-version-bump skill, whose release workflow
|
|
652
668
|
// calls `<pm> b4push`. Emit a minimal stub so the skill does not hit a
|
|
653
669
|
// "script not found" error on freshly scaffolded projects. Consumers are
|
|
654
670
|
// free to expand this into a richer pre-push pipeline later.
|
|
655
671
|
if (choices.features.includes("claudeSkills")) {
|
|
656
|
-
scripts["b4push"] = `${
|
|
672
|
+
scripts["b4push"] = `${pmRunCommand(pm, "check")} && ${pmRunCommand(pm, "build")}`;
|
|
657
673
|
}
|
|
658
674
|
if (choices.features.includes("tauri")) {
|
|
659
675
|
scripts["dev:tauri"] = "cargo tauri dev";
|
|
660
|
-
scripts["build:tauri"] = `${
|
|
676
|
+
scripts["build:tauri"] = `${pmRunCommand(pm, "build")} && cargo tauri build`;
|
|
661
677
|
}
|
|
662
678
|
if (choices.features.includes("tauriDev")) {
|
|
663
679
|
scripts["dev:tauri-dev"] = "cd src-tauri-dev && cargo tauri dev";
|
|
@@ -668,6 +684,9 @@ function generatePackageJson(choices) {
|
|
|
668
684
|
version: "0.0.1",
|
|
669
685
|
private: true,
|
|
670
686
|
type: "module",
|
|
687
|
+
// @takazudo/zfb + @takazudo/zfb-runtime declare engines.node ">=22.0.0";
|
|
688
|
+
// emit the floor so `<pm> install` warns early on an unsupported Node.
|
|
689
|
+
engines: { node: ">=22" },
|
|
671
690
|
scripts,
|
|
672
691
|
dependencies: deps,
|
|
673
692
|
devDependencies: devDeps,
|
package/dist/utils.d.ts
CHANGED
|
@@ -37,6 +37,16 @@ export declare function initGitRepo(dir: string): GitInitResult;
|
|
|
37
37
|
export declare function capitalize(str: string): string;
|
|
38
38
|
/** Get a short uppercase label for a language code (e.g. "en" → "EN", "zh-cn" → "ZH-CN"). */
|
|
39
39
|
export declare function getLangLabel(langCode: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Build the command that runs a package.json script under `pm`.
|
|
42
|
+
*
|
|
43
|
+
* npm and bun BOTH require the `run` verb — `bun build` invokes Bun's bundler,
|
|
44
|
+
* NOT the package.json `build` script (a real footgun), so bun must emit
|
|
45
|
+
* `bun run build`. pnpm and yarn accept the bare script name (`pnpm build`).
|
|
46
|
+
* The single source of truth for this rule across claude-md-gen.ts,
|
|
47
|
+
* scaffold.ts, and features/tauri.ts.
|
|
48
|
+
*/
|
|
49
|
+
export declare function pmRunCommand(pm: "pnpm" | "npm" | "yarn" | "bun", script: string): string;
|
|
40
50
|
/** Determine the secondary language code when i18n is enabled. */
|
|
41
51
|
export declare function getSecondaryLang(defaultLang: string): string;
|
|
42
52
|
/** Apply a list of regex replacements to a file (if it exists). */
|
package/dist/utils.js
CHANGED
|
@@ -114,6 +114,20 @@ export function capitalize(str) {
|
|
|
114
114
|
export function getLangLabel(langCode) {
|
|
115
115
|
return langCode.toUpperCase();
|
|
116
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Build the command that runs a package.json script under `pm`.
|
|
119
|
+
*
|
|
120
|
+
* npm and bun BOTH require the `run` verb — `bun build` invokes Bun's bundler,
|
|
121
|
+
* NOT the package.json `build` script (a real footgun), so bun must emit
|
|
122
|
+
* `bun run build`. pnpm and yarn accept the bare script name (`pnpm build`).
|
|
123
|
+
* The single source of truth for this rule across claude-md-gen.ts,
|
|
124
|
+
* scaffold.ts, and features/tauri.ts.
|
|
125
|
+
*/
|
|
126
|
+
export function pmRunCommand(pm, script) {
|
|
127
|
+
return pm === "npm" || pm === "bun"
|
|
128
|
+
? `${pm} run ${script}`
|
|
129
|
+
: `${pm} ${script}`;
|
|
130
|
+
}
|
|
117
131
|
/** Determine the secondary language code when i18n is enabled. */
|
|
118
132
|
export function getSecondaryLang(defaultLang) {
|
|
119
133
|
return defaultLang === "en" ? "ja" : "en";
|
package/dist/zfb-config-gen.d.ts
CHANGED
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
import type { UserChoices } from "./prompts.js";
|
|
2
2
|
/**
|
|
3
|
-
* Programmatically generate zfb.config.ts
|
|
3
|
+
* Programmatically generate the ONE `zfb.config.ts` a scaffolded project
|
|
4
|
+
* ships (epic zudolab/zudo-doc#2651, minimal-scaffold Wave 6 #2660).
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* result into `defineConfig` and keeps only the project-owned shell fields
|
|
11
|
-
* (`framework`, `port`, `tailwind`, `base`).
|
|
6
|
+
* Replaces the former `settings-gen.ts` + `zfb-config-gen.ts` pair: there is
|
|
7
|
+
* no more `src/config/settings.ts` — every user choice becomes a field
|
|
8
|
+
* passed straight into `zudoDoc({ ... })` (`@takazudo/zudo-doc/config`),
|
|
9
|
+
* which merges it over the package's own documented defaults and returns a
|
|
10
|
+
* complete `ZfbConfig`.
|
|
12
11
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
|
|
12
|
+
* DIFF-FROM-DEFAULTS (locked, #2653 Decision 2): only fields whose resolved
|
|
13
|
+
* value differs from the matching `ZudoDocConfig` `@default` are emitted —
|
|
14
|
+
* `siteName` is the one field always emitted. `DEFAULT_MIRROR` below is a
|
|
15
|
+
* hand-kept copy of `packages/zudo-doc/src/config.ts`'s `DEFAULT_SETTINGS`
|
|
16
|
+
* for exactly the fields this generator ever sets. It has to be a local
|
|
17
|
+
* mirror (not an import) because `create-zudo-doc` does not depend on
|
|
18
|
+
* `@takazudo/zudo-doc` at generator-build time — the package is only ever a
|
|
19
|
+
* runtime dependency of the SCAFFOLDED project, never of the generator
|
|
20
|
+
* itself. Keep this mirror in sync by hand whenever `DEFAULT_SETTINGS`
|
|
21
|
+
* changes for one of the fields listed here.
|
|
22
|
+
*/
|
|
23
|
+
export declare const DEFAULT_MIRROR: Record<string, unknown>;
|
|
24
|
+
/**
|
|
25
|
+
* Deterministic emission order for the keys of a `desired` config object:
|
|
26
|
+
* the keys present in `FIELD_ORDER` first (cosmetic reference order), then any
|
|
27
|
+
* leftover keys NOT in `FIELD_ORDER` appended in ALPHABETICAL order. The
|
|
28
|
+
* leftover branch exists so a key `buildDesiredConfig()` produces but nobody
|
|
29
|
+
* added to `FIELD_ORDER` is still emitted (deterministically) rather than
|
|
30
|
+
* silently dropped — matching what the `FIELD_ORDER` comment promises.
|
|
31
|
+
*/
|
|
32
|
+
export declare function orderDesiredKeys(desiredKeys: readonly string[]): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Generate the full `zfb.config.ts` source: `defineConfig(zudoDoc({ ... }))`
|
|
35
|
+
* with only the diff-from-defaults fields.
|
|
24
36
|
*/
|
|
25
|
-
export declare function generateZfbConfig(
|
|
37
|
+
export declare function generateZfbConfig(choices: UserChoices): string;
|