8000 build: update API generator · matt-jb/coreui-react@f140536 · GitHub
[go: up one dir, main page]

Skip to content

Commit f140536

Browse files
committed
build: update API generator
1 parent e5c44d8 commit f140536

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

packages/docs/build/api.mjs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ const createMdx = async (file, component) => {
294294
.map((_type) => `\`${_type.trim()}\``)
295295
.join(', ')
296296

297-
const id = `${component.displayName.toLowerCase()}-${propName}`
297+
const id = `${component.displayName.toLowerCase()}-${propName.replaceAll(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()}`
298298
const anchor = `<a href="#${id}" aria-label="${component.displayName} ${displayName} permalink" className="anchor-link after">#</a>`
299299

300300
content += ` <tr id="${id}">\n`
@@ -340,22 +340,22 @@ const main = async () => {
340340
try {
341341
const files = await globby(GLOB_PATTERNS, GLOBBY_OPTIONS)
342342

343-
await Promise.all(
344-
files.map(async (file) => {
345-
console.log(`Processing file: ${file}`)
346-
let components
347-
try {
348-
components = parse(file, DOCGEN_OPTIONS)
349-
} catch (parseError) {
350-
console.error(`Failed to parse ${file}:`, parseError)
351-
return
352-
}
343+
for (const file of files) {
344+
console.log(`Processing file: ${file}`)
345+
let components
346+
try {
347+
components = parse(file, DOCGEN_OPTIONS)
348+
} catch (parseError) {
349+
console.error(`Failed to parse ${file}:`, parseError)
350+
continue // Skip to the next file
351+
}
353352

354-
if (components && components.length > 0) {
355-
await Promise.all(components.map((component) => createMdx(file, component)))
353+
if (components && components.length > 0) {
354+
for (const component of components) {
355+
await createMdx(file, component) // Sequentially create MDX files
356356
}
357-
}),
358-
)
357+
}
358+
}
359359
} catch (error) {
360360
console.error('An error occurred:', error)
361361
process.exit(1)

0 commit comments

Comments
 (0)
0