docs-util: add tool to generate mapping between JS SDK examples and routes (#11933)

* initial implementation

* finish implementation

* add js sdk key
This commit is contained in:
Shahed Nasser
2025-03-21 15:34:52 +02:00
committed by GitHub
parent 834b309037
commit df5ae50612
11 changed files with 1025 additions and 3 deletions
@@ -5,6 +5,7 @@ import { GitManager } from "../classes/helpers/git-manager.js"
import { CommonCliOptions } from "../types/index.js"
import OasGenerator from "../classes/generators/oas.js"
import DmlGenerator from "../classes/generators/dml.js"
import RouteExamplesGenerator from "../classes/generators/route-examples.js"
export default async function runGitChanges({
type,
@@ -53,5 +54,14 @@ export default async function runGitChanges({
await dmlGenerator.run()
}
if (type === "all" || type === "route-examples") {
const routeExamplesGenerator = new RouteExamplesGenerator({
paths: files,
...options,
})
await routeExamplesGenerator.run()
}
console.log(`Finished generating docs for ${files.length} files.`)
}
@@ -6,6 +6,7 @@ import OasGenerator from "../classes/generators/oas.js"
import { CommonCliOptions } from "../types/index.js"
import { GitManager } from "../classes/helpers/git-manager.js"
import DmlGenerator from "../classes/generators/dml.js"
import RouteExamplesGenerator from "../classes/generators/route-examples.js"
export default async function (
commitSha: string,
@@ -61,5 +62,14 @@ export default async function (
await dmlGenerator.run()
}
if (type === "all" || type === "route-examples") {
const routeExamplesGenerator = new RouteExamplesGenerator({
paths: filteredFiles,
...options,
})
await routeExamplesGenerator.run()
}
console.log(`Finished generating docs for ${filteredFiles.length} files.`)
}
@@ -6,6 +6,7 @@ import { GitManager } from "../classes/helpers/git-manager.js"
import OasGenerator from "../classes/generators/oas.js"
import { CommonCliOptions } from "../types/index.js"
import DmlGenerator from "../classes/generators/dml.js"
import RouteExamplesGenerator from "../classes/generators/route-examples.js"
export default async function ({ type, tag, ...options }: CommonCliOptions) {
const gitManager = new GitManager()
@@ -59,5 +60,14 @@ export default async function ({ type, tag, ...options }: CommonCliOptions) {
await dmlGenerator.run()
}
if (type === "all" || type === "route-examples") {
const routeExamplesGenerator = new RouteExamplesGenerator({
paths: filteredFiles,
...options,
})
await routeExamplesGenerator.run()
}
console.log(`Finished generating docs for ${filteredFiles.length} files.`)
}
@@ -2,6 +2,7 @@ import DmlGenerator from "../classes/generators/dml.js"
import DocblockGenerator from "../classes/generators/docblock.js"
import { Options } from "../classes/generators/index.js"
import OasGenerator from "../classes/generators/oas.js"
import RouteExamplesGenerator from "../classes/generators/route-examples.js"
import { CommonCliOptions } from "../types/index.js"
export default async function run(
@@ -37,5 +38,14 @@ export default async function run(
await dmlGenerator.run()
}
if (type === "all" || type === "route-examples") {
const routeExamplesGenerator = new RouteExamplesGenerator({
paths,
...options,
})
await routeExamplesGenerator.run()
}
console.log(`Finished running.`)
}