@gitpagedocs/cli 1.1.62 → 1.1.63
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 +193 -193
- package/ai/application/ai-command.ts +24 -24
- package/ai/application/ai-provider-factory.ts +22 -22
- package/ai/application/docs-pattern.ts +68 -68
- package/ai/application/run-ai-cli-command.ts +167 -167
- package/ai/config.ts +50 -50
- package/ai/core/models/ai-cli-config.ts +33 -33
- package/ai/core/models/parse-ai-cli-config.ts +78 -78
- package/ai/core/ports/illm-provider.ts +32 -32
- package/ai/infrastructure/ai-config-file.ts +101 -101
- package/ai/infrastructure/file-system-adapter.ts +85 -85
- package/ai/infrastructure/llm/tools-llm-provider.ts +54 -54
- package/ai/infrastructure/version-docs-writer.ts +143 -143
- package/ai/presentation/ai-prompts.ts +239 -239
- package/application/ports/cli-runtime-ports.ts +91 -91
- package/application/report/config-only-reporter.mjs +64 -64
- package/application/use-cases/dispatch-mode.ts +18 -18
- package/builders/config-orchestrator.mjs +34 -34
- package/builders/project-links.mjs +50 -50
- package/builders/root-config-builder.mjs +61 -61
- package/builders/route-builders.mjs +136 -136
- package/builders/theme-template.mjs +76 -76
- package/builders/version-config-builder.mjs +186 -186
- package/content/docs-en.mjs +549 -549
- package/content/docs-es.mjs +462 -462
- package/content/docs-pt.mjs +462 -462
- package/contracts/doc-versions.mjs +3 -3
- package/data/default-site-config.mjs +321 -321
- package/data/i18n-langmenu.mjs +347 -347
- package/data/layouts.mjs +436 -436
- package/data/path-mappings.mjs +26 -26
- package/data/route-metas.mjs +93 -93
- package/data/theme-colors.mjs +443 -443
- package/data/urls.mjs +12 -12
- package/domain/models/cli-options.ts +33 -33
- package/home/constants.mjs +4 -4
- package/index.mjs +37 -37
- package/infrastructure/gitpagedocs-config-file.ts +47 -47
- package/infrastructure/home/runtime.mjs +37 -37
- package/package.json +3 -3
- package/presentation/commands/ai-info.ts +57 -57
- package/presentation/commands/config-clear.ts +23 -23
- package/presentation/commands/config-info.ts +24 -24
- package/presentation/commands/diagnostics.ts +164 -164
- package/presentation/commands/docs.ts +37 -37
- package/presentation/commands/mcp.ts +20 -20
- package/presentation/commands/pages.ts +101 -101
- package/presentation/commands/password.ts +62 -62
- package/presentation/commands/run-command.ts +70 -70
- package/presentation/index.ts +124 -124
- package/presentation/options/parser.ts +119 -119
- package/presentation/options/resolver.ts +46 -46
- package/presentation/ui/clack.ts +91 -91
- package/presentation/ui/prompts.ts +146 -146
- package/runtime/git-ops.mjs +110 -110
- package/runtime/output.mjs +159 -159
- package/runtime/workflow.mjs +129 -129
- package/start.mjs +12 -12
- package/ui/logger.mjs +9 -9
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
/** Config-only command output messages - SRP: single place for all report messages */
|
|
2
|
-
import { resolveRenderingUrl } from "../../builders/project-links.mjs";
|
|
3
|
-
import { normalizeLayoutsDir } from "../../contracts/layouts-paths.mjs";
|
|
4
|
-
|
|
5
|
-
export function reportConfigOnlySuccess(options) {
|
|
6
|
-
return [`Generated: ${options.outputDir}/ (config-only)`, "No index.html/index.js generated."];
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function reportLayoutConfig(options) {
|
|
10
|
-
const layoutsDir = normalizeLayoutsDir(options.layoutsDir);
|
|
11
|
-
if (options.useLocalLayoutConfig) {
|
|
12
|
-
return [`Local layouts generated in ${layoutsDir}/ (--layoutconfig).`];
|
|
13
|
-
}
|
|
14
|
-
return [`Using official remote layouts config by default (no local ${layoutsDir}/ generated).`];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function reportRenderingUrl(options) {
|
|
18
|
-
if (options.githubOwner && options.githubRepo) {
|
|
19
|
-
return [
|
|
20
|
-
`Configured rendering URL: ${resolveRenderingUrl(options.githubOwner, options.githubRepo)}`,
|
|
21
|
-
`Official viewer remains available: https://vidigal-code.github.io/git-page-docs/${options.githubOwner}/${options.githubRepo}?modetheme=light&lang=pt`,
|
|
22
|
-
];
|
|
23
|
-
}
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function reportPushMode() {
|
|
28
|
-
return [
|
|
29
|
-
"Generated: .github/workflows/gitpagedocs-pages.yml",
|
|
30
|
-
"Push mode enabled: committed and pushed gitpagedocs/ + workflow to origin.",
|
|
31
|
-
];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function reportBuildFlag() {
|
|
35
|
-
return ["`--build` keeps compatibility flag but output remains gitpagedocs/."];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function reportFullOrServeSkipped() {
|
|
39
|
-
return ["External commands were skipped (no prebuilt copy and no local serve spawn)."];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function reportPrebuiltDetected() {
|
|
43
|
-
return ["`prebuilt/` detected, but ignored by config-only generator."];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function reportAll(options, prebuiltDetected) {
|
|
47
|
-
const lines = [];
|
|
48
|
-
lines.push(...reportConfigOnlySuccess(options));
|
|
49
|
-
lines.push(...reportLayoutConfig(options));
|
|
50
|
-
lines.push(...reportRenderingUrl(options));
|
|
51
|
-
if (options.shouldPush) {
|
|
52
|
-
lines.push(...reportPushMode());
|
|
53
|
-
}
|
|
54
|
-
if (options.isBuild) {
|
|
55
|
-
lines.push(...reportBuildFlag());
|
|
56
|
-
}
|
|
57
|
-
if (options.mode === "full" || options.isServe) {
|
|
58
|
-
lines.push(...reportFullOrServeSkipped());
|
|
59
|
-
}
|
|
60
|
-
if (prebuiltDetected) {
|
|
61
|
-
lines.push(...reportPrebuiltDetected());
|
|
62
|
-
}
|
|
63
|
-
return lines;
|
|
64
|
-
}
|
|
1
|
+
/** Config-only command output messages - SRP: single place for all report messages */
|
|
2
|
+
import { resolveRenderingUrl } from "../../builders/project-links.mjs";
|
|
3
|
+
import { normalizeLayoutsDir } from "../../contracts/layouts-paths.mjs";
|
|
4
|
+
|
|
5
|
+
export function reportConfigOnlySuccess(options) {
|
|
6
|
+
return [`Generated: ${options.outputDir}/ (config-only)`, "No index.html/index.js generated."];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function reportLayoutConfig(options) {
|
|
10
|
+
const layoutsDir = normalizeLayoutsDir(options.layoutsDir);
|
|
11
|
+
if (options.useLocalLayoutConfig) {
|
|
12
|
+
return [`Local layouts generated in ${layoutsDir}/ (--layoutconfig).`];
|
|
13
|
+
}
|
|
14
|
+
return [`Using official remote layouts config by default (no local ${layoutsDir}/ generated).`];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function reportRenderingUrl(options) {
|
|
18
|
+
if (options.githubOwner && options.githubRepo) {
|
|
19
|
+
return [
|
|
20
|
+
`Configured rendering URL: ${resolveRenderingUrl(options.githubOwner, options.githubRepo)}`,
|
|
21
|
+
`Official viewer remains available: https://vidigal-code.github.io/git-page-docs/${options.githubOwner}/${options.githubRepo}?modetheme=light&lang=pt`,
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function reportPushMode() {
|
|
28
|
+
return [
|
|
29
|
+
"Generated: .github/workflows/gitpagedocs-pages.yml",
|
|
30
|
+
"Push mode enabled: committed and pushed gitpagedocs/ + workflow to origin.",
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function reportBuildFlag() {
|
|
35
|
+
return ["`--build` keeps compatibility flag but output remains gitpagedocs/."];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function reportFullOrServeSkipped() {
|
|
39
|
+
return ["External commands were skipped (no prebuilt copy and no local serve spawn)."];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function reportPrebuiltDetected() {
|
|
43
|
+
return ["`prebuilt/` detected, but ignored by config-only generator."];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function reportAll(options, prebuiltDetected) {
|
|
47
|
+
const lines = [];
|
|
48
|
+
lines.push(...reportConfigOnlySuccess(options));
|
|
49
|
+
lines.push(...reportLayoutConfig(options));
|
|
50
|
+
lines.push(...reportRenderingUrl(options));
|
|
51
|
+
if (options.shouldPush) {
|
|
52
|
+
lines.push(...reportPushMode());
|
|
53
|
+
}
|
|
54
|
+
if (options.isBuild) {
|
|
55
|
+
lines.push(...reportBuildFlag());
|
|
56
|
+
}
|
|
57
|
+
if (options.mode === "full" || options.isServe) {
|
|
58
|
+
lines.push(...reportFullOrServeSkipped());
|
|
59
|
+
}
|
|
60
|
+
if (prebuiltDetected) {
|
|
61
|
+
lines.push(...reportPrebuiltDetected());
|
|
62
|
+
}
|
|
63
|
+
return lines;
|
|
64
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { CliOptions } from "../../domain/models/cli-options";
|
|
2
|
-
import type { CliCommandRunner, CliRuntimeParams } from "../ports/cli-runtime-ports";
|
|
3
|
-
|
|
4
|
-
export async function dispatchMode(
|
|
5
|
-
options: CliOptions,
|
|
6
|
-
params: CliRuntimeParams,
|
|
7
|
-
runner: CliCommandRunner,
|
|
8
|
-
): Promise<void> {
|
|
9
|
-
if (options.mode === "ai") {
|
|
10
|
-
await runner.runAi({ ...params, options });
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
if (options.mode === "home") {
|
|
14
|
-
await runner.runHome({ ...params, options });
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
await runner.runConfigOnly({ ...params, options });
|
|
18
|
-
}
|
|
1
|
+
import type { CliOptions } from "../../domain/models/cli-options";
|
|
2
|
+
import type { CliCommandRunner, CliRuntimeParams } from "../ports/cli-runtime-ports";
|
|
3
|
+
|
|
4
|
+
export async function dispatchMode(
|
|
5
|
+
options: CliOptions,
|
|
6
|
+
params: CliRuntimeParams,
|
|
7
|
+
runner: CliCommandRunner,
|
|
8
|
+
): Promise<void> {
|
|
9
|
+
if (options.mode === "ai") {
|
|
10
|
+
await runner.runAi({ ...params, options });
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (options.mode === "home") {
|
|
14
|
+
await runner.runHome({ ...params, options });
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
await runner.runConfigOnly({ ...params, options });
|
|
18
|
+
}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
/** Orchestrate build of config artifacts for gitpagedocs */
|
|
2
|
-
|
|
3
|
-
import { LAYOUTS, FALLBACK_LAYOUTS } from "../data/layouts.mjs";
|
|
4
|
-
import { DOCS } from "../content/docs.mjs";
|
|
5
|
-
import { DOC_VERSIONS } from "../data/version-constants.mjs";
|
|
6
|
-
import { buildRootConfig } from "./root-config-builder.mjs";
|
|
7
|
-
import { buildVersionConfig } from "./version-config-builder.mjs";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Build all config artifacts (root, layouts, versions, docs).
|
|
11
|
-
* @param {object} options - { useLocalLayoutConfig, githubOwner, githubRepo, root }
|
|
12
|
-
* @returns {object} { rootConfig, layoutsConfig, fallbackLayoutsConfig, docs, docsHtml, versionConfigs }
|
|
13
|
-
*/
|
|
14
|
-
export function buildConfigArtifacts(options = {}) {
|
|
15
|
-
const root = options.root ?? process.cwd();
|
|
16
|
-
|
|
17
|
-
const rootConfig = buildRootConfig(options);
|
|
18
|
-
const layoutsConfig = { layouts: LAYOUTS };
|
|
19
|
-
const fallbackLayoutsConfig = { layouts: FALLBACK_LAYOUTS };
|
|
20
|
-
|
|
21
|
-
const versionConfigs = {};
|
|
22
|
-
for (const versionId of DOC_VERSIONS) {
|
|
23
|
-
versionConfigs[versionId] = buildVersionConfig(versionId, options);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return {
|
|
27
|
-
rootConfig,
|
|
28
|
-
layoutsConfig,
|
|
29
|
-
fallbackLayoutsConfig,
|
|
30
|
-
docs: DOCS,
|
|
31
|
-
docsHtml: {},
|
|
32
|
-
versionConfigs,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
1
|
+
/** Orchestrate build of config artifacts for gitpagedocs */
|
|
2
|
+
|
|
3
|
+
import { LAYOUTS, FALLBACK_LAYOUTS } from "../data/layouts.mjs";
|
|
4
|
+
import { DOCS } from "../content/docs.mjs";
|
|
5
|
+
import { DOC_VERSIONS } from "../data/version-constants.mjs";
|
|
6
|
+
import { buildRootConfig } from "./root-config-builder.mjs";
|
|
7
|
+
import { buildVersionConfig } from "./version-config-builder.mjs";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Build all config artifacts (root, layouts, versions, docs).
|
|
11
|
+
* @param {object} options - { useLocalLayoutConfig, githubOwner, githubRepo, root }
|
|
12
|
+
* @returns {object} { rootConfig, layoutsConfig, fallbackLayoutsConfig, docs, docsHtml, versionConfigs }
|
|
13
|
+
*/
|
|
14
|
+
export function buildConfigArtifacts(options = {}) {
|
|
15
|
+
const root = options.root ?? process.cwd();
|
|
16
|
+
|
|
17
|
+
const rootConfig = buildRootConfig(options);
|
|
18
|
+
const layoutsConfig = { layouts: LAYOUTS };
|
|
19
|
+
const fallbackLayoutsConfig = { layouts: FALLBACK_LAYOUTS };
|
|
20
|
+
|
|
21
|
+
const versionConfigs = {};
|
|
22
|
+
for (const versionId of DOC_VERSIONS) {
|
|
23
|
+
versionConfigs[versionId] = buildVersionConfig(versionId, options);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
rootConfig,
|
|
28
|
+
layoutsConfig,
|
|
29
|
+
fallbackLayoutsConfig,
|
|
30
|
+
docs: DOCS,
|
|
31
|
+
docsHtml: {},
|
|
32
|
+
versionConfigs,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
/** Shared derivation of project URLs from CLI options (single source of truth
|
|
2
|
-
* for root and version config builders). */
|
|
3
|
-
|
|
4
|
-
import { layoutsArtifactPaths } from "../contracts/layouts-paths.mjs";
|
|
5
|
-
|
|
6
|
-
export const DEFAULT_PROJECT_LINK = "https://github.com/Vidigal-code/git-page-docs";
|
|
7
|
-
export const DEFAULT_RENDERING_URL = "https://vidigal-code.github.io/git-page-docs/";
|
|
8
|
-
|
|
9
|
-
export function resolveProjectLink(githubOwner, githubRepo) {
|
|
10
|
-
return githubOwner && githubRepo
|
|
11
|
-
? `https://github.com/${githubOwner}/${githubRepo}`
|
|
12
|
-
: DEFAULT_PROJECT_LINK;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function resolveRenderingUrl(githubOwner, githubRepo) {
|
|
16
|
-
return githubOwner && githubRepo
|
|
17
|
-
? `https://${githubOwner}.github.io/${githubRepo}/`
|
|
18
|
-
: DEFAULT_RENDERING_URL;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Where the viewer should look for locally generated layouts.
|
|
23
|
-
*
|
|
24
|
-
* Mirrors resolveSourceViewerPath: user repositories use the symbolic HEAD ref
|
|
25
|
-
* so any default branch resolves. Without an owner/repo pair there is no URL to
|
|
26
|
-
* build, so the repo-relative path is returned - the viewer reads it directly in
|
|
27
|
-
* local mode and still discovers it by probing the repository otherwise.
|
|
28
|
-
*
|
|
29
|
-
* @param {string} githubOwner
|
|
30
|
-
* @param {string} githubRepo
|
|
31
|
-
* @param {string} layoutsDir Repo-relative layouts home.
|
|
32
|
-
* @returns {{ config: string, templates: string }}
|
|
33
|
-
*/
|
|
34
|
-
export function resolveLayoutsLinks(githubOwner, githubRepo, layoutsDir) {
|
|
35
|
-
const paths = layoutsArtifactPaths(layoutsDir);
|
|
36
|
-
if (!githubOwner || !githubRepo) {
|
|
37
|
-
return { config: paths.config, templates: paths.templates };
|
|
38
|
-
}
|
|
39
|
-
const base = `${resolveProjectLink(githubOwner, githubRepo)}/blob/HEAD`;
|
|
40
|
-
return { config: `${base}/${paths.config}`, templates: `${base}/${paths.templates}` };
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function resolveSourceViewerPath(githubOwner, githubRepo) {
|
|
44
|
-
// User repositories use the symbolic HEAD ref so any default branch works
|
|
45
|
-
// (github.com, the trees API and raw.githubusercontent all accept it);
|
|
46
|
-
// the official repository keeps its stable main link.
|
|
47
|
-
return githubOwner && githubRepo
|
|
48
|
-
? `${resolveProjectLink(githubOwner, githubRepo)}/tree/HEAD`
|
|
49
|
-
: `${DEFAULT_PROJECT_LINK}/tree/main`;
|
|
50
|
-
}
|
|
1
|
+
/** Shared derivation of project URLs from CLI options (single source of truth
|
|
2
|
+
* for root and version config builders). */
|
|
3
|
+
|
|
4
|
+
import { layoutsArtifactPaths } from "../contracts/layouts-paths.mjs";
|
|
5
|
+
|
|
6
|
+
export const DEFAULT_PROJECT_LINK = "https://github.com/Vidigal-code/git-page-docs";
|
|
7
|
+
export const DEFAULT_RENDERING_URL = "https://vidigal-code.github.io/git-page-docs/";
|
|
8
|
+
|
|
9
|
+
export function resolveProjectLink(githubOwner, githubRepo) {
|
|
10
|
+
return githubOwner && githubRepo
|
|
11
|
+
? `https://github.com/${githubOwner}/${githubRepo}`
|
|
12
|
+
: DEFAULT_PROJECT_LINK;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function resolveRenderingUrl(githubOwner, githubRepo) {
|
|
16
|
+
return githubOwner && githubRepo
|
|
17
|
+
? `https://${githubOwner}.github.io/${githubRepo}/`
|
|
18
|
+
: DEFAULT_RENDERING_URL;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Where the viewer should look for locally generated layouts.
|
|
23
|
+
*
|
|
24
|
+
* Mirrors resolveSourceViewerPath: user repositories use the symbolic HEAD ref
|
|
25
|
+
* so any default branch resolves. Without an owner/repo pair there is no URL to
|
|
26
|
+
* build, so the repo-relative path is returned - the viewer reads it directly in
|
|
27
|
+
* local mode and still discovers it by probing the repository otherwise.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} githubOwner
|
|
30
|
+
* @param {string} githubRepo
|
|
31
|
+
* @param {string} layoutsDir Repo-relative layouts home.
|
|
32
|
+
* @returns {{ config: string, templates: string }}
|
|
33
|
+
*/
|
|
34
|
+
export function resolveLayoutsLinks(githubOwner, githubRepo, layoutsDir) {
|
|
35
|
+
const paths = layoutsArtifactPaths(layoutsDir);
|
|
36
|
+
if (!githubOwner || !githubRepo) {
|
|
37
|
+
return { config: paths.config, templates: paths.templates };
|
|
38
|
+
}
|
|
39
|
+
const base = `${resolveProjectLink(githubOwner, githubRepo)}/blob/HEAD`;
|
|
40
|
+
return { config: `${base}/${paths.config}`, templates: `${base}/${paths.templates}` };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function resolveSourceViewerPath(githubOwner, githubRepo) {
|
|
44
|
+
// User repositories use the symbolic HEAD ref so any default branch works
|
|
45
|
+
// (github.com, the trees API and raw.githubusercontent all accept it);
|
|
46
|
+
// the official repository keeps its stable main link.
|
|
47
|
+
return githubOwner && githubRepo
|
|
48
|
+
? `${resolveProjectLink(githubOwner, githubRepo)}/tree/HEAD`
|
|
49
|
+
: `${DEFAULT_PROJECT_LINK}/tree/main`;
|
|
50
|
+
}
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
/** Build root config for gitpagedocs */
|
|
2
|
-
import { OFFICIAL_LAYOUTS_CONFIG_URL, OFFICIAL_LAYOUTS_TEMPLATES_URL } from "../data/urls.mjs";
|
|
3
|
-
import {
|
|
4
|
-
resolveProjectLink,
|
|
5
|
-
resolveRenderingUrl,
|
|
6
|
-
resolveSourceViewerPath,
|
|
7
|
-
resolveLayoutsLinks,
|
|
8
|
-
} from "./project-links.mjs";
|
|
9
|
-
import { DOCS } from "../content/docs.mjs";
|
|
10
|
-
import { DOC_VERSIONS } from "../data/version-constants.mjs";
|
|
11
|
-
import { defaultLangMenu } from "../data/i18n-langmenu.mjs";
|
|
12
|
-
import { defaultTranslations } from "../data/i18n-translations.mjs";
|
|
13
|
-
import { getDefaultSiteConfig } from "../data/default-site-config.mjs";
|
|
14
|
-
|
|
15
|
-
export function buildRootConfig(options = {}) {
|
|
16
|
-
const useLocalLayoutConfig = Boolean(options.useLocalLayoutConfig);
|
|
17
|
-
const useOfficialLayouts = !useLocalLayoutConfig;
|
|
18
|
-
const githubOwner = options.githubOwner;
|
|
19
|
-
const githubRepo = options.githubRepo;
|
|
20
|
-
const repositorySearchHome = true;
|
|
21
|
-
const renderingUrl = resolveRenderingUrl(githubOwner, githubRepo);
|
|
22
|
-
const projectLink = resolveProjectLink(githubOwner, githubRepo);
|
|
23
|
-
const sourceViewerPath = resolveSourceViewerPath(githubOwner, githubRepo);
|
|
24
|
-
const layoutsLinks = resolveLayoutsLinks(githubOwner, githubRepo, options.layoutsDir);
|
|
25
|
-
|
|
26
|
-
const versionEntries = DOC_VERSIONS.map((id) => ({
|
|
27
|
-
id,
|
|
28
|
-
path: `gitpagedocs/docs/versions/${id}/config.json`,
|
|
29
|
-
ProjectLink: projectLink,
|
|
30
|
-
PathConfig: `gitpagedocs/docs/versions/${id}/config.json`,
|
|
31
|
-
PreviewProject: "",
|
|
32
|
-
UpdateDate: "",
|
|
33
|
-
branch: "",
|
|
34
|
-
release: "",
|
|
35
|
-
commit: "",
|
|
36
|
-
"source-viewer": true,
|
|
37
|
-
"source-viewer-path": sourceViewerPath,
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
|
-
const baseSiteConfig = getDefaultSiteConfig(DOCS, projectLink);
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
site: {
|
|
44
|
-
...baseSiteConfig,
|
|
45
|
-
layoutsConfigPathOficial: useOfficialLayouts,
|
|
46
|
-
layoutsConfigPathTemplatesOficial: useOfficialLayouts ? OFFICIAL_LAYOUTS_TEMPLATES_URL : "",
|
|
47
|
-
layoutsConfigPathOficialUrl: useOfficialLayouts ? OFFICIAL_LAYOUTS_CONFIG_URL : "",
|
|
48
|
-
layoutsConfigPath: useLocalLayoutConfig ? layoutsLinks.config : "",
|
|
49
|
-
layoutsConfigPathTemplates: useLocalLayoutConfig ? layoutsLinks.templates : "",
|
|
50
|
-
repositorySearchHome,
|
|
51
|
-
rendering: renderingUrl,
|
|
52
|
-
AiChatEnabled: true,
|
|
53
|
-
docsAccess: { enabled: false, publicKey: "" },
|
|
54
|
-
langmenu: defaultLangMenu,
|
|
55
|
-
},
|
|
56
|
-
VersionControl: {
|
|
57
|
-
versions: versionEntries,
|
|
58
|
-
},
|
|
59
|
-
translations: defaultTranslations,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
1
|
+
/** Build root config for gitpagedocs */
|
|
2
|
+
import { OFFICIAL_LAYOUTS_CONFIG_URL, OFFICIAL_LAYOUTS_TEMPLATES_URL } from "../data/urls.mjs";
|
|
3
|
+
import {
|
|
4
|
+
resolveProjectLink,
|
|
5
|
+
resolveRenderingUrl,
|
|
6
|
+
resolveSourceViewerPath,
|
|
7
|
+
resolveLayoutsLinks,
|
|
8
|
+
} from "./project-links.mjs";
|
|
9
|
+
import { DOCS } from "../content/docs.mjs";
|
|
10
|
+
import { DOC_VERSIONS } from "../data/version-constants.mjs";
|
|
11
|
+
import { defaultLangMenu } from "../data/i18n-langmenu.mjs";
|
|
12
|
+
import { defaultTranslations } from "../data/i18n-translations.mjs";
|
|
13
|
+
import { getDefaultSiteConfig } from "../data/default-site-config.mjs";
|
|
14
|
+
|
|
15
|
+
export function buildRootConfig(options = {}) {
|
|
16
|
+
const useLocalLayoutConfig = Boolean(options.useLocalLayoutConfig);
|
|
17
|
+
const useOfficialLayouts = !useLocalLayoutConfig;
|
|
18
|
+
const githubOwner = options.githubOwner;
|
|
19
|
+
const githubRepo = options.githubRepo;
|
|
20
|
+
const repositorySearchHome = true;
|
|
21
|
+
const renderingUrl = resolveRenderingUrl(githubOwner, githubRepo);
|
|
22
|
+
const projectLink = resolveProjectLink(githubOwner, githubRepo);
|
|
23
|
+
const sourceViewerPath = resolveSourceViewerPath(githubOwner, githubRepo);
|
|
24
|
+
const layoutsLinks = resolveLayoutsLinks(githubOwner, githubRepo, options.layoutsDir);
|
|
25
|
+
|
|
26
|
+
const versionEntries = DOC_VERSIONS.map((id) => ({
|
|
27
|
+
id,
|
|
28
|
+
path: `gitpagedocs/docs/versions/${id}/config.json`,
|
|
29
|
+
ProjectLink: projectLink,
|
|
30
|
+
PathConfig: `gitpagedocs/docs/versions/${id}/config.json`,
|
|
31
|
+
PreviewProject: "",
|
|
32
|
+
UpdateDate: "",
|
|
33
|
+
branch: "",
|
|
34
|
+
release: "",
|
|
35
|
+
commit: "",
|
|
36
|
+
"source-viewer": true,
|
|
37
|
+
"source-viewer-path": sourceViewerPath,
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
const baseSiteConfig = getDefaultSiteConfig(DOCS, projectLink);
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
site: {
|
|
44
|
+
...baseSiteConfig,
|
|
45
|
+
layoutsConfigPathOficial: useOfficialLayouts,
|
|
46
|
+
layoutsConfigPathTemplatesOficial: useOfficialLayouts ? OFFICIAL_LAYOUTS_TEMPLATES_URL : "",
|
|
47
|
+
layoutsConfigPathOficialUrl: useOfficialLayouts ? OFFICIAL_LAYOUTS_CONFIG_URL : "",
|
|
48
|
+
layoutsConfigPath: useLocalLayoutConfig ? layoutsLinks.config : "",
|
|
49
|
+
layoutsConfigPathTemplates: useLocalLayoutConfig ? layoutsLinks.templates : "",
|
|
50
|
+
repositorySearchHome,
|
|
51
|
+
rendering: renderingUrl,
|
|
52
|
+
AiChatEnabled: true,
|
|
53
|
+
docsAccess: { enabled: false, publicKey: "" },
|
|
54
|
+
langmenu: defaultLangMenu,
|
|
55
|
+
},
|
|
56
|
+
VersionControl: {
|
|
57
|
+
versions: versionEntries,
|
|
58
|
+
},
|
|
59
|
+
translations: defaultTranslations,
|
|
60
|
+
};
|
|
61
|
+
}
|