dogsbay 0.2.0-beta.112 → 0.2.0-beta.114
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/dist/commands/site-build.js +20 -2
- package/dist/config/load.js +34 -0
- package/dist/config/schema.d.ts +16 -0
- package/dist/config/to-astro-options.js +2 -0
- package/package.json +27 -27
|
@@ -18,7 +18,7 @@ import { swapTopicmapNavs } from "../topicmap-nav.js";
|
|
|
18
18
|
import { cpSync, existsSync, readdirSync, rmSync } from "node:fs";
|
|
19
19
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
20
20
|
import pc from "picocolors";
|
|
21
|
-
import { emitAstroPages, emitPassthroughAstroPages, emitSiteConfig, emitConfigDerivedFiles, emitDeployArtifacts, emitAgentReadinessFiles, emitMissingTranslationStubs, emitSwitcherMap, emitTaxonomyRoutes, makeSlugExcluder, buildBlogData, emitBlogFiles, emitPluginRuntime, normalizeBasePath, basePathSegments, resolvePrefixes, } from "@dogsbay/format-astro";
|
|
21
|
+
import { emitAstroPages, emitPassthroughAstroPages, emitSiteConfig, emitConfigDerivedFiles, syncSiteDependencies, emitDeployArtifacts, emitAgentReadinessFiles, emitMissingTranslationStubs, emitSwitcherMap, emitTaxonomyRoutes, makeSlugExcluder, buildBlogData, emitBlogFiles, emitPluginRuntime, normalizeBasePath, basePathSegments, resolvePrefixes, } from "@dogsbay/format-astro";
|
|
22
22
|
import { collectPassthroughEntries } from "../passthrough-astro.js";
|
|
23
23
|
import { configToAstroOptions, findConfig, loadConfig, resolveOutputDir, applyDeliverable, VALID_FROM, isValidFrom, } from "../config/index.js";
|
|
24
24
|
import { filterSourcesForMode, importContent, primaryModeFiltersAnything, } from "../import-content.js";
|
|
@@ -514,6 +514,8 @@ export async function siteBuild(cwd, options) {
|
|
|
514
514
|
out: t.out,
|
|
515
515
|
siteName: config.site.name,
|
|
516
516
|
siteUrl: config.site.url,
|
|
517
|
+
copyright: config.site.copyright,
|
|
518
|
+
poweredBy: config.poweredBy,
|
|
517
519
|
stripPrefix: combinedPrefix,
|
|
518
520
|
sourceDir: resolvedSources[0],
|
|
519
521
|
assetMounts: importResult.assetMounts,
|
|
@@ -575,7 +577,21 @@ export async function siteBuild(cwd, options) {
|
|
|
575
577
|
const { copied } = emitPassthroughAstroPages(passthroughCopies, outputDir, generatedPaths);
|
|
576
578
|
console.log(` Copied ${copied} passthrough .astro page${copied === 1 ? "" : "s"}`);
|
|
577
579
|
}
|
|
578
|
-
|
|
580
|
+
// Pages are needed for the redirect rules: the dangling-target and
|
|
581
|
+
// live-page-at-the-source checks are only possible against the emitted set.
|
|
582
|
+
emitConfigDerivedFiles(outputDir, astroOpts, pages);
|
|
583
|
+
// Re-pin `@dogsbay/*` to this CLI's version. package.json is scaffold-once,
|
|
584
|
+
// and this used to run only from `emitSiteScaffold` — which `site build`
|
|
585
|
+
// never calls — so a site rebuilt for months kept installing the component
|
|
586
|
+
// libraries written at its first scaffold. Measured on
|
|
587
|
+
// openshift-docs-markdown: stranded on docs-layout beta.112 while the CLI
|
|
588
|
+
// was on 113, so nothing shipped in the component library ever reached it.
|
|
589
|
+
const syncedDeps = syncSiteDependencies(outputDir, { local: astroOpts.local });
|
|
590
|
+
if (syncedDeps.length > 0) {
|
|
591
|
+
console.log(` Dependencies: re-pinned ${syncedDeps.length} @dogsbay/* package(s) to this CLI's version`);
|
|
592
|
+
for (const change of syncedDeps)
|
|
593
|
+
console.log(` ${change}`);
|
|
594
|
+
}
|
|
579
595
|
// Deploy artifacts — write-if-missing so adding `deploy: github-pages`
|
|
580
596
|
// to dogsbay.config.yml on an existing site materializes the workflow
|
|
581
597
|
// on the next build. Author edits survive (only fired when the file
|
|
@@ -1096,6 +1112,8 @@ async function runSecondaryExport(pages, nav, opts) {
|
|
|
1096
1112
|
await exporter.export(pages, exportNav, out, {
|
|
1097
1113
|
siteName: opts.siteName,
|
|
1098
1114
|
siteUrl: opts.siteUrl,
|
|
1115
|
+
copyright: opts.copyright,
|
|
1116
|
+
poweredBy: opts.poweredBy,
|
|
1099
1117
|
sourceDir: opts.sourceDir,
|
|
1100
1118
|
assetMounts: opts.assetMounts,
|
|
1101
1119
|
plugin: opts.plugin,
|
package/dist/config/load.js
CHANGED
|
@@ -168,6 +168,8 @@ function validate(parsed, sourcePath) {
|
|
|
168
168
|
content,
|
|
169
169
|
output: obj.output,
|
|
170
170
|
outputs: parseOutputs(obj.outputs, sourcePath),
|
|
171
|
+
redirects: parseRedirects(obj.redirects, sourcePath),
|
|
172
|
+
poweredBy: obj.poweredBy,
|
|
171
173
|
deploy: obj.deploy,
|
|
172
174
|
analytics: obj.analytics,
|
|
173
175
|
agent,
|
|
@@ -1116,3 +1118,35 @@ function parseOutputs(raw, sourcePath) {
|
|
|
1116
1118
|
return { format: e.format, path: e.path };
|
|
1117
1119
|
});
|
|
1118
1120
|
}
|
|
1121
|
+
/**
|
|
1122
|
+
* `redirects:` — a map of source path → target. Shape only; the rules
|
|
1123
|
+
* themselves (loops, chains, dangling targets, platform limits) are validated
|
|
1124
|
+
* by `format-astro` at emit time, where the page set is known.
|
|
1125
|
+
*/
|
|
1126
|
+
function parseRedirects(raw, sourcePath) {
|
|
1127
|
+
if (raw === undefined)
|
|
1128
|
+
return undefined;
|
|
1129
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
1130
|
+
throw new Error(`redirects must be a map of "/from/": "/to/" in ${sourcePath}`);
|
|
1131
|
+
}
|
|
1132
|
+
const out = {};
|
|
1133
|
+
for (const [from, value] of Object.entries(raw)) {
|
|
1134
|
+
if (typeof value === "string") {
|
|
1135
|
+
out[from] = value;
|
|
1136
|
+
continue;
|
|
1137
|
+
}
|
|
1138
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
1139
|
+
const v = value;
|
|
1140
|
+
if (typeof v.to !== "string") {
|
|
1141
|
+
throw new Error(`redirects["${from}"] needs a string \`to\` in ${sourcePath}`);
|
|
1142
|
+
}
|
|
1143
|
+
if (v.status !== undefined && typeof v.status !== "number") {
|
|
1144
|
+
throw new Error(`redirects["${from}"].status must be a number in ${sourcePath}`);
|
|
1145
|
+
}
|
|
1146
|
+
out[from] = { to: v.to, ...(v.status !== undefined ? { status: v.status } : {}) };
|
|
1147
|
+
continue;
|
|
1148
|
+
}
|
|
1149
|
+
throw new Error(`redirects["${from}"] must be a path string or { to, status } in ${sourcePath}`);
|
|
1150
|
+
}
|
|
1151
|
+
return out;
|
|
1152
|
+
}
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -124,6 +124,22 @@ export interface DogsbayConfig {
|
|
|
124
124
|
* See plans/cli-grammar.md.
|
|
125
125
|
*/
|
|
126
126
|
outputs?: OutputTarget[];
|
|
127
|
+
/**
|
|
128
|
+
* Redirects for paths with no surviving page — bulk moves, retired
|
|
129
|
+
* sections, external targets. `"/old/": "/new/"` is shorthand for a 301.
|
|
130
|
+
* A page that still exists should declare `aliases:` in its own
|
|
131
|
+
* frontmatter instead, so the knowledge is deleted with the page.
|
|
132
|
+
* See plans/redirects-and-aliases.md.
|
|
133
|
+
*/
|
|
134
|
+
redirects?: Record<string, string | {
|
|
135
|
+
to: string;
|
|
136
|
+
status?: number;
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* "Powered by DogsBay" footer attribution on generated sites. Default true.
|
|
140
|
+
* Set `poweredBy: false` to remove it. See docs/powered-by.md.
|
|
141
|
+
*/
|
|
142
|
+
poweredBy?: boolean;
|
|
127
143
|
deploy?: DeployConfig;
|
|
128
144
|
/**
|
|
129
145
|
* Build / asset behaviour. Knobs that affect how the site
|
|
@@ -27,6 +27,8 @@ export function configToAstroOptions(config) {
|
|
|
27
27
|
plausibleDomain: config.analytics?.plausible?.domain,
|
|
28
28
|
plausibleScriptUrl: config.analytics?.plausible?.scriptUrl,
|
|
29
29
|
deploy: config.deploy?.target,
|
|
30
|
+
redirects: config.redirects,
|
|
31
|
+
poweredBy: config.poweredBy,
|
|
30
32
|
inlineStylesheets: config.build?.inlineStylesheets,
|
|
31
33
|
navMode: config.build?.navMode,
|
|
32
34
|
llmsTxt: config.agent?.llmsTxt,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dogsbay",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.114",
|
|
4
4
|
"description": "CLI for Dogsbay — scaffold, build, and serve documentation sites with markdown / MkDocs / Obsidian / OpenAPI sources",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,32 +42,32 @@
|
|
|
42
42
|
"typescript": "^5.9.3",
|
|
43
43
|
"valibot": "1.1.0",
|
|
44
44
|
"yaml": "^2.9.0",
|
|
45
|
-
"@dogsbay/adoc2md-modular": "0.2.0-beta.
|
|
46
|
-
"@dogsbay/autodoc-python": "0.2.0-beta.
|
|
47
|
-
"@dogsbay/
|
|
48
|
-
"@dogsbay/format-
|
|
49
|
-
"@dogsbay/format-
|
|
50
|
-
"@dogsbay/
|
|
51
|
-
"@dogsbay/format-docusaurus": "0.2.0-beta.
|
|
52
|
-
"@dogsbay/format-dogsbay-md": "0.2.0-beta.
|
|
53
|
-
"@dogsbay/format-fluidtopics-markdown": "0.2.0-beta.
|
|
54
|
-
"@dogsbay/format-
|
|
55
|
-
"@dogsbay/format-
|
|
56
|
-
"@dogsbay/format-
|
|
57
|
-
"@dogsbay/format-
|
|
58
|
-
"@dogsbay/format-mdx": "0.2.0-beta.
|
|
59
|
-
"@dogsbay/format-mkdocs": "0.2.0-beta.
|
|
60
|
-
"@dogsbay/format-myst": "0.2.0-beta.
|
|
61
|
-
"@dogsbay/format-obsidian": "0.2.0-beta.
|
|
62
|
-
"@dogsbay/format-openapi": "0.2.0-beta.
|
|
63
|
-
"@dogsbay/format-
|
|
64
|
-
"@dogsbay/format-
|
|
65
|
-
"@dogsbay/format-
|
|
66
|
-
"@dogsbay/format-topicmap": "0.2.0-beta.
|
|
67
|
-
"@dogsbay/
|
|
68
|
-
"@dogsbay/
|
|
69
|
-
"@dogsbay/
|
|
70
|
-
"@dogsbay/types": "0.2.0-beta.
|
|
45
|
+
"@dogsbay/adoc2md-modular": "0.2.0-beta.114",
|
|
46
|
+
"@dogsbay/autodoc-python": "0.2.0-beta.114",
|
|
47
|
+
"@dogsbay/commands": "0.2.0-beta.114",
|
|
48
|
+
"@dogsbay/format-asciidoc": "0.2.0-beta.114",
|
|
49
|
+
"@dogsbay/format-astro": "0.2.0-beta.114",
|
|
50
|
+
"@dogsbay/format-dita": "0.2.0-beta.114",
|
|
51
|
+
"@dogsbay/format-docusaurus": "0.2.0-beta.114",
|
|
52
|
+
"@dogsbay/format-dogsbay-md": "0.2.0-beta.114",
|
|
53
|
+
"@dogsbay/format-fluidtopics-markdown": "0.2.0-beta.114",
|
|
54
|
+
"@dogsbay/format-fluidtopics-rest": "0.2.0-beta.114",
|
|
55
|
+
"@dogsbay/format-gatsby": "0.2.0-beta.114",
|
|
56
|
+
"@dogsbay/format-gitbook": "0.2.0-beta.114",
|
|
57
|
+
"@dogsbay/format-hugo": "0.2.0-beta.114",
|
|
58
|
+
"@dogsbay/format-mdx": "0.2.0-beta.114",
|
|
59
|
+
"@dogsbay/format-mkdocs": "0.2.0-beta.114",
|
|
60
|
+
"@dogsbay/format-myst": "0.2.0-beta.114",
|
|
61
|
+
"@dogsbay/format-obsidian": "0.2.0-beta.114",
|
|
62
|
+
"@dogsbay/format-openapi": "0.2.0-beta.114",
|
|
63
|
+
"@dogsbay/format-openknowledge": "0.2.0-beta.114",
|
|
64
|
+
"@dogsbay/format-rst": "0.2.0-beta.114",
|
|
65
|
+
"@dogsbay/format-starlight": "0.2.0-beta.114",
|
|
66
|
+
"@dogsbay/format-topicmap": "0.2.0-beta.114",
|
|
67
|
+
"@dogsbay/format-vitepress": "0.2.0-beta.114",
|
|
68
|
+
"@dogsbay/serialize-core": "0.2.0-beta.114",
|
|
69
|
+
"@dogsbay/minja": "0.2.0-beta.114",
|
|
70
|
+
"@dogsbay/types": "0.2.0-beta.114"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/markdown-it": "^14.1.2",
|