@icebreakers/monorepo-templates 3.0.1 → 3.1.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/assets/.agents/skills/repoctl/references/commands.md +36 -0
- package/assets/.agents/skills/repoctl/references/config.md +10 -1
- package/assets/.agents/skills/repoctl/references/dependencies.md +2 -0
- package/assets/.agents/skills/repoctl/references/templates.md +6 -0
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{prepare-CiHv-JJL.mjs → prepare-awxaJLdj.mjs} +19 -0
- package/package.json +1 -1
- package/templates/nimbus/AGENTS.md +6 -1
- package/templates/nimbus/README.md +14 -1
- package/templates/nimbus/UPSTREAM.md +6 -0
- package/templates/nimbus/astro.config.ts +5 -3
- package/templates/nimbus/package.json +1 -0
- package/templates/nimbus/src/components/head.astro +4 -2
- package/templates/nimbus/src/content/docs/get-started.mdx +1 -1
- package/templates/nimbus/src/content/docs/zh/get-started.mdx +1 -1
- package/templates/nimbus/src/layouts/docs.astro +15 -2
- package/templates/nimbus/src/lib/deployment/integration.ts +28 -0
- package/templates/nimbus/src/lib/deployment.ts +10 -0
- package/templates/nimbus/src/lib/locale.ts +6 -0
- package/templates/nimbus/src/pages/robots.txt.ts +3 -8
- package/templates/nimbus/src/styles/site.css +8 -0
- package/templates/nimbus/turbo.json +48 -0
- package/templates/react-lib/package.json +11 -3
- package/templates/vitepress/.vitepress/config.ts +1 -1
- package/templates/vitepress/.vitepress/deployment/index.ts +7 -21
- package/templates/vitepress/.vitepress/deployment/output.ts +11 -3
- package/templates/vitepress/package.json +1 -0
- package/templates/vitepress/reference/commands.md +39 -2
- package/templates/vitepress/reference/config.md +9 -1
- package/templates/vitepress/reference/templates.md +2 -0
- package/templates/vitepress/tasks/docs.md +140 -16
- package/templates/vitepress/tasks/release.md +2 -0
- package/templates/vitepress/test/deployment.test.ts +6 -2
- package/templates/vitepress/turbo.json +48 -0
- package/templates/vitepress/zh/reference/commands.md +39 -2
- package/templates/vitepress/zh/reference/config.md +9 -1
- package/templates/vitepress/zh/reference/templates.md +2 -0
- package/templates/vitepress/zh/tasks/docs.md +133 -9
- package/templates/vitepress/zh/tasks/release.md +2 -0
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Commands
|
|
2
2
|
|
|
3
|
+
## docs plan / docs deploy
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
repo docs plan guide --channel preview --source-sha <full-main-sha> --json
|
|
7
|
+
repo docs plan guide --channel stable --release <completion-record-id> --json
|
|
8
|
+
repo docs plan guide --channel stable --commits <correction-sha> --json
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Enable `commands.docs.sites` explicitly. Preview uses the exact latest main source; stable uses a completed main/latest release and the covered packages' publication evidence. `plan` is read-only and does not perform provider credential preflight. Run stable `deploy` with the same inputs through managed `repoctl-docs.yml` / `repoctl-docs-deploy.yml`, with the actual `docs-<site>-<channel>` concurrency group. Keep one deployment owner per channel.
|
|
12
|
+
|
|
13
|
+
Targets retain `{ deployScript, url? }` or use `{ provider: 'cloudflare-workers', config, workerName, accountId, environment?, url? }`. Do not mix them or insert a new `provider: 'script'` discriminator into old configuration. A native target checks an explicit repository-relative static JSON/JSONC Wrangler config for an assets-only Worker. Named environments must exist, replace the whole assets object when overriding it, and explicitly configure routes when the top level owns routes. Preview/stable cannot share the same account+Worker, even with different environment names, or claim the same domains. Worker/account/url values are assertions, not silent config overrides. TOML, generated/plugin configs, Worker code, build hooks, bindings, service environments and unsupported deployment features use a script adapter.
|
|
14
|
+
|
|
15
|
+
Native `deploy` preflights the frozen target, paths, runtime `CLOUDFLARE_API_TOKEN` and read-only Cloudflare deployment/version access before frozen-source install/build. Optional `CLOUDFLARE_ACCOUNT_ID` and effective Wrangler `account_id` must equal configured `accountId`. Read success does not prove future upload or domain-write permissions. Only Worker HTTP 404 plus code `10007` permits first deployment; ambiguous/empty responses, auth errors and rate limits fail. Install and lock Wrangler in the workspace; do not download or substitute an unrelated CLI during deployment. Recheck configuration and symlink containment after build.
|
|
16
|
+
|
|
17
|
+
The native provider writes `/.well-known/repoctl-deployment.json` in assets with the full deployment identity; an existing file must already match that identity. Confirmation requires the latest active version at 100% with exact `repoctl-docs:<deploymentId>` annotation, never a historical match. Matching active identity reuses the remote version without another upload. New uploads must match Wrangler's Worker/environment/version and the active API result. This confirms provider state; optional target `readiness` adds exact public HTTP identity verification.
|
|
18
|
+
|
|
19
|
+
The selected site build and provider/deployment phase receive frozen `REPO_DOCS_*` context. Frozen-source installation removes every inherited `REPO_DOCS_*` variable, retains ordinary CI/package-manager environment and lifecycle scripts, and sets `LEFTHOOK=0`; unrelated sites built by postinstall use their own defaults. The caller's environment is not mutated. Script adapters receive `REPO_DOCS_SITE`, `REPO_DOCS_CHANNEL`, `REPO_DOCS_SOURCE_SHA`, `REPO_DOCS_TREE_SHA`, `REPO_DOCS_RELEASE_ID`, `REPO_DOCS_DEPLOYMENT_ID`, `REPO_DOCS_URL` and `REPO_DOCS_RESULT_FILE`; write `{ versionId, url? }` to the result file only after provider verification. Native targets return that result directly. Credentials never enter the frozen identity.
|
|
20
|
+
|
|
21
|
+
Both providers keep revision-checked claims and stable snapshots. Retry unknown uploads that lack a saved verification receipt, or final checkpoint failures with readiness disabled, using the same release/correction inputs: installation and rebuild still run, then reconciliation decides whether upload is needed. Failed retry preflight/build must retain an existing `deploying` claim. A different stable deployment cannot replace it; serialized latest-main preview can supersede an older preview. Already completed deployments skip. Older pending script snapshots keep their exact configuration and original source after live configuration moves to native targets. Never rewrite snapshots, republish npm to retry docs, or fake a stable completion record.
|
|
22
|
+
|
|
23
|
+
Opt in per target with `readiness: {}` or bounded `timeoutMs`/`requestTimeoutMs`. Use an explicit HTTPS target URL; fetch only its origin-root manifest, without credentials, redirects or caching. Native targets stamp the manifest. Script targets must publish `schemaVersion: 1`, site/channel/deploymentId/sourceSha/treeSha from the supplied `REPO_DOCS_*` context, and releaseId only for stable; do not recompute the corrected tree or replace Nimbus `_headers`. A readiness receipt permits only a nonempty control-free versionId (≤512 characters) and optional HTTP(S) URL without credentials/query/fragment.
|
|
24
|
+
|
|
25
|
+
Provider confirmation persists `verifying` plus its receipt before public HTTP. Timeout/finalization failure keeps the previous fully verified current, although public traffic may already serve the new version. Same-deployment retries skip frozen install/build/upload: native targets recheck the saved active version before polling and finalization; scripts reuse the receipt without rerunning deployScript. The workflow bootstrap install still runs. Another stable deployment cannot replace verifying, and saved stable policy/URL survive changes/removal on main. Never fall back to uploading because readiness failed.
|
|
26
|
+
|
|
27
|
+
`deployDocs` success/skip may include `DocsDeploymentReport`; failure throws `DocsDeploymentError` with safe `.report`. Stages are plan/preflight/install/build/provider/readiness/finalize with explicit skips, monotonic elapsedMs, upload/reconcile and optional failedStage/resumablePhase. `--json` writes result/failure JSON only to stdout and streams child output live to stderr; `DocsOptions.json` selects that transport programmatically. Failures exit nonzero. Known repoctl failures retain fixed reason codes and actionable guidance. Generated reports omit raw exceptions/response bodies/credentials; scripts own their terminal logs. Escaped `GITHUB_STEP_SUMMARY` is best-effort: `summary-write-failed` warns without changing the outcome or hiding the primary failure.
|
|
28
|
+
|
|
3
29
|
## init
|
|
4
30
|
|
|
5
31
|
Purpose: bootstrap workspace metadata plus recommended tooling defaults.
|
|
@@ -80,6 +106,8 @@ Usage:
|
|
|
80
106
|
- `--json` emits the structured report only and still exits non-zero when blocking failures exist
|
|
81
107
|
- `--out <file>` persists the text or JSON report and still exits non-zero when blocking failures exist
|
|
82
108
|
|
|
109
|
+
Text and Markdown show stable rule IDs, exact affected paths and manifest fields. Identical findings share an explanation and fix while retaining every path and original check count; different reasons, fixes and suppressions stay separate. Use the displayed ID with `--rules`, for example `repo doctor --rules template-instance-drift`. Grouped display never changes statuses, effective totals, suppression policy or full individual JSON records. Use `--redact` before sharing local paths.
|
|
110
|
+
|
|
83
111
|
```bash
|
|
84
112
|
repo doctor --list-rules
|
|
85
113
|
repo doctor --rules root-scripts,package-manager --strict
|
|
@@ -105,6 +133,10 @@ Preview the complete operation with `repo upgrade --dry-run`, `--json` or `--mar
|
|
|
105
133
|
|
|
106
134
|
Root assets use old-upstream/local/new-upstream three-way merging. Commit `.repoctl/baselines/root/` to preserve the upstream records across clones; record updates are reviewed in each file's `baseline` plan entry and applied atomically with that file. Independent changes merge automatically, while conflicting files and their baselines stay unchanged. Local deletion is never undone. API results expose unresolved `conflicts`; CLI preview and apply exit with code 1 when conflicts remain. Saved plans are reviewed write payloads; their hashes detect stale inputs and inconsistent content, not authorship. Generated app/package directories are outside this feature.
|
|
107
135
|
|
|
136
|
+
New workspace overrides are checked against declarations in the proposed package membership and `commands.deps.groups`. Scope expansion or incompatible replacements produce `workspace-override-policy` conflicts, including with `--yes`/`--overwrite`. Inspect `workspacePolicy.findings` for affected manifests/groups and both value fingerprints. New parent-qualified selectors and non-semver replacements are `unverified`; ordinary upgrade requires explicit file selection, automatic maintenance rejects them, and reviewed saved-plan apply remains available. To retain an individual value or its absence, commit `commands.upgrade.keep` entries with `file: 'pnpm-workspace.yaml'`, `path: ['overrides', selector]`, `reason`, copied `upstreamHash`/`localHash`, and optional inclusive UTC `expires`. Regenerate the plan after configuration changes. Changed upstream/local values and elapsed expiry invalidate the decision; apply also checks configuration, inspected manifests and the proposed package set. Do not replace scoped overrides with global ones to silence this check. Existing template-instance `excludedPaths` and file selections remain separate.
|
|
137
|
+
|
|
138
|
+
A recognized automatic default hook migration marks unverified override additions as `deferred` and leaves them absent. Preview again afterwards, then explicitly review/select or apply the new saved plan to accept them. Hard conflicts and protected skips of required files block every member of an atomic group, including explicit partial selection; preset-owned targets and preserved local deletions cannot leave hooks partially migrated. Automatic maintenance preparation and the independent publisher reject both `unverified` and `deferred`; finish the ordinary hook migration and override review before retrying maintenance.
|
|
139
|
+
|
|
108
140
|
Upgrade apply holds `.repoctl/upgrade.lock` through validation, no-op detection, writes, rollback and cleanup. It never removes colliding recovery files, changed recovery bytes or replacement directories. After an interruption, confirm no writer is active and recover retained backups before removing the lock and regenerating the plan.
|
|
109
141
|
|
|
110
142
|
Versioned migrations appear in `migrations` with stable IDs and affected files. The Changesets-to-pnpm migration starts at template 1.1.0. Use `--from-version <exact-semver>` only when the old version is known; dependency ranges are not version evidence. Unknown sources adopt only recognized legacy formats. Commit `.repoctl/migrations/ledger.json` when created; its cursor covers migrations, not all assets. Preview writes nothing. Pending/failed bytes and completed diffs are reviewed together; migration groups cannot be split, and completed is written only at the end of a successful migration transaction. Re-preview pending/failed attempts to see already-applied versus remaining files; third-state local edits block recovery and retain attempt-specific backups. The shared `.repoctl/upgrade.lock` is never stolen by age; confirm no writer is active and recover pending backups before clearing it. Recovery performs no network/publish actions or historical script execution.
|
|
@@ -458,3 +490,7 @@ Automatic maintenance can complete the built-in Changesets migration and update
|
|
|
458
490
|
Preview `repo workspace prepare <exact-name-or-./directory> --mode prune|deploy --out ../empty-output --json`; save the plan outside the source workspace. Apply only after review with `repo workspace prepare --apply ../plan.json`. Prune uses local Turbo 2 and optional `--docker`; deploy uses exact pinned pnpm 10/11/12 with production dependencies, frozen lockfile, disabled lifecycle/pnpmfile hooks, optional `--offline`/explicit `--legacy`, and an existing built `--entry` or manifest main/single bin. Native version-specific injection and peer behavior remains authoritative. No application, image publishing or cloud deployment is executed.
|
|
459
491
|
|
|
460
492
|
Native commands receive an isolated copy without node_modules, Git/operation/cache directories, real env files or named authentication files. Public .env.example/.env.sample remain. Source symlinks/special files, source-directed native write settings and inventories above 100,000 entries/1 GiB are unsupported. Output must be outside the workspace; links must remain inside the artifact. Publish files exclusively and commit the receipt last. Replays verify source/tool/config fingerprints and complete output; failures preserve concurrent edits and report retained paths. Review cleanupPending and recover partial output before removing a stale .repoctl/workspace-artifacts.lock. Do not hand-edit lockfiles or overwrite nonempty output. On Windows, transfer junction contents with an appropriate copy/archive mode.
|
|
493
|
+
|
|
494
|
+
## Documentation build context
|
|
495
|
+
|
|
496
|
+
Use `resolveDocsContext({ channel, url, previewOrigin, stableOrigin })` from `repoctl/docs-context` for public build metadata, plus `docsRobots`, `docsPreviewRobots` and ownership-aware `mergeDocsHeaders`. The pure entrypoint loads no provider, credentials or GitHub state. Default local builds are preview; `REPO_DOCS_CHANNEL=stable pnpm build` is allowed without deployment authorization. Distinct HTTP(S) origins are required and optional `REPO_DOCS_URL` must match. Review cached tasks with `repo env check build lint typecheck test --json`.
|
|
@@ -7,7 +7,7 @@ Rule:
|
|
|
7
7
|
- Load `repoctl.config.*`; rename legacy `monorepo.config.*`, which is no longer loaded.
|
|
8
8
|
- Validate repoctl-owned fields before command side effects with `repo config validate --json`.
|
|
9
9
|
- Native tooling passthrough and callbacks keep their extension boundary. Config modules are trusted executable project code.
|
|
10
|
-
- Use `repo config inspect --command ai --set 'format="json"' --json` for shared defaults/project/CLI provenance. Contexts: ai, clean, create, deps, doctor, init, mirror, release, upgrade. Runtime selection is explained by each command's plan.
|
|
10
|
+
- Use `repo config inspect --command ai --set 'format="json"' --json` for shared defaults/project/CLI provenance. Contexts: ai, clean, create, deps, doctor, docs, init, mirror, release, upgrade. Runtime selection is explained by each command's plan.
|
|
11
11
|
- Reports redact env values and native tool payloads by default; `--redact` additionally hides local paths. For programmatic safe reports use `explainMonorepoConfig` or `validateConfigFile`; runtime config APIs retain callbacks and should not be serialized for sharing.
|
|
12
12
|
- Git hooks use native `lefthook.yml`. Migrate old `tooling.lintStaged` and `tooling.husky` settings into that file.
|
|
13
13
|
- Organization presets use `presets: [{ packageName, version }]` with an exact installed dependency and JSON-only `repoctl.preset.json`. Loading never imports package code, installs or fetches. Parents precede declaring presets, then the project and CLI; arrays replace at preset boundaries. `config inspect` exposes ordered layers and precise package/version sources.
|
|
@@ -70,6 +70,9 @@ Key areas:
|
|
|
70
70
|
- upgrade: overwrite behavior and extra targets
|
|
71
71
|
- init: skip steps for README/package.json/pnpm change intent setup
|
|
72
72
|
- mirror: add or override env mirrors
|
|
73
|
+
- docs: explicit sites with covered `packages`, a root `buildScript`, `preview`/`stable` targets, allowed `patchPaths` and optional per-package `releaseInputs`. Targets choose `{ deployScript, url? }` or `{ provider: 'cloudflare-workers', config, workerName, accountId, environment?, url? }`, never both. Native Cloudflare supports static assets-only JSON/JSONC configurations; freeze the nonsecret account identity, keep credentials in runtime environment secrets, and preserve old script snapshots for retry. See the docs section in `commands.md` for preflight and recovery boundaries.
|
|
74
|
+
|
|
75
|
+
Both docs target variants accept optional `readiness: { timeoutMs?, requestTimeoutMs? }`. Omission means no public HTTP. `{}` requires an explicit HTTPS target URL without userinfo/query/fragment; probe the fixed origin-root `/.well-known/repoctl-deployment.json`. Positive integer defaults/limits: total 120000 ms / 1–600000, request 10000 ms / 1–30000. Runtime defaults do not alter stored config identity. Saved stable verification retains its original target and policy even if main removes them.
|
|
73
76
|
|
|
74
77
|
## `commands.doctor`
|
|
75
78
|
|
|
@@ -129,3 +132,9 @@ The root aggregates selected projects. Only explicit `relations` add compilation
|
|
|
129
132
|
Existing references remain manually owned. Only newly added entries are recorded in `.repoctl/typescript-references.json`; commit that registry alongside the tsconfigs. Removing or excluding a project removes only entries recorded there. Editing/removing an owned entry blocks synchronization: restore it, or deliberately remove its registry entry to return ownership to the user. JSONC content outside the `references` value, BOM and line endings are preserved. Root aggregation and explicit edges produce stable relative config-file paths.
|
|
130
133
|
|
|
131
134
|
Saved plans include input fingerprints and exact diffs. Applying a stale or edited plan fails before writes; reapplying an already completed plan is a no-op. A process lock at `.repoctl/typescript-references.lock` covers revalidation, writing, verification, rollback and cleanup. Changes stage together with backups and roll back on failure. If concurrent edits prevent safe rollback, the error names retained recovery files: preserve them, reconcile the business edit with the original backup, restore the ownership registry consistently and generate a new plan. A killed process can also leave `.repoctl-references-*.bak`/`.tmp` files; verify no writer remains, reconcile matching backups and the registry, then remove the stale lock. No recovery action overwrites a concurrent edit automatically.
|
|
135
|
+
|
|
136
|
+
- upgrade `keep`: reviewed `pnpm-workspace.yaml` override decisions only; each entry has `file`, exact array `path`, nonempty `reason`, `upstreamHash`, `localHash`, and optional inclusive UTC `expires`. Copy fingerprints from `workspacePolicy.findings`; absence and null differ. Re-preview after editing configuration. Upstream/local value changes or expiry require renewed review.
|
|
137
|
+
|
|
138
|
+
## Documentation channel rendering
|
|
139
|
+
|
|
140
|
+
Provider target URLs and template origins must agree. `repoctl/docs-context` validates public channel/URL values only; it does not authorize deployments or stamp deployment manifests. Configure the Nimbus or VitePress deployment module with distinct preview/stable origins and keep channel/URL in task-local Turbo `env` hashes. Preview crawler restrictions must not disable local search. Preserve project-owned layouts and user/Nimbus `_headers` rules through the marked merge helper.
|
|
@@ -35,3 +35,5 @@ Only plain semver ranges and same-source npm aliases can migrate. An alias keeps
|
|
|
35
35
|
Apply is bound to the same workspace and full input set. Stale YAML, changed manifests/policies, new packages, linked files, partial application and modified plan contents are rejected before writes. It uses the same staged replacements, backups and rollback as dependency fixes, across both YAML and JSON. A fully applied plan and a repeated migration are no-ops. If recovery cannot safely replace a concurrent edit, inspect the listed `.repoctl-deps-*.bak` originals, restore reviewed files, remove stale temporary files and generate a fresh plan; the concurrent edit is preserved.
|
|
36
36
|
|
|
37
37
|
Public APIs are `checkCatalogs(cwd, options?)`, `planCatalogMigration(cwd, options)` and `applyCatalogMigrationPlan(cwd, plan)`. See [pnpm catalogs](https://pnpm.io/catalogs) for protocol semantics and [Syncpack](https://syncpack.dev/) for intentional version-group policy patterns.
|
|
38
|
+
|
|
39
|
+
Workspace upgrade reuses dependency groups when evaluating new overrides. It scans the proposed workspace membership, reports selector expansion and declarations incompatible with replacement versions, and keeps unverified parent-qualified/non-semver cases explicit. Use fingerprint-bound `commands.upgrade.keep` decisions to retain reviewed local override values or absence; do not remove intentional cohorts merely to accept template defaults.
|
|
@@ -68,3 +68,9 @@ npm configuration supplies scoped registry/authentication. Never put credentials
|
|
|
68
68
|
## Existing-package generators
|
|
69
69
|
|
|
70
70
|
Use `repo generate <vue-component|react-component|hono-route> <kebab-name> --package <exact-name-or-relative-dir> --json` to inspect source and behavior-test files before writing. Run without `--json` to apply; `--export` explicitly adds a named export to `src/index.ts` (or `--barrel`). `--directory` stays inside the selected package. Strict parameters, framework requirements, stale plans, symlinks and conflicting files fail before writes. Repeated identical generation is unchanged. Hono route registration remains an explicit printed next step. Validate generated output with build, ESLint/Stylelint, tsc/vue-tsc and tests. Keep `repo new` for whole new packages; it never overwrites existing directories.
|
|
71
|
+
|
|
72
|
+
## Documentation channels
|
|
73
|
+
|
|
74
|
+
Nimbus and VitePress use `repoctl/docs-context` with explicit `REPO_DOCS_CHANNEL` and `REPO_DOCS_URL` build inputs. Configure distinct preview/stable HTTP(S) origins in the local deployment module; paths belong to the framework base. Missing/empty channel defaults to preview; supplied URL must match the selected origin. Local stable builds require no token or release record.
|
|
75
|
+
|
|
76
|
+
Keep preview banners, robots/meta/X-Robots-Tag restrictions and search independent: preview remains searchable with official AI exports. `mergeDocsHeaders` owns marked fields only and preserves user/Nimbus rules; malformed markers fail. Keep task-local Turbo env hashes and authored content/config/script inputs, and run `repo env check build lint typecheck test --json`. Both docs packages declare repoctl directly. Existing layouts remain project-owned; use reviewed template upgrades or manual integration.
|
package/dist/cli.mjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as getAssetTargets$1, a as createTemplateCopyFilter, c as toPublishGitignorePath, d as templateChoices$1, f as assetsDir, g as assetTargets$1, h as templatesDir, i as arePublishedConfigAssetsPrepared, l as toWorkspaceAssetPath, m as skeletonDir, n as arePublishedGithubAssetsPrepared, o as shouldSkipTemplatePath, p as packageDir, r as sanitizePublishedWorkspaceContent, s as isGitignoreFile, t as prepareAssets, u as toWorkspaceGitignorePath } from "./prepare-
|
|
1
|
+
import { _ as getAssetTargets$1, a as createTemplateCopyFilter, c as toPublishGitignorePath, d as templateChoices$1, f as assetsDir, g as assetTargets$1, h as templatesDir, i as arePublishedConfigAssetsPrepared, l as toWorkspaceAssetPath, m as skeletonDir, n as arePublishedGithubAssetsPrepared, o as shouldSkipTemplatePath, p as packageDir, r as sanitizePublishedWorkspaceContent, s as isGitignoreFile, t as prepareAssets, u as toWorkspaceGitignorePath } from "./prepare-awxaJLdj.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import fs, { access, lstat, mkdir, open, readFile, rm, writeFile } from "node:fs/promises";
|
|
4
4
|
import { Buffer } from "node:buffer";
|
|
@@ -511,6 +511,23 @@ async function arePublishedGithubAssetsPrepared(repoRoot, assetRoot) {
|
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
513
|
//#endregion
|
|
514
|
+
//#region src/prepare/template-manifest.ts
|
|
515
|
+
/** Nested template assets are not rewritten by npm pack's workspace conversion. */
|
|
516
|
+
function sanitizeTemplateManifest(content) {
|
|
517
|
+
const manifest = JSON.parse(content);
|
|
518
|
+
for (const field of [
|
|
519
|
+
"dependencies",
|
|
520
|
+
"devDependencies",
|
|
521
|
+
"optionalDependencies",
|
|
522
|
+
"peerDependencies"
|
|
523
|
+
]) {
|
|
524
|
+
const dependencies = manifest[field];
|
|
525
|
+
for (const [name, version] of Object.entries(dependencies ?? {})) if (name === "repoctl" && version === "workspace:*") dependencies[name] = "latest";
|
|
526
|
+
else if (/^(?:workspace|file|link|catalog):/.test(version)) throw new Error(`Template ${field}.${name} contains an unsupported source-local dependency`);
|
|
527
|
+
}
|
|
528
|
+
return `${JSON.stringify(manifest, null, 2)}\n`;
|
|
529
|
+
}
|
|
530
|
+
//#endregion
|
|
514
531
|
//#region src/prepare/index.ts
|
|
515
532
|
function toPublishedAssetPath(target) {
|
|
516
533
|
return target === ".npmrc" ? "npmrc" : toPublishGitignorePath(target);
|
|
@@ -650,6 +667,8 @@ async function copyTemplates(repoRoot, overwriteExisting) {
|
|
|
650
667
|
const to = path$1.join(templatesDir, template.source);
|
|
651
668
|
const filter = (src) => !shouldSkipTemplatePath(from, src);
|
|
652
669
|
await copyEntry(from, to, overwriteExisting, filter);
|
|
670
|
+
const manifest = path$1.join(from, "package.json");
|
|
671
|
+
if (await pathExists(manifest)) await fs.writeFile(path$1.join(to, "package.json"), sanitizeTemplateManifest(await fs.readFile(manifest, "utf8")));
|
|
653
672
|
await renameGitignoreFiles(to);
|
|
654
673
|
}
|
|
655
674
|
}
|
package/package.json
CHANGED
|
@@ -5,8 +5,13 @@ This is a static Nimbus + Astro documentation site. Run commands in this workspa
|
|
|
5
5
|
- Content lives in `src/content/docs/`; English uses the root and Chinese uses `zh/` with matching relative filenames. Keep both translations and links in sync. The directory tree supplies routes and navigation.
|
|
6
6
|
- Layouts and components are project-owned. Keep modules small. Put styles in `src/styles/` so Stylelint checks every authored style.
|
|
7
7
|
- Register MDX components in `src/components.ts`. Add a text conversion in `astro.config.ts` when a custom component conveys information that would otherwise disappear from Markdown.
|
|
8
|
-
- Set
|
|
8
|
+
- Set channel origins in `src/lib/deployment.ts` and the project title in `astro.config.ts` before deployment. Static output is `dist/` and can be hosted anywhere.
|
|
9
9
|
- Run `pnpm build`, `pnpm lint`, and `pnpm typecheck`. `typecheck` combines Astro diagnostics with TypeScript checks. Search uses the production Pagefind index; verify it with `pnpm preview` after building.
|
|
10
10
|
- Verify `/llms.txt`, `/zh/llms.txt`, `/llms-full.txt`, and each page's `/index.md` and `/index.mdx`. Keep private content outside public content collections; `noindex` is not access control.
|
|
11
11
|
- `draft: true` excludes unfinished pages from production. When adding a page, create its translation before publishing so the language switch remains valid.
|
|
12
12
|
- Keep `nimbus.json` and `UPSTREAM.md` when upgrading. Review Nimbus migrations and project-owned changes before advancing the reviewed version.
|
|
13
|
+
|
|
14
|
+
- Configure distinct preview/stable HTTP(S) origins in `src/lib/deployment.ts`; use Astro `base` for a subpath. `repoctl/docs-context` reads only explicit public channel/URL values and requires no credentials for local builds. Keep this workspace's repoctl dependency and Turbo env/input declarations.
|
|
15
|
+
- Preview is the local default. Preview uses a bilingual notice and robots/meta/header restrictions while preserving Pagefind bodies and official AI exports. Content `noindex` is separate; honor explicit `searchable: true`.
|
|
16
|
+
- Keep the channel integration after Nimbus. Merge `_headers` using repoctl ownership markers, preserving user security/cache rules and Nimbus discovery rules. Verify preview → stable → preview builds in the same directory, real search results, both languages and no-JavaScript content.
|
|
17
|
+
- Existing layouts are project-owned. Review template upgrades or integrate the helper manually; root managed upgrades do not replace them.
|
|
@@ -12,7 +12,7 @@ pnpm lint
|
|
|
12
12
|
pnpm typecheck
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Edit `src/content/docs/` and its `zh/` translations. Set your project title and
|
|
15
|
+
Edit `src/content/docs/` and its `zh/` translations. Set your project title in `astro.config.ts` and channel origins in `src/lib/deployment.ts` before publishing `dist/` to a static host. Search is available after a production build.
|
|
16
16
|
|
|
17
17
|
机器可读入口包括 `/llms.txt`、`/zh/llms.txt`、`/llms-full.txt`,以及页面的 `/index.md` 和 `/index.mdx`。Nimbus 还会生成 `/.well-known/ard.json`、`/.well-known/ai-catalog.json` 和 `dist/_headers` 中的发现响应头。静态托管需要应用这些响应头;不支持 `_headers` 的主机应配置等效规则。使用子路径部署时,发现文件仍须发布到域名根目录的 `/.well-known/`,并在那里应用对应响应头规则。详见 `AGENTS.md` 和 `UPSTREAM.md`。
|
|
18
18
|
|
|
@@ -37,3 +37,16 @@ pnpm typecheck
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
不要只修改审阅版本来跳过迁移。部署前检查发现文件、首页 Link 响应头,以及中英文页面和机器可读入口。
|
|
40
|
+
|
|
41
|
+
## Preview and stable builds / 预览与正式构建
|
|
42
|
+
|
|
43
|
+
Set distinct `previewOrigin` and `stableOrigin` in `src/lib/deployment.ts`; `astro.config.ts` consumes the same public context as page metadata, robots and the official Nimbus AI/discovery endpoints. With no channel configured, local builds use preview. Both commands work without deployment credentials:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
REPO_DOCS_CHANNEL=preview pnpm build
|
|
47
|
+
REPO_DOCS_CHANNEL=stable pnpm build
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`REPO_DOCS_URL`, when nonempty, must match the selected origin. Configure a subpath with Astro `base`, not an origin pathname. The build rejects a hosting environment that changes Nimbus's resolved origin. The template's Turbo tasks hash both channel inputs and all authored content/configuration/scripts.
|
|
51
|
+
|
|
52
|
+
预览站显示未发布提示,输出 robots、meta 和 X-Robots-Tag 禁止搜索引擎收录策略,同时保留 Pagefind 站内搜索、Markdown 和 LLM 导出。内容自身的 `noindex` 与搜索资格分开处理,显式 `searchable: true` 仍可搜索。正式构建移除渠道专属限制,保留内容的 `noindex`。`_headers` 只增删 repoctl 标记的部分,保留用户缓存/安全策略和 Nimbus 发现响应头;标记损坏会直接失败。禁止收录不是访问控制。
|
|
@@ -32,3 +32,9 @@ The `0.16.0` → `0.17.0` review follows the installed package's `nimbus-docs mi
|
|
|
32
32
|
The site remains static. Its existing Markdown/MDX and LLM endpoint factories stay valid. Optional copied-sidebar, browser WebMCP and server-rendering changes are not adopted. There is no project `skills/` directory to publish. Existing `robots.txt` policy is preserved; the new starter's optional AI training Content Signals are not adopted implicitly.
|
|
33
33
|
|
|
34
34
|
For a subpath deployment, publish the generated `.well-known/` directory at the origin root and apply its header rules there. Hosts that do not consume `_headers` need equivalent native header configuration; see the [agent deployment guidance](https://nimbus-docs.com/ai/docs-for-agents/).
|
|
35
|
+
|
|
36
|
+
## repoctl channel integration
|
|
37
|
+
|
|
38
|
+
The project-owned `src/lib/deployment.ts` resolves `repoctl/docs-context` before `defineNimbusConfig`, so Nimbus 0.17.0 receives one origin for Astro metadata, baked Markdown/LLM endpoints and agent discovery. A final config assertion rejects hosting-environment origin drift. Preview disables sitemap generation but does not mark content entries noindex, preserving Nimbus discovery and Pagefind indexing. The local head adds crawler restrictions independently; explicit content `searchable: true` is honored even with authored noindex.
|
|
39
|
+
|
|
40
|
+
The channel integration follows Nimbus's build hook and merges only marked repoctl X-Robots-Tag fields into `_headers`. Nimbus's discovery markers, Link headers and owner headers remain intact across channel switches. Preview/stable is a repoctl adaptation, not an upstream version migration; the reviewed Nimbus 0.17.0 baseline is unchanged. Existing origin-root `.well-known/` hosting instructions still apply with Astro `base`.
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import nimbus, { defineConfig as defineNimbusConfig } from '@cloudflare/nimbus-docs'
|
|
2
2
|
import { defineConfig } from 'astro/config'
|
|
3
|
+
import { deployment } from './src/lib/deployment'
|
|
4
|
+
import { docsChannel } from './src/lib/deployment/integration'
|
|
3
5
|
|
|
4
6
|
export default defineConfig({
|
|
5
7
|
output: 'static',
|
|
6
8
|
// Keep the Pagefind loader external so Vite finalizes dynamic imports before Astro renders it.
|
|
7
9
|
vite: { build: { assetsInlineLimit: 0 } },
|
|
8
10
|
integrations: [nimbus(defineNimbusConfig({
|
|
9
|
-
|
|
10
|
-
site: 'https://docs.example.com',
|
|
11
|
+
site: deployment.origin,
|
|
11
12
|
title: 'Project docs',
|
|
12
13
|
description: 'Guides and examples for your project.',
|
|
13
14
|
locale: 'en',
|
|
14
15
|
github: null,
|
|
15
16
|
}), {
|
|
17
|
+
sitemap: !deployment.preview,
|
|
16
18
|
icons: false,
|
|
17
19
|
rules: {
|
|
18
20
|
'nimbus/frontmatter-shape': 'error',
|
|
@@ -24,5 +26,5 @@ export default defineConfig({
|
|
|
24
26
|
Aside: { revision: '1', render: ({ children }) => children },
|
|
25
27
|
},
|
|
26
28
|
},
|
|
27
|
-
})],
|
|
29
|
+
}), docsChannel(deployment)],
|
|
28
30
|
})
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
import { withBase } from '@cloudflare/nimbus-docs/runtime'
|
|
3
|
+
import { docsPreviewRobots } from 'repoctl/docs-context'
|
|
3
4
|
import { config } from 'virtual:nimbus/config'
|
|
5
|
+
import { deployment } from '../lib/deployment'
|
|
4
6
|
|
|
5
7
|
interface Props {
|
|
6
8
|
title: string
|
|
@@ -28,11 +30,11 @@ const structuredData = JSON.stringify({
|
|
|
28
30
|
<title>{fullTitle}</title>
|
|
29
31
|
<meta name="generator" content={Astro.generator} />
|
|
30
32
|
<meta name="description" content={description} />
|
|
31
|
-
{noindex && <meta name="robots" content=
|
|
33
|
+
{(deployment.preview || noindex) && <meta name="robots" content={deployment.preview ? docsPreviewRobots : 'noindex'} />}
|
|
32
34
|
<link rel="icon" type="image/svg+xml" href={withBase('/favicon.svg', base)} />
|
|
33
35
|
<link rel="stylesheet" href={withBase('/_nimbus/shiki.css', base)} />
|
|
34
36
|
<link rel="canonical" href={canonical} />
|
|
35
|
-
<link rel="sitemap" href={withBase('/sitemap-index.xml', base)} />
|
|
37
|
+
{!deployment.preview && <link rel="sitemap" href={withBase('/sitemap-index.xml', base)} />}
|
|
36
38
|
{markdownUrl && <link rel="alternate" type="text/markdown" href={new URL(withBase(markdownUrl, base), Astro.site)} />}
|
|
37
39
|
<meta property="og:title" content={fullTitle} />
|
|
38
40
|
<meta property="og:type" content="article" />
|
|
@@ -31,6 +31,6 @@ pnpm build
|
|
|
31
31
|
pnpm preview
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
The build writes `dist/` and creates the search index. Set
|
|
34
|
+
The build writes `dist/` and creates the search index. Set channel origins in `src/lib/deployment.ts` before publishing.
|
|
35
35
|
|
|
36
36
|
Continue with the [writing guide](/writing/).
|
|
@@ -5,6 +5,7 @@ import { config } from 'virtual:nimbus/config'
|
|
|
5
5
|
import Head from '../components/head.astro'
|
|
6
6
|
import Search from '../components/search/index.astro'
|
|
7
7
|
import Sidebar from '../components/sidebar.astro'
|
|
8
|
+
import { deployment } from '../lib/deployment'
|
|
8
9
|
import { labels } from '../lib/locale'
|
|
9
10
|
import '../styles/site.css'
|
|
10
11
|
|
|
@@ -13,6 +14,9 @@ const { title, description, sidebar, headings, markdownUrl, chinese, alternate,
|
|
|
13
14
|
const text = labels[chinese ? 'zh' : 'en']
|
|
14
15
|
const base = import.meta.env.BASE_URL
|
|
15
16
|
const indexUrl = withBase(chinese ? '/zh/llms.txt' : '/llms.txt', base)
|
|
17
|
+
const searchableContent = !draft && (searchable === true || (searchable !== false && !noindex))
|
|
18
|
+
const englishPath = chinese ? withBase(alternate, base) : Astro.url.pathname
|
|
19
|
+
const chinesePath = chinese ? Astro.url.pathname : withBase(alternate, base)
|
|
16
20
|
---
|
|
17
21
|
|
|
18
22
|
<!doctype html>
|
|
@@ -21,11 +25,20 @@ const indexUrl = withBase(chinese ? '/zh/llms.txt' : '/llms.txt', base)
|
|
|
21
25
|
<meta charset="utf-8" />
|
|
22
26
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
23
27
|
<Head title={title} description={description} markdownUrl={markdownUrl} noindex={noindex || draft} chinese={chinese} />
|
|
24
|
-
<link rel="alternate" hreflang=
|
|
28
|
+
<link rel="alternate" hreflang="en" href={new URL(englishPath, Astro.site)} />
|
|
29
|
+
<link rel="alternate" hreflang="zh-CN" href={new URL(chinesePath, Astro.site)} />
|
|
30
|
+
<link rel="alternate" hreflang="x-default" href={new URL(englishPath, Astro.site)} />
|
|
25
31
|
<link rel="alternate" type="text/plain" href={indexUrl} title={text.index} />
|
|
26
32
|
</head>
|
|
27
33
|
<body>
|
|
28
34
|
<a class="skip-link" href="#main-content">{text.skip}</a>
|
|
35
|
+
{deployment.preview && (
|
|
36
|
+
<aside class="docs-preview-notice" data-pagefind-ignore aria-label={text.previewLabel}>
|
|
37
|
+
{text.previewNotice}
|
|
38
|
+
{' '}
|
|
39
|
+
<a href={new URL(withBase(chinese ? '/zh/' : '/', base), deployment.stableOrigin)}>{text.stableDocs}</a>
|
|
40
|
+
</aside>
|
|
41
|
+
)}
|
|
29
42
|
<header class="site-header">
|
|
30
43
|
<a class="brand" href={withBase(chinese ? '/zh/' : '/', base)}>{config.title}</a>
|
|
31
44
|
<a class="language-link" href={withBase(alternate, base)} lang={chinese ? 'en' : 'zh-CN'}>{chinese ? 'English' : '简体中文'}</a>
|
|
@@ -40,7 +53,7 @@ const indexUrl = withBase(chinese ? '/zh/llms.txt' : '/llms.txt', base)
|
|
|
40
53
|
<a class="index-link" href={indexUrl}>llms.txt ↗</a>
|
|
41
54
|
</aside>
|
|
42
55
|
<main id="main-content" tabindex="-1">
|
|
43
|
-
<div data-pagefind-body={
|
|
56
|
+
<div data-pagefind-body={searchableContent ? '' : undefined} data-pagefind-ignore={searchableContent ? undefined : ''}>
|
|
44
57
|
<h1>{title}</h1>
|
|
45
58
|
{description && <p class="description">{description}</p>}
|
|
46
59
|
<article><slot /></article>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AstroIntegration } from 'astro'
|
|
2
|
+
import type { DocsContext } from 'repoctl/docs-context'
|
|
3
|
+
import { readFile, writeFile } from 'node:fs/promises'
|
|
4
|
+
import { mergeDocsHeaders } from 'repoctl/docs-context'
|
|
5
|
+
|
|
6
|
+
/** Run after Nimbus so its discovery headers remain present in either channel. */
|
|
7
|
+
export function docsChannel(context: DocsContext): AstroIntegration {
|
|
8
|
+
return {
|
|
9
|
+
name: 'repoctl-docs-channel',
|
|
10
|
+
hooks: {
|
|
11
|
+
'astro:config:done': ({ config }) => {
|
|
12
|
+
if (!config.site || new URL(config.site).origin !== context.origin) {
|
|
13
|
+
throw new Error('Resolved Nimbus site differs from the documentation channel origin')
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
'astro:build:done': async ({ dir }) => {
|
|
17
|
+
const filename = new URL('_headers', dir)
|
|
18
|
+
const existing = await readFile(filename, 'utf8').catch((error: NodeJS.ErrnoException) => {
|
|
19
|
+
if (error.code !== 'ENOENT') {
|
|
20
|
+
throw error
|
|
21
|
+
}
|
|
22
|
+
return ''
|
|
23
|
+
})
|
|
24
|
+
await writeFile(filename, mergeDocsHeaders(existing, context))
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import process from 'node:process'
|
|
2
|
+
import { resolveDocsContext } from 'repoctl/docs-context'
|
|
3
|
+
|
|
4
|
+
// Configure distinct origins here; Astro's base option owns any path prefix.
|
|
5
|
+
export const deployment = resolveDocsContext({
|
|
6
|
+
channel: process.env.REPO_DOCS_CHANNEL,
|
|
7
|
+
url: process.env.REPO_DOCS_URL,
|
|
8
|
+
previewOrigin: 'https://preview.docs.example.com',
|
|
9
|
+
stableOrigin: 'https://docs.example.com',
|
|
10
|
+
})
|
|
@@ -24,6 +24,9 @@ export function localizeSidebar(items: SidebarItem[], chinese: boolean): Sidebar
|
|
|
24
24
|
|
|
25
25
|
export const labels = {
|
|
26
26
|
en: {
|
|
27
|
+
previewLabel: 'Documentation preview',
|
|
28
|
+
previewNotice: 'Development documentation includes unreleased changes.',
|
|
29
|
+
stableDocs: 'Read the stable documentation',
|
|
27
30
|
navigation: 'On this site',
|
|
28
31
|
contents: 'On this page',
|
|
29
32
|
skip: 'Skip to content',
|
|
@@ -36,6 +39,9 @@ export const labels = {
|
|
|
36
39
|
index: 'Documentation index',
|
|
37
40
|
},
|
|
38
41
|
zh: {
|
|
42
|
+
previewLabel: '文档预览',
|
|
43
|
+
previewNotice: '开发版文档,包含尚未发布的功能。',
|
|
44
|
+
stableDocs: '查看正式版文档',
|
|
39
45
|
navigation: '站点导航',
|
|
40
46
|
contents: '本页目录',
|
|
41
47
|
skip: '跳转到正文',
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { withBase } from '@cloudflare/nimbus-docs/runtime'
|
|
2
|
-
import {
|
|
2
|
+
import { docsRobots } from 'repoctl/docs-context'
|
|
3
|
+
import { deployment } from '../lib/deployment'
|
|
3
4
|
|
|
4
5
|
export const prerender = true
|
|
5
6
|
|
|
6
7
|
export function GET() {
|
|
7
|
-
const body =
|
|
8
|
-
'User-agent: *',
|
|
9
|
-
'Allow: /',
|
|
10
|
-
'',
|
|
11
|
-
`Sitemap: ${new URL(withBase('/sitemap-index.xml', import.meta.env.BASE_URL), config.site).href}`,
|
|
12
|
-
'',
|
|
13
|
-
].join('\n')
|
|
8
|
+
const body = docsRobots(deployment, new URL(withBase('/sitemap-index.xml', import.meta.env.BASE_URL), deployment.origin).href)
|
|
14
9
|
|
|
15
10
|
return new Response(body, {
|
|
16
11
|
headers: { 'Content-Type': 'text/plain; charset=utf-8' },
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://turborepo.com/schema.json",
|
|
3
|
+
"extends": [
|
|
4
|
+
"//"
|
|
5
|
+
],
|
|
6
|
+
"tasks": {
|
|
7
|
+
"build": {
|
|
8
|
+
"env": [
|
|
9
|
+
"$TURBO_EXTENDS$",
|
|
10
|
+
"REPO_DOCS_CHANNEL",
|
|
11
|
+
"REPO_DOCS_URL"
|
|
12
|
+
],
|
|
13
|
+
"inputs": [
|
|
14
|
+
"$TURBO_DEFAULT$"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"lint": {
|
|
18
|
+
"env": [
|
|
19
|
+
"$TURBO_EXTENDS$",
|
|
20
|
+
"REPO_DOCS_CHANNEL",
|
|
21
|
+
"REPO_DOCS_URL"
|
|
22
|
+
],
|
|
23
|
+
"inputs": [
|
|
24
|
+
"$TURBO_DEFAULT$"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"typecheck": {
|
|
28
|
+
"env": [
|
|
29
|
+
"$TURBO_EXTENDS$",
|
|
30
|
+
"REPO_DOCS_CHANNEL",
|
|
31
|
+
"REPO_DOCS_URL"
|
|
32
|
+
],
|
|
33
|
+
"inputs": [
|
|
34
|
+
"$TURBO_DEFAULT$"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"test": {
|
|
38
|
+
"env": [
|
|
39
|
+
"$TURBO_EXTENDS$",
|
|
40
|
+
"REPO_DOCS_CHANNEL",
|
|
41
|
+
"REPO_DOCS_URL"
|
|
42
|
+
],
|
|
43
|
+
"inputs": [
|
|
44
|
+
"$TURBO_DEFAULT$"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
"private": true,
|
|
6
6
|
"description": "React component library with explicit JavaScript, types and CSS exports",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"sideEffects": [
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"**/*.css"
|
|
10
|
+
],
|
|
9
11
|
"exports": {
|
|
10
12
|
".": {
|
|
11
13
|
"types": "./dist/index.d.ts",
|
|
@@ -15,8 +17,14 @@
|
|
|
15
17
|
},
|
|
16
18
|
"main": "./dist/index.js",
|
|
17
19
|
"types": "./dist/index.d.ts",
|
|
18
|
-
"files": [
|
|
19
|
-
|
|
20
|
+
"files": [
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"README.md",
|
|
23
|
+
"dist"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": "^22.23.4 || ^24.22.1 || >=26.12.1"
|
|
27
|
+
},
|
|
20
28
|
"scripts": {
|
|
21
29
|
"build": "vite build",
|
|
22
30
|
"lint": "eslint . && stylelint \"src/**/*.css\"",
|
|
@@ -9,7 +9,7 @@ import { mermaidMarkdown } from './mermaid/markdown'
|
|
|
9
9
|
import { createNav, createSidebars } from './navigation/routes'
|
|
10
10
|
import { createPageHead } from './seo'
|
|
11
11
|
|
|
12
|
-
const deployment = getDocsDeployment(process.env.REPO_DOCS_CHANNEL)
|
|
12
|
+
const deployment = getDocsDeployment(process.env.REPO_DOCS_CHANNEL, process.env.REPO_DOCS_URL)
|
|
13
13
|
|
|
14
14
|
export default defineConfig<DocsThemeConfig>({
|
|
15
15
|
outDir: '.vitepress/dist',
|
|
@@ -1,37 +1,23 @@
|
|
|
1
|
+
import type { DocsContext } from 'repoctl/docs-context'
|
|
1
2
|
import type { DefaultTheme } from 'vitepress'
|
|
3
|
+
import { docsRobots, mergeDocsHeaders, resolveDocsContext } from 'repoctl/docs-context'
|
|
2
4
|
|
|
3
5
|
export const stableOrigin = 'https://repo.icebreaker.top'
|
|
4
6
|
export const previewOrigin = 'https://next.repo.icebreaker.top'
|
|
5
7
|
|
|
6
|
-
export
|
|
7
|
-
channel: 'preview' | 'stable'
|
|
8
|
-
preview: boolean
|
|
9
|
-
origin: string
|
|
10
|
-
}
|
|
8
|
+
export type DocsDeployment = DocsContext
|
|
11
9
|
|
|
12
10
|
export interface DocsThemeConfig extends DefaultTheme.Config {
|
|
13
11
|
docsPreview?: boolean
|
|
14
12
|
}
|
|
15
13
|
|
|
16
|
-
export function getDocsDeployment(channel: string | undefined): DocsDeployment {
|
|
17
|
-
|
|
18
|
-
throw new Error(`Unsupported documentation channel: ${channel}`)
|
|
19
|
-
}
|
|
20
|
-
const preview = channel !== 'stable'
|
|
21
|
-
return {
|
|
22
|
-
channel: preview ? 'preview' : 'stable',
|
|
23
|
-
preview,
|
|
24
|
-
origin: preview ? previewOrigin : stableOrigin,
|
|
25
|
-
}
|
|
14
|
+
export function getDocsDeployment(channel: string | undefined, url?: string): DocsDeployment {
|
|
15
|
+
return resolveDocsContext({ channel, url, previewOrigin, stableOrigin })
|
|
26
16
|
}
|
|
27
17
|
|
|
28
18
|
export function crawlerFiles(deployment: DocsDeployment) {
|
|
29
19
|
return {
|
|
30
|
-
robots: deployment
|
|
31
|
-
|
|
32
|
-
: `User-agent: *\nAllow: /\nDisallow: /_headers\n\nSitemap: ${stableOrigin}/sitemap.xml\n`,
|
|
33
|
-
headers: deployment.preview
|
|
34
|
-
? '/*\n X-Robots-Tag: noindex, nofollow, noarchive\n'
|
|
35
|
-
: '',
|
|
20
|
+
robots: docsRobots(deployment),
|
|
21
|
+
headers: mergeDocsHeaders('', deployment),
|
|
36
22
|
}
|
|
37
23
|
}
|