Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
"matchDepNames": ["prosemirror-*"],
"groupName": "prosemirror"
},
{
"matchDepNames": ["builddocs"],
"description": "builddocs 2.x is an incompatible rewrite (HTML output, no markdown/templates); stay on 1.x",
"matchUpdateTypes": ["major"],
"enabled": false
},
{
"groupName": "all non-major dependencies",
"groupSlug": "all-minor-patch",
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ jobs:
- name: Build packages
run: pnpm build

- name: Build API docs
run: pnpm --filter=@milkdown/docs run build

- name: Publish snapshot
if: ${{ github.event_name == 'pull_request' }}
run: >
Expand Down
1 change: 1 addition & 0 deletions docs/api/preset-commonmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ Editor.make()
@linkSchema
@toggleLinkCommand
@updateLinkCommand
@sanitizeLinkHref

---

Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"devDependencies": {
"@types/fs-extra": "^11.0.4",
"builddocs": "^2.0.0",
"builddocs": "^1.0.9",
"fs-extra": "^11.3.0"
}
}
17 changes: 14 additions & 3 deletions docs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const logError = (error: unknown) => {
const write = readdirSync(apiDir)
.filter((dir) => dir !== '.DS_Store')
.map((pathname) => parse(pathname).name)
.map(async (name) => {
.map(async (name): Promise<boolean> => {
const main = resolve(apiDir, `${name}.md`)
const out = resolve(apiOutDir, `${name}.md`)

Expand All @@ -51,27 +51,38 @@ const write = readdirSync(apiDir)
})
await writeFile(out, markdown)
logger.info(`Build module: @milkdown/${name} finished.`)
return true
} catch (error) {
logger.error(`Build module: @milkdown/${name} failed.`)
logError(error)
return false
}
} catch {
// copy the main file to out
logger.log(`Copying module: @milkdown/${name}...`)
try {
await copyFile(main, out)
logger.info(`Copy module: @milkdown/${name} finished.`)
return true
} catch (error) {
logger.error(`Copy module: @milkdown/${name} failed.`)
logError(error)
return false
}
}
})

Promise.all(write)
.then(() => {
.then((results) => {
const failed = results.filter((ok) => !ok).length
if (failed > 0) {
logger.error(`Build api failed: ${failed} module(s) could not be built.`)
process.exitCode = 1
return
}
logger.info('Build api done.')
})
.catch((error) => {
throw error
logError(error)
process.exitCode = 1
})
82 changes: 73 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading