docs: fix missing API entries (#3111)
following up on https://discord.com/channels/859816885297741824/1162726738774720574/1211715924613275681 several things here: - `docs/api/.*json` were out-of-date — seems like fetch-api-source should run automatically? shouldn't `build-api` also override this directory? in particular, tldraw.api.json still had a ton of references to the old @tldraw/tldraw package - the main problem was that `generateApiContent` was failing silently. we were relying on Promises and this broke silently because we never handled exceptions. i got rid of the Promise as it was unnecessary and made the exceptions bubble up - two things were broken in the docs and those are fixed, so now the missing entries will resurface ### Change Type - [x] `documentation` — Changes to the documentation only[^2] --------- Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This commit is contained in:
parent
599a6cd484
commit
83544a9ea8
32 changed files with 100034 additions and 95944 deletions
|
@ -43,36 +43,34 @@ export async function createApiMarkdown() {
|
|||
packageModels.push(apiModel)
|
||||
}
|
||||
|
||||
await Promise.allSettled(
|
||||
packageModels.map(async (packageModel) => {
|
||||
const categoryName = packageModel.name.replace(`@tldraw/`, '')
|
||||
for (const packageModel of packageModels) {
|
||||
const categoryName = packageModel.name.replace(`@tldraw/`, '')
|
||||
|
||||
if (!addedCategories.has(categoryName)) {
|
||||
apiInputSection.categories!.push({
|
||||
id: categoryName,
|
||||
title: packageModel.name,
|
||||
description: '',
|
||||
groups: Object.values(APIGroup).map((title) => ({
|
||||
id: title,
|
||||
path: null,
|
||||
})),
|
||||
hero: null,
|
||||
})
|
||||
addedCategories.add(categoryName)
|
||||
}
|
||||
if (!addedCategories.has(categoryName)) {
|
||||
apiInputSection.categories!.push({
|
||||
id: categoryName,
|
||||
title: packageModel.name,
|
||||
description: '',
|
||||
groups: Object.values(APIGroup).map((title) => ({
|
||||
id: title,
|
||||
path: null,
|
||||
})),
|
||||
hero: null,
|
||||
})
|
||||
addedCategories.add(categoryName)
|
||||
}
|
||||
|
||||
const entrypoint = packageModel.entryPoints[0]
|
||||
const entrypoint = packageModel.entryPoints[0]
|
||||
|
||||
for (let j = 0; j < entrypoint.members.length; j++) {
|
||||
const item = entrypoint.members[j]
|
||||
for (let j = 0; j < entrypoint.members.length; j++) {
|
||||
const item = entrypoint.members[j]
|
||||
|
||||
const result = await getApiMarkdown(categoryName, item, j)
|
||||
const outputFileName = `${getSlug(item)}.mdx`
|
||||
nicelog(`✎ ${outputFileName}`)
|
||||
fs.writeFileSync(path.join(OUTPUT_DIR, outputFileName), result.markdown)
|
||||
}
|
||||
})
|
||||
)
|
||||
const result = await getApiMarkdown(categoryName, item, j)
|
||||
const outputFileName = `${getSlug(item)}.mdx`
|
||||
nicelog(`✎ ${outputFileName}`)
|
||||
fs.writeFileSync(path.join(OUTPUT_DIR, outputFileName), result.markdown)
|
||||
}
|
||||
}
|
||||
|
||||
// Add the API section to the sections.json file
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import path from 'path'
|
|||
import { TLDRAW_PACKAGES_TO_INCLUDE_IN_DOCS } from './package-list'
|
||||
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.GITHUB_ACCESS_TOKEN,
|
||||
auth: process.env.ACCESS_TOKEN,
|
||||
})
|
||||
|
||||
const { log: nicelog } = console
|
||||
|
|
|
@ -3,7 +3,7 @@ import { Octokit } from 'octokit'
|
|||
import path from 'path'
|
||||
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.GITHUB_ACCESS_TOKEN,
|
||||
auth: process.env.ACCESS_TOKEN,
|
||||
})
|
||||
|
||||
const { log: nicelog } = console
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue