create-thally-docs 0.7.6 → 0.7.8
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.
|
@@ -29,6 +29,14 @@ function readExistingConfig(projectDir) {
|
|
|
29
29
|
if (!existsSync(configPath)) return void 0;
|
|
30
30
|
return JSON.parse(readFileSync(configPath, "utf8"));
|
|
31
31
|
}
|
|
32
|
+
function resetFreshMigrationContent(projectDir) {
|
|
33
|
+
const contentDirectory = projectPath(projectDir, "src/content");
|
|
34
|
+
rmSync(contentDirectory, { recursive: true, force: true });
|
|
35
|
+
mkdirSync(contentDirectory, { recursive: true });
|
|
36
|
+
for (const sampleSpec of ["openapi.yaml", "openapi.json"]) {
|
|
37
|
+
rmSync(projectPath(projectDir, sampleSpec), { force: true });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
32
40
|
async function discoverMigration(options) {
|
|
33
41
|
const url = new URL(options.sourceUrl);
|
|
34
42
|
if (url.hostname.toLowerCase() !== "github.com") {
|
|
@@ -65,6 +73,7 @@ async function migrateDocs(options) {
|
|
|
65
73
|
repoUrl: bundle.sourceKind === "repository" ? options.sourceUrl : "",
|
|
66
74
|
doInstall: false
|
|
67
75
|
});
|
|
76
|
+
resetFreshMigrationContent(projectDir);
|
|
68
77
|
} else if (!existsSync(projectDir)) {
|
|
69
78
|
throw new Error(`Project directory "${projectDir}" does not exist. Use without --into to scaffold a new one.`);
|
|
70
79
|
}
|
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-CGTL5Q5E.js";
|
|
5
5
|
import {
|
|
6
6
|
logo,
|
|
7
7
|
readDocsJson,
|
|
@@ -255,7 +255,7 @@ function pageIdToPath(pageId, secondaryLocales) {
|
|
|
255
255
|
return locale ? `/${locale}${basePath === "/" ? "" : basePath}` : basePath;
|
|
256
256
|
}
|
|
257
257
|
function validateOpenApi(projectDir, source, issues) {
|
|
258
|
-
const specPath = join(projectDir, source);
|
|
258
|
+
const specPath = source.startsWith("/") ? join(projectDir, "public", source.slice(1)) : join(projectDir, source);
|
|
259
259
|
if (!existsSync(specPath)) {
|
|
260
260
|
issues.push({ severity: "error", message: `API reference points at "${source}" but the file does not exist`, file: source });
|
|
261
261
|
return;
|
|
@@ -313,11 +313,11 @@ async function runCheck(projectDir, options) {
|
|
|
313
313
|
const navPageIds = /* @__PURE__ */ new Set();
|
|
314
314
|
const duplicates = /* @__PURE__ */ new Set();
|
|
315
315
|
for (const tab of config.tabs) {
|
|
316
|
-
if (tab.href) {
|
|
316
|
+
if (tab.href && (!tab.groups || tab.groups.length === 0)) {
|
|
317
317
|
if (tab.href.startsWith("/")) navPageIds.add(tab.href.slice(1) || "introduction");
|
|
318
318
|
continue;
|
|
319
319
|
}
|
|
320
|
-
if (tab.api) continue;
|
|
320
|
+
if (tab.api && tab.api.navigation !== false) continue;
|
|
321
321
|
if (!tab.groups || tab.groups.length === 0) {
|
|
322
322
|
issues.push({ severity: "error", message: `Tab "${tab.tab}" has no groups and no href \u2014 it will render empty` });
|
|
323
323
|
continue;
|
|
@@ -367,7 +367,9 @@ async function runCheck(projectDir, options) {
|
|
|
367
367
|
const rel2 = relative(projectDir, filePath);
|
|
368
368
|
if (!data.title) issues.push({ severity: "warning", message: `Missing "title" in frontmatter`, file: rel2 });
|
|
369
369
|
if (!data.description) issues.push({ severity: "warning", message: `Missing "description" in frontmatter`, file: rel2 });
|
|
370
|
-
if (
|
|
370
|
+
if (typeof data.openapi !== "string" && content.trim().length < 50) {
|
|
371
|
+
issues.push({ severity: "warning", message: `Very short body (${content.trim().length} chars) \u2014 page may be empty`, file: rel2 });
|
|
372
|
+
}
|
|
371
373
|
if (options.drift) checkDrift(projectDir, rel2, data, issues);
|
|
372
374
|
const path = pageIdToPath(pageId, secondaryLocales);
|
|
373
375
|
const anchors = extractHeadingAnchors(content);
|
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.7.
|
|
3
|
+
"version": "0.7.8",
|
|
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.1.
|
|
31
|
+
"@thallylabs/migrate": "0.1.2",
|
|
32
32
|
"gray-matter": "^4.0.3",
|
|
33
33
|
"p-limit": "^6.1.0",
|
|
34
34
|
"tar": "^6.2.0",
|