create-thally-docs 0.7.8 → 0.8.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/README.md
CHANGED
|
@@ -44,6 +44,11 @@ interactive question explicitly.
|
|
|
44
44
|
| `create-thally-docs check [dir] [--fix]` | Lint content for orphan pages and missing frontmatter |
|
|
45
45
|
| `create-thally-docs translate --locale <code>` | Translate content into another locale |
|
|
46
46
|
|
|
47
|
+
Interactive migrations ask whether the source is Mintlify, Docusaurus, or
|
|
48
|
+
another auto-detected platform. For scripts and CI, pass
|
|
49
|
+
`--platform mintlify`, `--platform docusaurus`, or `--platform auto`; `--yes`
|
|
50
|
+
keeps backward-compatible auto-detection when no platform flag is supplied.
|
|
51
|
+
|
|
47
52
|
Prefer a single binary? Install [`@thallylabs/cli`](https://www.npmjs.com/package/@thallylabs/cli)
|
|
48
53
|
and use `thally init`, which delegates here.
|
|
49
54
|
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
initGit,
|
|
4
4
|
installDeps,
|
|
5
5
|
scaffold
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5GIGIHI5.js";
|
|
7
7
|
|
|
8
8
|
// src/migrate/index.ts
|
|
9
9
|
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
@@ -41,7 +41,12 @@ async function discoverMigration(options) {
|
|
|
41
41
|
const url = new URL(options.sourceUrl);
|
|
42
42
|
if (url.hostname.toLowerCase() !== "github.com") {
|
|
43
43
|
console.log(` \u{1F310} Discovering public docs at ${url.origin}${url.pathname}...`);
|
|
44
|
-
return migrateUrl({
|
|
44
|
+
return migrateUrl({
|
|
45
|
+
sourceUrl: options.sourceUrl,
|
|
46
|
+
platform: options.platform,
|
|
47
|
+
maxPages: options.maxPages,
|
|
48
|
+
fetcher: options.fetcher
|
|
49
|
+
});
|
|
45
50
|
}
|
|
46
51
|
const source = parseGitHubRepositoryUrl(options.sourceUrl);
|
|
47
52
|
if (options.branch) source.branch = options.branch;
|
|
@@ -53,7 +58,8 @@ async function discoverMigration(options) {
|
|
|
53
58
|
return migrateRepository({
|
|
54
59
|
repositoryDir: cloneDir,
|
|
55
60
|
sourceUrl: options.sourceUrl,
|
|
56
|
-
docsDir: options.docsDir ?? (source.docsDir || void 0)
|
|
61
|
+
docsDir: options.docsDir ?? (source.docsDir || void 0),
|
|
62
|
+
platform: options.platform
|
|
57
63
|
});
|
|
58
64
|
} finally {
|
|
59
65
|
rmSync(temporaryRoot, { recursive: true, force: true });
|
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-PZBQS5ZR.js";
|
|
5
5
|
import {
|
|
6
6
|
logo,
|
|
7
7
|
readDocsJson,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
slugify,
|
|
10
10
|
success,
|
|
11
11
|
writeDocsJson
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-5GIGIHI5.js";
|
|
13
13
|
|
|
14
14
|
// src/index.ts
|
|
15
15
|
import { existsSync as existsSync3, readdirSync as readdirSync2 } from "fs";
|
|
@@ -17,8 +17,25 @@ import { resolve as resolve2 } from "path";
|
|
|
17
17
|
|
|
18
18
|
// src/prompts.ts
|
|
19
19
|
import { input, select } from "@inquirer/prompts";
|
|
20
|
-
import { basename } from "path";
|
|
21
|
-
|
|
20
|
+
import { basename, resolve } from "path";
|
|
21
|
+
function parseMigrationPlatform(value) {
|
|
22
|
+
if (!value || value === "auto") return void 0;
|
|
23
|
+
if (value === "mintlify" || value === "docusaurus") return value;
|
|
24
|
+
throw new Error("--platform must be mintlify, docusaurus, or auto.");
|
|
25
|
+
}
|
|
26
|
+
async function gatherMigrationPlatform(value, useDefaults) {
|
|
27
|
+
const configured = parseMigrationPlatform(value);
|
|
28
|
+
if (configured || value === "auto" || useDefaults) return configured;
|
|
29
|
+
return select({
|
|
30
|
+
message: " Which platform currently hosts these docs?",
|
|
31
|
+
choices: [
|
|
32
|
+
{ name: "Mintlify", value: "mintlify" },
|
|
33
|
+
{ name: "Docusaurus", value: "docusaurus" },
|
|
34
|
+
{ name: "Other / detect automatically", value: void 0 }
|
|
35
|
+
],
|
|
36
|
+
default: "mintlify"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
22
39
|
async function gatherAnswers(dirArg, useDefaults, installPreference) {
|
|
23
40
|
let projectDir;
|
|
24
41
|
if (dirArg) {
|
|
@@ -692,8 +709,10 @@ var valueFlags = /* @__PURE__ */ new Set([
|
|
|
692
709
|
"--docs-dir",
|
|
693
710
|
"--into",
|
|
694
711
|
"--locale",
|
|
712
|
+
"--max-pages",
|
|
695
713
|
"--model",
|
|
696
|
-
"--pages"
|
|
714
|
+
"--pages",
|
|
715
|
+
"--platform"
|
|
697
716
|
]);
|
|
698
717
|
var positional = [];
|
|
699
718
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -744,13 +763,14 @@ async function runMigrateCommand() {
|
|
|
744
763
|
}
|
|
745
764
|
const branch = getFlagValue("--branch");
|
|
746
765
|
const docsDir = getFlagValue("--docs-dir");
|
|
766
|
+
const yes = flags.includes("--yes") || flags.includes("-y");
|
|
767
|
+
const platform = await gatherMigrationPlatform(getFlagValue("--platform"), yes);
|
|
747
768
|
const maxPagesValue = getFlagValue("--max-pages");
|
|
748
769
|
const maxPages = maxPagesValue ? Number(maxPagesValue) : void 0;
|
|
749
770
|
if (maxPages !== void 0 && (!Number.isInteger(maxPages) || maxPages < 1 || maxPages > 1e3)) {
|
|
750
771
|
console.error("\n \u274C --max-pages must be an integer between 1 and 1000.");
|
|
751
772
|
process.exit(1);
|
|
752
773
|
}
|
|
753
|
-
const yes = flags.includes("--yes") || flags.includes("-y");
|
|
754
774
|
logo();
|
|
755
775
|
console.log(" \u{1F680} Thally Migrate");
|
|
756
776
|
console.log("");
|
|
@@ -758,6 +778,7 @@ async function runMigrateCommand() {
|
|
|
758
778
|
console.log(` Target: ${projectDir}`);
|
|
759
779
|
if (branch) console.log(` Branch: ${branch}`);
|
|
760
780
|
if (docsDir) console.log(` Docs dir: ${docsDir}`);
|
|
781
|
+
console.log(` Platform: ${platform ?? "auto-detect"}`);
|
|
761
782
|
console.log("");
|
|
762
783
|
await migrateDocs({
|
|
763
784
|
sourceUrl,
|
|
@@ -767,6 +788,7 @@ async function runMigrateCommand() {
|
|
|
767
788
|
branch,
|
|
768
789
|
docsDir,
|
|
769
790
|
maxPages,
|
|
791
|
+
platform,
|
|
770
792
|
yes
|
|
771
793
|
});
|
|
772
794
|
}
|
package/dist/migrate/index.js
CHANGED
package/dist/scaffold.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-thally-docs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Scaffold a new Thally documentation project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@anthropic-ai/sdk": "^0.36.0",
|
|
30
30
|
"@inquirer/prompts": "^7.0.0",
|
|
31
|
-
"@thallylabs/migrate": "0.
|
|
31
|
+
"@thallylabs/migrate": "0.2.0",
|
|
32
32
|
"gray-matter": "^4.0.3",
|
|
33
33
|
"p-limit": "^6.1.0",
|
|
34
34
|
"tar": "^6.2.0",
|