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
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Re-export stub for DocHistory types.
|
|
2
|
-
//
|
|
3
|
-
// DocHistoryData and DocHistoryEntry now ship from the package at
|
|
4
|
-
// @takazudo/zudo-doc/island-types (epic #2344, S1a).
|
|
5
|
-
// This file is kept as a stable re-export in case any project-local code
|
|
6
|
-
// references the @/types/doc-history path.
|
|
7
|
-
export type { DocHistoryData, DocHistoryEntry } from "@takazudo/zudo-doc/island-types";
|
package/templates/features/dynamicPageTransition/files/src/components/client-router-bootstrap.tsx
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// Client-side bootstrap for the @takazudo/zfb-runtime ClientRouter.
|
|
4
|
-
//
|
|
5
|
-
// Why this exists (zudolab/zudo-doc#1524, W7A verification):
|
|
6
|
-
// `<ClientRouter />` (mounted in doc-layout.tsx) emits SSR meta tags + CSS
|
|
7
|
-
// for the SPA soft-swap router, but the actual click/form intercept
|
|
8
|
-
// registration runs as a top-of-module side effect inside
|
|
9
|
-
// `@takazudo/zfb-runtime/src/client-router.ts`:
|
|
10
|
-
//
|
|
11
|
-
// if (typeof document !== "undefined") { init(); }
|
|
12
|
-
//
|
|
13
|
-
// The host's existing `import { ClientRouter } from "@takazudo/zfb-runtime"`
|
|
14
|
-
// in doc-layout.tsx happens during SSR (where typeof document ===
|
|
15
|
-
// "undefined"), so the side effect is silently skipped — the router
|
|
16
|
-
// module never reaches the client bundle and every navigation falls
|
|
17
|
-
// through to a full page load. W7A's Playwright harness confirmed this:
|
|
18
|
-
// pageswap.viewTransition is null, getAnimations() is empty during nav,
|
|
19
|
-
// and the sidebar DOM identity is destroyed on every click.
|
|
20
|
-
//
|
|
21
|
-
// The fix is a minimal "use client" island whose only job is to
|
|
22
|
-
// side-effect-import `@takazudo/zfb-runtime/client-router` so the same
|
|
23
|
-
// guard fires in the browser. The `init()` is idempotent (guarded by an
|
|
24
|
-
// `initialized` flag in router.ts), so even if the import path is
|
|
25
|
-
// reached again later the registration runs exactly once.
|
|
26
|
-
//
|
|
27
|
-
// Bundle cost: the only thing this island ships to the client is the
|
|
28
|
-
// client-router subgraph (router.ts + swap-functions.ts + events.ts +
|
|
29
|
-
// types.ts + cssesc.ts) plus its single dep on `@takazudo/zfb/runtime`'s
|
|
30
|
-
// island manager. The server-only zfb-runtime modules
|
|
31
|
-
// (createPageRouter, snapshot, framework adapter) are not transitively
|
|
32
|
-
// reachable from the client-router barrel and stay out of the bundle.
|
|
33
|
-
//
|
|
34
|
-
// Why not call init() in useEffect instead of a side-effect import:
|
|
35
|
-
// useEffect fires after Preact mounts, which is after the islands
|
|
36
|
-
// runtime fetches and executes the bundle. Module top-level code runs
|
|
37
|
-
// as soon as the bundle is parsed by the browser — earlier than mount,
|
|
38
|
-
// closer to Astro's <script type="module"> emission timing. The first
|
|
39
|
-
// click on a fresh page typically arrives 100ms+ after parse, so this
|
|
40
|
-
// timing is what makes the SPA-router actually intercept.
|
|
41
|
-
|
|
42
|
-
// Side-effect import — running this file's bundle in the browser
|
|
43
|
-
// triggers the `if (typeof document !== "undefined") { init(); }` guard
|
|
44
|
-
// at the top of `@takazudo/zfb-runtime/src/client-router.ts`.
|
|
45
|
-
import "@takazudo/zfb-runtime/client-router";
|
|
46
|
-
|
|
47
|
-
import type { JSX } from "preact";
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Renders nothing. The island marker exists only so zfb's island scanner
|
|
51
|
-
* walks page → BodyEndIslands → ClientRouterBootstrap and includes the
|
|
52
|
-
* client-router barrel in the per-island bundle, where the side-effect
|
|
53
|
-
* import above can fire on the client.
|
|
54
|
-
*
|
|
55
|
-
* Note: the SSR `<ClientRouter />` mounted by `DocLayout` (via
|
|
56
|
-
* `enableClientRouter`) self-activates the SPA router when its head meta
|
|
57
|
-
* tags reach the browser. This host island is therefore a no-op for
|
|
58
|
-
* router activation — it is kept only for the `when="load"` hydration
|
|
59
|
-
* slot and bundle inclusion. The actual on/off gate is
|
|
60
|
-
* `enableClientRouter` on `<DocLayoutWithDefaults>`, set to
|
|
61
|
-
* `settings.dynamicPageTransition` at every call site.
|
|
62
|
-
*/
|
|
63
|
-
function ClientRouterBootstrap(): JSX.Element | null {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Stable marker name across SSR / scanner / hydration manifest. Required
|
|
68
|
-
// for production minification per the existing pattern in
|
|
69
|
-
// `pages/lib/_body-end-islands.tsx` (zfb PR #150 marker-name alignment).
|
|
70
|
-
ClientRouterBootstrap.displayName = "ClientRouterBootstrap";
|
|
71
|
-
|
|
72
|
-
export default ClientRouterBootstrap;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Page module for the locale-prefixed site index route.
|
|
4
|
-
//
|
|
5
|
-
// Non-default-locale site index. paths() emits one route per locale defined
|
|
6
|
-
// in settings.locales (never the default locale — that is handled by
|
|
7
|
-
// pages/index.tsx since prefixDefaultLocale is false).
|
|
8
|
-
//
|
|
9
|
-
// paths() contract (zfb ADR-004 — synchronous):
|
|
10
|
-
// params: { locale: string } — e.g. "ja"
|
|
11
|
-
// props: { locale } — resolved locale passed to component
|
|
12
|
-
//
|
|
13
|
-
// Data flow (inside component — sync per ADR-004):
|
|
14
|
-
// routeContext host RouteContext (settings + i18n + nav helpers)
|
|
15
|
-
// → prepareHomeData() nav tree, category order, tag count
|
|
16
|
-
// → HomePageView renders hero + SiteTreeNav grid + tag section
|
|
17
|
-
//
|
|
18
|
-
// Thin consumer of `HomePageView` (S3 #2502) and `prepareHomeData` (#2519):
|
|
19
|
-
// this file's only job is `paths()` (a locale-routing concern) — mirroring
|
|
20
|
-
// the package route's shape (`packages/zudo-doc/src/routes/locale-index.tsx`).
|
|
21
|
-
// The locale-specific data prep — `resolveNavSource` with the locale-home
|
|
22
|
-
// filter options, `loadCategoryMeta`, and the locale-config guard — now lives
|
|
23
|
-
// in `prepareHomeData`. No `extras` here — the showcase's `@Takazudo` brand
|
|
24
|
-
// link (#1453) is project-specific and is not part of the generated
|
|
25
|
-
// project's hero.
|
|
26
|
-
|
|
27
|
-
import { settings } from "@/config/settings";
|
|
28
|
-
import { routeContext } from "../lib/_route-context";
|
|
29
|
-
import { prepareHomeData } from "@takazudo/zudo-doc/home-page";
|
|
30
|
-
import type { JSX } from "preact";
|
|
31
|
-
import { HomePageView } from "../lib/_chrome";
|
|
32
|
-
|
|
33
|
-
export const frontmatter = { title: "Home" };
|
|
34
|
-
|
|
35
|
-
// ---------------------------------------------------------------------------
|
|
36
|
-
// paths() — synchronous (ADR-004)
|
|
37
|
-
// ---------------------------------------------------------------------------
|
|
38
|
-
|
|
39
|
-
/** Emit one route per non-default locale. */
|
|
40
|
-
export function paths(): Array<{
|
|
41
|
-
params: { locale: string };
|
|
42
|
-
props: { locale: string };
|
|
43
|
-
}> {
|
|
44
|
-
return Object.keys(settings.locales).map((locale) => ({
|
|
45
|
-
params: { locale },
|
|
46
|
-
props: { locale },
|
|
47
|
-
}));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// ---------------------------------------------------------------------------
|
|
51
|
-
// Page component
|
|
52
|
-
// ---------------------------------------------------------------------------
|
|
53
|
-
|
|
54
|
-
interface PageArgs {
|
|
55
|
-
params: { locale: string };
|
|
56
|
-
props: { locale: string };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export default function LocaleIndexPage({ params }: PageArgs): JSX.Element {
|
|
60
|
-
const locale = params.locale;
|
|
61
|
-
|
|
62
|
-
const { tree, categoryOrder, tagCount } = prepareHomeData(routeContext, locale);
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<HomePageView
|
|
66
|
-
locale={locale}
|
|
67
|
-
tree={tree}
|
|
68
|
-
categoryOrder={categoryOrder}
|
|
69
|
-
tagCount={tagCount}
|
|
70
|
-
/>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// Re-export shim for the ImageEnlarge island.
|
|
4
|
-
//
|
|
5
|
-
// The real component and its SSR fallback now ship in the package at
|
|
6
|
-
// @takazudo/zudo-doc/image-enlarge (epic #2344, S3).
|
|
7
|
-
// pages/lib/_body-end-islands.tsx imports them directly from there; this
|
|
8
|
-
// overlay overwrites the base W6A no-op stub so that any project-local
|
|
9
|
-
// code referencing the @/components/image-enlarge path resolves to the
|
|
10
|
-
// real island when the imageEnlarge feature is enabled.
|
|
11
|
-
export { ImageEnlarge, ImageEnlargeSsrFallback } from "@takazudo/zudo-doc/image-enlarge";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Thin re-export shim. DesktopSidebarToggle moved into the package
|
|
2
|
-
// (`@takazudo/zudo-doc/desktop-sidebar-toggle-island`) as part of the
|
|
3
|
-
// package-first migration (#2344, S2). Host code using
|
|
4
|
-
// `@/components/desktop-sidebar-toggle` still resolves correctly;
|
|
5
|
-
// the implementation lives in the package.
|
|
6
|
-
export { DesktopSidebarToggle, SIDEBAR_STORAGE_KEY } from "@takazudo/zudo-doc/desktop-sidebar-toggle-island";
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env -S tsx
|
|
2
|
-
/**
|
|
3
|
-
* scripts/tags-audit.ts
|
|
4
|
-
*
|
|
5
|
-
* Thin re-export shim — the audit logic lives in @takazudo/zudo-doc/tags-audit
|
|
6
|
-
* (S9b #2334). This file exists for backward-compat with any project-side
|
|
7
|
-
* imports of these functions (e.g. custom scripts that import helpers from here).
|
|
8
|
-
*
|
|
9
|
-
* The `tags:audit` package.json script does not invoke this file directly;
|
|
10
|
-
* it uses the `tags-audit` package bin from @takazudo/zudo-doc instead.
|
|
11
|
-
*
|
|
12
|
-
* CLI usage (still works via tsx for debugging):
|
|
13
|
-
* tsx scripts/tags-audit.ts [--fix] [--ci] [--json]
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { join, resolve } from "node:path";
|
|
17
|
-
import { fileURLToPath } from "node:url";
|
|
18
|
-
|
|
19
|
-
import pc from "picocolors";
|
|
20
|
-
import pluralize from "pluralize";
|
|
21
|
-
import stringSimilarity from "string-similarity";
|
|
22
|
-
|
|
23
|
-
import { settings } from "../src/config/settings";
|
|
24
|
-
import { tagVocabulary } from "../src/config/tag-vocabulary";
|
|
25
|
-
|
|
26
|
-
// Re-export everything from the package core so existing callers continue
|
|
27
|
-
// to work unchanged.
|
|
28
|
-
export {
|
|
29
|
-
audit,
|
|
30
|
-
applyFixes,
|
|
31
|
-
buildIndex,
|
|
32
|
-
collectMdxFiles,
|
|
33
|
-
computeRewrites,
|
|
34
|
-
formatTextReport,
|
|
35
|
-
hasHardIssues,
|
|
36
|
-
normalizeTags,
|
|
37
|
-
rewriteAliasesByteStable,
|
|
38
|
-
} from "@takazudo/zudo-doc/tags-audit";
|
|
39
|
-
export type {
|
|
40
|
-
AliasIssue,
|
|
41
|
-
AuditOptions,
|
|
42
|
-
AuditReport,
|
|
43
|
-
DeprecatedIssue,
|
|
44
|
-
NearDuplicatePair,
|
|
45
|
-
NearDupHelpers,
|
|
46
|
-
TagVocabularyEntry,
|
|
47
|
-
UnknownIssue,
|
|
48
|
-
} from "@takazudo/zudo-doc/tags-audit";
|
|
49
|
-
|
|
50
|
-
// Backward-compat: expose findNearDuplicates with project helpers pre-bound.
|
|
51
|
-
import { findNearDuplicates as _findNearDuplicates } from "@takazudo/zudo-doc/tags-audit";
|
|
52
|
-
export function findNearDuplicates(
|
|
53
|
-
tags: string[],
|
|
54
|
-
): import("@takazudo/zudo-doc/tags-audit").NearDuplicatePair[] {
|
|
55
|
-
return _findNearDuplicates(tags, {
|
|
56
|
-
singular: pluralize.singular,
|
|
57
|
-
compareTwoStrings: stringSimilarity.compareTwoStrings,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// ── CLI runner (legacy — package bin is preferred) ─────────────────────────
|
|
62
|
-
|
|
63
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
64
|
-
const isMain =
|
|
65
|
-
process.argv[1] !== undefined &&
|
|
66
|
-
resolve(process.argv[1]) === resolve(__filename);
|
|
67
|
-
|
|
68
|
-
if (isMain) {
|
|
69
|
-
const { audit: coreAudit, computeRewrites: coreComputeRewrites, applyFixes: coreApplyFixes, hasHardIssues: coreHasHardIssues, formatTextReport: coreFormatReport } =
|
|
70
|
-
await import("@takazudo/zudo-doc/tags-audit");
|
|
71
|
-
|
|
72
|
-
const argv = process.argv.slice(2);
|
|
73
|
-
const flags = {
|
|
74
|
-
fix: argv.includes("--fix"),
|
|
75
|
-
ci: argv.includes("--ci"),
|
|
76
|
-
json: argv.includes("--json"),
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const ROOT_DIR = resolve(__filename, "..", "..");
|
|
80
|
-
const docsDir = join(ROOT_DIR, settings.docsDir);
|
|
81
|
-
const localeDirs = Object.values(settings.locales ?? {}).map((l) =>
|
|
82
|
-
join(ROOT_DIR, l.dir),
|
|
83
|
-
);
|
|
84
|
-
const contentDirs = [docsDir, ...localeDirs];
|
|
85
|
-
const vocabularyActive =
|
|
86
|
-
Boolean(settings.tagVocabulary) && settings.tagGovernance !== "off";
|
|
87
|
-
|
|
88
|
-
if (flags.fix) {
|
|
89
|
-
const rewrites = coreComputeRewrites(tagVocabulary);
|
|
90
|
-
const touched = await coreApplyFixes(contentDirs, rewrites, ROOT_DIR);
|
|
91
|
-
if (flags.json) {
|
|
92
|
-
process.stdout.write(JSON.stringify({ fixed: touched }, null, 2) + "\n");
|
|
93
|
-
} else if (touched.length === 0) {
|
|
94
|
-
console.log(pc.green("✓ No alias rewrites needed"));
|
|
95
|
-
} else {
|
|
96
|
-
console.log(pc.green(`✓ Rewrote aliases in ${touched.length} file(s):`));
|
|
97
|
-
for (const f of touched) console.log(` ${f}`);
|
|
98
|
-
}
|
|
99
|
-
process.exit(0);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const report = await coreAudit({
|
|
103
|
-
rootDir: ROOT_DIR,
|
|
104
|
-
contentDirs,
|
|
105
|
-
vocabulary: tagVocabulary,
|
|
106
|
-
governance: settings.tagGovernance,
|
|
107
|
-
vocabularyActive,
|
|
108
|
-
nearDupHelpers: {
|
|
109
|
-
singular: pluralize.singular,
|
|
110
|
-
compareTwoStrings: stringSimilarity.compareTwoStrings,
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
if (flags.json) {
|
|
115
|
-
process.stdout.write(JSON.stringify(report, null, 2) + "\n");
|
|
116
|
-
} else {
|
|
117
|
-
console.log(coreFormatReport(report, settings.tagGovernance, vocabularyActive, pc));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const hardIssues = coreHasHardIssues(report);
|
|
121
|
-
if (hardIssues && (flags.ci || settings.tagGovernance === "strict")) {
|
|
122
|
-
process.exit(1);
|
|
123
|
-
}
|
|
124
|
-
if (hardIssues) {
|
|
125
|
-
console.error(
|
|
126
|
-
pc.yellow(
|
|
127
|
-
"Note: tag issues found but running in non-strict mode (exit 0). Use --ci to fail.",
|
|
128
|
-
),
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
}
|