Skip to content

Commit ca079e6

Browse files
authored
feat: support exporting APIs documents manually (#227)
1 parent 46f5749 commit ca079e6

File tree

11 files changed

+776
-772
lines changed

11 files changed

+776
-772
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@alauda/doom": patch
3+
---
4+
5+
feat: support exporting APIs documents manually

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ jobs:
1414
strategy:
1515
matrix:
1616
node:
17-
- 20
17+
# https://github.com/web-infra-dev/rspress/pull/2923
18+
# - 20
1819
- 22
1920
- 24
2021
os:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"@changesets/cli": "^2.29.8",
3636
"@eslint/js": "^9.39.2",
3737
"@swc-node/register": "^1.11.1",
38-
"@swc/core": "^1.15.4",
38+
"@swc/core": "^1.15.7",
3939
"@types/cli-progress": "^3.11.6",
4040
"@types/ejs": "^3.1.5",
4141
"@types/mdast": "^4.0.4",

packages/doom/package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,17 @@
4242
"dependencies": {
4343
"@alauda/doom-export": "^0.3.1",
4444
"@cspell/eslint-plugin": "^9.4.0",
45-
"@eslint-react/eslint-plugin": "^2.3.13",
45+
"@eslint-react/eslint-plugin": "^2.4.0",
4646
"@inquirer/prompts": "^8.1.0",
4747
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
4848
"@rsbuild/plugin-react": "^1.4.2",
4949
"@rsbuild/plugin-sass": "^1.4.0",
5050
"@rsbuild/plugin-svgr": "^1.2.3",
5151
"@rsbuild/plugin-yaml": "^1.0.3",
52-
"@rspress/core": "2.0.0-rc.2",
53-
"@rspress/plugin-algolia": "2.0.0-rc.2",
54-
"@rspress/plugin-llms": "2.0.0-rc.2",
55-
"@rspress/plugin-sitemap": "2.0.0-rc.2",
56-
"@rspress/shared": "2.0.0-rc.2",
52+
"@rspress/core": "2.0.0-rc.3",
53+
"@rspress/plugin-algolia": "2.0.0-rc.3",
54+
"@rspress/plugin-sitemap": "2.0.0-rc.3",
55+
"@rspress/shared": "2.0.0-rc.3",
5756
"@shikijs/transformers": "^3.20.0",
5857
"@total-typescript/ts-reset": "^0.6.1",
5958
"@types/react": "^19.2.7",
@@ -74,7 +73,7 @@
7473
"mdast-util-to-markdown": "^2.1.2",
7574
"mdast-util-to-string": "^4.0.0",
7675
"mermaid": "^11.12.2",
77-
"openai": "^6.10.0",
76+
"openai": "^6.15.0",
7877
"openapi-types": "^12.1.3",
7978
"p-ratelimit": "^1.0.1",
8079
"picomatch": "^4.0.3",
@@ -102,7 +101,7 @@
102101
"tinyglobby": "^0.2.15",
103102
"type-fest": "^5.3.1",
104103
"typescript": "^5.9.3",
105-
"typescript-eslint": "^8.49.0",
104+
"typescript-eslint": "^8.50.1",
106105
"unified": "^11.0.5",
107106
"unified-lint-rule": "^3.0.1",
108107
"unist-util-position": "^5.0.0",

packages/doom/src/cli/load-config.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { pluginSvgr } from '@rsbuild/plugin-svgr'
99
import { pluginYaml } from '@rsbuild/plugin-yaml'
1010
import { logger, type UserConfig } from '@rspress/core'
1111
import { pluginAlgolia } from '@rspress/plugin-algolia'
12-
import { pluginLlms } from '@rspress/plugin-llms'
1312
import { pluginSitemap } from '@rspress/plugin-sitemap'
1413
import {
1514
addLeadingSlash,
@@ -276,7 +275,6 @@ const getCommonConfig = async ({
276275
},
277276
plugins: [
278277
algoliaOptions && pluginAlgolia(),
279-
pluginLlms(),
280278
siteUrl &&
281279
config.siteUrl &&
282280
pluginSitemap({
@@ -353,8 +351,7 @@ const getCommonConfig = async ({
353351
ssg: {
354352
experimentalWorker: true,
355353
},
356-
// https://github.com/web-infra-dev/rspress/issues/2894
357-
// llms: true,
354+
llms: true,
358355
}
359356
}
360357

packages/doom/src/global/SiteOverrides/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const SiteOverrides = () => {
3939
pageType,
4040
// Inject by remark-plugin-toc
4141
title: articleTitle,
42+
// eslint-disable-next-line @typescript-eslint/no-useless-default-assignment
4243
frontmatter = {},
4344
} = page
4445

packages/doom/src/plugins/auto-sidebar/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,12 @@ export const autoSidebar = async (
225225
const exclude = (route.exclude ??= [])
226226
exclude.push(...excludeRoutes)
227227
// only exclude apis routes for sidebar but not site data to avoid dead links
228-
if (export_) {
228+
if (
229+
export_ &&
230+
!onlyIncludeRoutes.some(
231+
(route) => route.startsWith('apis/') || route.startsWith('*/apis/'),
232+
)
233+
) {
229234
excludeRoutes.push(...APIS_ROUTES)
230235
}
231236
}

packages/doom/src/plugins/auto-sidebar/walk.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ export async function scanSideMeta(
244244
}
245245

246246
const {
247+
// eslint-disable-next-line @typescript-eslint/no-useless-default-assignment
247248
type = 'file',
248249
name,
249250
label = '',

packages/doom/src/plugins/global/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,18 @@ export const globalPlugin = ({
7474
}
7575
},
7676
addPages(config) {
77-
const loginPath = baseResolve('login')
77+
let loginPath: string
78+
for (const ext of ['.js', '.tsx']) {
79+
loginPath = baseResolve(`login/index${ext}`)
80+
if (fs.existsSync(loginPath)) {
81+
break
82+
}
83+
}
7884
if ((config.themeConfig?.locales?.length ?? 0) < 1) {
7985
return [
8086
{
8187
routePath: '/login',
82-
filepath: loginPath,
88+
filepath: loginPath!,
8389
},
8490
]
8591
}

packages/doom/styles/global.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ td {
147147

148148
&-doc-layout__doc-container {
149149
padding: 0;
150-
// https://github.com/web-infra-dev/rspress/issues/2909
151-
min-height: unset;
152150
}
153151

154152
&-toc-item--active .rp-toc-item__text {

0 commit comments

Comments
 (0)