@gitpagedocs/cli 0.0.12 → 0.0.14

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.
@@ -3,6 +3,9 @@
3
3
  import { PACKAGE_VERSION } from "../contracts/doc-versions.mjs";
4
4
 
5
5
  const DOC_FILE_KEYS = new Map([
6
+ ["container-pagination.md", "containerPagination"],
7
+ ["pagination-first.md", "paginationFirst"],
8
+ ["markdown-markers.md", "markdownMarkers"],
6
9
  ["content-blocks.md", "contentBlocks"],
7
10
  ["index.md", "index"],
8
11
  ["getting-started.md", "gettingStarted"],
@@ -45,6 +48,8 @@ export function parseHtmlFileToKey(fileName) {
45
48
  const base = fileName.replace(/\.html$/, "");
46
49
  if (base === "source-viewer") return "sourceViewer";
47
50
  if (base === "doom") return "doom";
51
+ if (base === "pagination-first") return "paginationFirst";
52
+ if (base === "pagination-second") return "paginationSecond";
48
53
  return undefined;
49
54
  }
50
55
 
@@ -12,6 +12,7 @@ import { layoutsArtifactPaths } from "../contracts/layouts-paths.mjs";
12
12
  import { languageArtifactPaths } from "../contracts/langs-paths.mjs";
13
13
  import { SUPPORTED_LANGUAGES } from "../contracts/languages.mjs";
14
14
  import { PDF_GUIDE_FILENAME } from "../data/path-mappings.mjs";
15
+ import { PAGINATION_ASSETS } from "../data/paginated-pages.mjs";
15
16
  import { compactSiteIcons, factorRouteDefaults } from "@gitpagedocs/tools/config-format";
16
17
 
17
18
  const DEFAULT_ICON_SVG = `<?xml version="1.0" encoding="utf-8"?>
@@ -161,18 +162,20 @@ export async function writeConfigOnlyOutput(options) {
161
162
 
162
163
 
163
164
  await writeVersionedDocs(root, outputDir, artifacts);
164
- await writePdfArtifacts(options);
165
+ await writeBundledMediaArtifacts(options);
165
166
  }
166
167
 
167
- async function writePdfArtifacts({ root, pkgRoot, outputDir, artifacts }) {
168
- const source = path.join(pkgRoot, "content", "assets", PDF_GUIDE_FILENAME);
168
+ async function writeBundledMediaArtifacts({ root, pkgRoot, outputDir, artifacts }) {
169
169
  for (const [versionId, versionConfig] of Object.entries(artifacts.versionConfigs)) {
170
- const bundledPath = `gitpagedocs/docs/versions/${versionId}/en/${PDF_GUIDE_FILENAME}`;
171
- const routes = versionConfig["routes-pdf"] ?? [];
172
- const usesBundledGuide = routes.some((route) => Object.values(route.pdf?.pathPdf ?? {}).includes(bundledPath));
173
- if (!usesBundledGuide) continue;
174
- const destination = path.join(root, normalizeToOutputPath(outputDir, bundledPath));
175
- await mkdir(path.dirname(destination), { recursive: true });
176
- await copyFile(source, destination);
170
+ const routes = [...(versionConfig["routes-pdf"] ?? []), ...(versionConfig["routes-audio"] ?? [])];
171
+ const mediaPaths = new Set(routes.flatMap(route => Object.values(route.pdf?.pathPdf ?? route.audio?.pathAudio ?? {})));
172
+ for (const fileName of [PDF_GUIDE_FILENAME, ...PAGINATION_ASSETS]) {
173
+ const bundledPath = `gitpagedocs/docs/versions/${versionId}/en/${fileName}`;
174
+ if (!mediaPaths.has(bundledPath)) continue;
175
+ const source = path.join(pkgRoot, "content", "assets", fileName);
176
+ const destination = path.join(root, normalizeToOutputPath(outputDir, bundledPath));
177
+ await mkdir(path.dirname(destination), { recursive: true });
178
+ await copyFile(source, destination);
179
+ }
177
180
  }
178
181
  }