create-thally-docs 0.10.79 → 0.10.80
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.
|
@@ -23,9 +23,11 @@ import { setImmediate } from "timers/promises";
|
|
|
23
23
|
import { basename, dirname, isAbsolute, join as join2, relative, resolve, sep } from "path";
|
|
24
24
|
import {
|
|
25
25
|
cloneGitHubRepository,
|
|
26
|
+
importSourceRef,
|
|
26
27
|
hydrateRemoteApiSpecs,
|
|
27
28
|
migrateUrl,
|
|
28
|
-
parseGitHubRepositoryUrl
|
|
29
|
+
parseGitHubRepositoryUrl,
|
|
30
|
+
sourceRefOversizeReason
|
|
29
31
|
} from "@thallylabs/migrate";
|
|
30
32
|
|
|
31
33
|
// src/migration-work.ts
|
|
@@ -163,9 +165,29 @@ function resetFreshMigrationContent(projectDir) {
|
|
|
163
165
|
rmSync(projectPath(projectDir, sampleSpec), { force: true });
|
|
164
166
|
}
|
|
165
167
|
}
|
|
168
|
+
async function fetchSourceRefs(mappings, warnings) {
|
|
169
|
+
const imports = [];
|
|
170
|
+
for (const mapping of mappings) {
|
|
171
|
+
const root = mkdtempSync(join2(tmpdir(), "thally-source-ref-"));
|
|
172
|
+
try {
|
|
173
|
+
const source = parseGitHubRepositoryUrl(`https://github.com/${mapping.repo}`);
|
|
174
|
+
const tooLarge = await sourceRefOversizeReason(mapping.repo);
|
|
175
|
+
if (tooLarge) throw new Error(tooLarge);
|
|
176
|
+
const cloneDir = join2(root, "repository");
|
|
177
|
+
await cloneGitHubRepository(source, cloneDir, warnings, { skipSubmodules: true });
|
|
178
|
+
imports.push(importSourceRef(mapping, cloneDir));
|
|
179
|
+
} catch (error) {
|
|
180
|
+
warnings.push({ code: "fetch-failed", message: `sourceRef ${mapping.repo} was not imported: ${error instanceof Error ? error.message : String(error)}` });
|
|
181
|
+
} finally {
|
|
182
|
+
rmSync(root, { recursive: true, force: true });
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return imports;
|
|
186
|
+
}
|
|
166
187
|
async function discoverMigration(options) {
|
|
167
188
|
const url = new URL(options.sourceUrl);
|
|
168
189
|
if (url.hostname.toLowerCase() !== "github.com") {
|
|
190
|
+
if (options.sourceRefs?.length) terminal.warn("--source-ref applies only to GitHub repository sources and was ignored.");
|
|
169
191
|
return terminal.step("Discovering public documentation", () => {
|
|
170
192
|
const discovery = {
|
|
171
193
|
sourceUrl: options.sourceUrl,
|
|
@@ -182,7 +204,9 @@ async function discoverMigration(options) {
|
|
|
182
204
|
try {
|
|
183
205
|
const cloneWarnings = [];
|
|
184
206
|
await terminal.step(`Cloning ${source.owner}/${source.repo}`, () => cloneGitHubRepository(source, cloneDir, cloneWarnings), "Source repository cloned");
|
|
207
|
+
const sourceRefs = options.sourceRefs?.length ? await terminal.step("Importing sourceRef repositories", () => fetchSourceRefs(options.sourceRefs ?? [], cloneWarnings), "sourceRef repositories imported") : [];
|
|
185
208
|
const bundle = await terminal.step("Converting repository documentation", () => convertRepository({
|
|
209
|
+
sourceRefs,
|
|
186
210
|
repositoryDir: cloneDir,
|
|
187
211
|
sourceUrl: options.sourceUrl,
|
|
188
212
|
docsDir: options.docsDir ?? (source.docsDir || void 0),
|
|
@@ -293,6 +317,7 @@ async function migrateDocs(options) {
|
|
|
293
317
|
pages: bundle.pages.length,
|
|
294
318
|
assets: bundle.assets.length,
|
|
295
319
|
components: bundle.componentFiles?.length ?? 0,
|
|
320
|
+
sourceRefs: bundle.sourceRefs ?? [],
|
|
296
321
|
quarantined: quarantinedPages,
|
|
297
322
|
quarantinedAssets: (bundle.quarantinedFiles?.length ?? 0) - quarantinedPages,
|
|
298
323
|
droppedGatedPages: bundle.droppedGatedPages ?? 0,
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
migrateDocs
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-VGE5L66Z.js";
|
|
5
5
|
import {
|
|
6
6
|
parseFrontmatter,
|
|
7
7
|
runCheck
|
|
@@ -268,7 +268,7 @@ async function gatherAnswers(dirArg, useDefaults, installPreference) {
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
// src/index.ts
|
|
271
|
-
import { parseGitHubRepositoryUrl as parseGitHubRepositoryUrl2 } from "@thallylabs/migrate";
|
|
271
|
+
import { parseGitHubRepositoryUrl as parseGitHubRepositoryUrl2, parseSourceRefFlags } from "@thallylabs/migrate";
|
|
272
272
|
|
|
273
273
|
// src/translate.ts
|
|
274
274
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
@@ -690,7 +690,8 @@ var valueFlags = /* @__PURE__ */ new Set([
|
|
|
690
690
|
"--max-pages",
|
|
691
691
|
"--model",
|
|
692
692
|
"--pages",
|
|
693
|
-
"--platform"
|
|
693
|
+
"--platform",
|
|
694
|
+
"--source-ref"
|
|
694
695
|
]);
|
|
695
696
|
var commandFlags = {
|
|
696
697
|
scaffold: /* @__PURE__ */ new Set(["--help", "-h", "--yes", "-y", "--install", "--no-install", "--verbose"]),
|
|
@@ -704,6 +705,7 @@ var commandFlags = {
|
|
|
704
705
|
"--max-pages",
|
|
705
706
|
"--platform",
|
|
706
707
|
"--skip-validation",
|
|
708
|
+
"--source-ref",
|
|
707
709
|
"--verbose",
|
|
708
710
|
"--yes",
|
|
709
711
|
"-y"
|
|
@@ -752,6 +754,8 @@ Options:
|
|
|
752
754
|
--docs-dir <path> Override the detected documentation directory
|
|
753
755
|
--max-pages <count> Limit a public URL crawl to 1-1000 pages
|
|
754
756
|
--platform <name> Use mintlify, docusaurus, fern, or auto
|
|
757
|
+
--source-ref <owner/repo>=<path>
|
|
758
|
+
Import a Mintlify sourceRef repository under <path> (repeatable)
|
|
755
759
|
--skip-validation Import only; explicitly skip content and build verification
|
|
756
760
|
--verbose Show detailed installation, build, and Git output
|
|
757
761
|
--api-key <key> Anthropic API key for non-Markdown conversion
|
|
@@ -867,6 +871,20 @@ async function runMigrateCommand() {
|
|
|
867
871
|
if (branch) terminal.detail("Branch", branch);
|
|
868
872
|
if (docsDir) terminal.detail("Docs dir", docsDir);
|
|
869
873
|
terminal.detail("Platform", platform ?? "auto-detect");
|
|
874
|
+
let sourceRefs;
|
|
875
|
+
try {
|
|
876
|
+
const sourceRefValues = args.flatMap((arg, index) => {
|
|
877
|
+
if (arg !== "--source-ref") return [];
|
|
878
|
+
const value = args[index + 1];
|
|
879
|
+
if (value === void 0 || value.startsWith("-")) throw new Error("--source-ref needs a value such as owner/repo=client-sdks/typescript.");
|
|
880
|
+
return [value];
|
|
881
|
+
});
|
|
882
|
+
sourceRefs = parseSourceRefFlags(sourceRefValues);
|
|
883
|
+
} catch (err) {
|
|
884
|
+
console.error(`
|
|
885
|
+
\u274C ${err instanceof Error ? err.message : err}`);
|
|
886
|
+
process.exit(1);
|
|
887
|
+
}
|
|
870
888
|
const result = await migrateDocs({
|
|
871
889
|
sourceUrl,
|
|
872
890
|
projectDir,
|
|
@@ -877,7 +895,8 @@ async function runMigrateCommand() {
|
|
|
877
895
|
maxPages,
|
|
878
896
|
platform,
|
|
879
897
|
yes,
|
|
880
|
-
skipValidation: flags.includes("--skip-validation")
|
|
898
|
+
skipValidation: flags.includes("--skip-validation"),
|
|
899
|
+
sourceRefs
|
|
881
900
|
});
|
|
882
901
|
terminal.section("Migration summary", [
|
|
883
902
|
`${result.pagesWritten} pages \xB7 ${result.assetsWritten} assets \xB7 ${result.platform}`,
|
package/dist/migrate/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MigrationPlatform, MigrationFetcher, MigrationBundle, MigrationWarning } from '@thallylabs/migrate';
|
|
1
|
+
import { MigrationPlatform, MigrationFetcher, SourceRefMapping, MigrationBundle, MigrationWarning } from '@thallylabs/migrate';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Validate authored navigation and links against the routes the runtime can
|
|
@@ -42,6 +42,8 @@ interface MigrateOptions {
|
|
|
42
42
|
fetcher?: MigrationFetcher;
|
|
43
43
|
/** Explicitly opt out of content/build gates; the report remains unverified. */
|
|
44
44
|
skipValidation?: boolean;
|
|
45
|
+
/** Mintlify `sourceRef` repositories to import, from `--source-ref owner/repo=<path>`. */
|
|
46
|
+
sourceRefs?: Array<SourceRefMapping>;
|
|
45
47
|
}
|
|
46
48
|
interface MigrateResult {
|
|
47
49
|
pagesWritten: number;
|
package/dist/migrate/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-thally-docs",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.80",
|
|
4
4
|
"description": "Scaffold an open-source Thally docs site for people, search engines, and AI tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@clack/prompts": "^0.11.0",
|
|
51
51
|
"@inquirer/prompts": "^7.0.0",
|
|
52
52
|
"@thallylabs/core": "0.2.11",
|
|
53
|
-
"@thallylabs/migrate": "0.2.
|
|
53
|
+
"@thallylabs/migrate": "0.2.25",
|
|
54
54
|
"p-limit": "^6.1.0",
|
|
55
55
|
"remark-mdx": "^3.1.1",
|
|
56
56
|
"remark-parse": "^11.0.0",
|