feat(rspress): upgrade Rspress examples to v2#438
Conversation
|
@copilot rebase 到最新的 origin/main,并进行简单验证,npm run dev npm run build npm run preview 等命令都正常运行 |
已处理,提交 |
e441398 to
4eacb34
Compare
Agent-Logs-Url: https://github.com/rstackjs/rstack-examples/sessions/2a336486-a4eb-439c-8a87-2d6ef6a5942d Co-authored-by: SoonIter <79413249+SoonIter@users.noreply.github.com>
Agent-Logs-Url: https://github.com/rstackjs/rstack-examples/sessions/2a336486-a4eb-439c-8a87-2d6ef6a5942d Co-authored-by: SoonIter <79413249+SoonIter@users.noreply.github.com>
Agent-Logs-Url: https://github.com/rstackjs/rstack-examples/sessions/2a336486-a4eb-439c-8a87-2d6ef6a5942d Co-authored-by: SoonIter <79413249+SoonIter@users.noreply.github.com>
4eacb34 to
fa42137
Compare
There was a problem hiding this comment.
Pull request overview
Upgrades the rspress/basic and rspress/custom-theme example projects from Rspress v1 to the v2 @rspress/core setup, refreshing configs, theme scaffolding, and example docs to match the newer structure.
Changes:
- Migrate dependencies/config imports from
rspressv1 to@rspress/corev2 and update TypeScript config defaults. - Refresh docs IA/content (new Guide/API sections, nav config, new MDX examples) and remove old placeholder pages.
- Simplify the custom theme scaffold and add basic brand color overrides + static assets.
Reviewed changes
Copilot reviewed 48 out of 53 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| rspress/custom-theme/tsconfig.json | Update TS config for v2-era module resolution/strictness + MDX checking. |
| rspress/custom-theme/theme/index.tsx | Replace v1 theme entry with v2 theme-original re-exports + CSS import. |
| rspress/custom-theme/theme/index.css | Add example brand color CSS variables. |
| rspress/custom-theme/theme/env.d.ts | Add typings for CSS imports and import.meta.env usage. |
| rspress/custom-theme/rspress.config.ts | Migrate config to @rspress/core and update site/theme metadata. |
| rspress/custom-theme/package.json | Switch dependency to @rspress/core and set package ESM. |
| rspress/custom-theme/docs/public/rspress-light-logo.png | Add light logo asset for the v2 scaffold. |
| rspress/custom-theme/docs/public/rspress-dark-logo.png | Add dark logo asset for the v2 scaffold. |
| rspress/custom-theme/docs/index.md | Update home page hero/features content and links to new doc structure. |
| rspress/custom-theme/docs/hello.md | Remove old placeholder “Hello World” page. |
| rspress/custom-theme/docs/guide/use-mdx/container.md | Add container syntax documentation page. |
| rspress/custom-theme/docs/guide/use-mdx/components.mdx | Add MDX + Rspress theme component usage examples. |
| rspress/custom-theme/docs/guide/use-mdx/code-blocks/title.md | Add code block title example page. |
| rspress/custom-theme/docs/guide/use-mdx/code-blocks/meta.md | Add code block meta (line numbers/wrap/title) example page. |
| rspress/custom-theme/docs/guide/use-mdx/code-blocks/index.mdx | Add code blocks section landing page. |
| rspress/custom-theme/docs/guide/use-mdx/code-blocks/_meta.json | Define sidebar ordering for code-blocks pages. |
| rspress/custom-theme/docs/guide/use-mdx/_meta.json | Define sidebar ordering for the use-mdx section. |
| rspress/custom-theme/docs/guide/start/introduction.md | Add new “Introduction” page for Getting Started section. |
| rspress/custom-theme/docs/guide/start/getting-started.md | Add new “Getting started” page describing workflows/output. |
| rspress/custom-theme/docs/guide/start/_meta.json | Define ordering for Getting Started pages. |
| rspress/custom-theme/docs/guide/_meta.json | Define guide sidebar section headers. |
| rspress/custom-theme/docs/api/index.mdx | Add API overview page stub. |
| rspress/custom-theme/docs/api/commands.mdx | Add commands page stub. |
| rspress/custom-theme/docs/api/_meta.json | Define API section ordering. |
| rspress/custom-theme/docs/_nav.json | Add top nav configuration (Guide/API/Document). |
| rspress/custom-theme/README.md | Add usage instructions for the custom-theme example. |
| rspress/custom-theme/.gitignore | Remove per-example gitignore. |
| rspress/basic/tsconfig.json | Update TS config for v2-era module resolution/strictness + MDX checking. |
| rspress/basic/rspress.config.ts | Migrate config to @rspress/core and update site metadata. |
| rspress/basic/package.json | Switch dependency to @rspress/core, set package ESM, add React typings/runtime deps. |
| rspress/basic/docs/index.md | Update home page hero/features content and links to new doc structure. |
| rspress/basic/docs/hello.md | Remove old placeholder “Hello World” page. |
| rspress/basic/docs/guide/use-mdx/container.md | Add container syntax documentation page. |
| rspress/basic/docs/guide/use-mdx/components.mdx | Add MDX + Rspress theme component usage examples. |
| rspress/basic/docs/guide/use-mdx/code-blocks/title.md | Add code block title example page. |
| rspress/basic/docs/guide/use-mdx/code-blocks/meta.md | Add code block meta (line numbers/wrap/title) example page. |
| rspress/basic/docs/guide/use-mdx/code-blocks/index.mdx | Add code blocks section landing page. |
| rspress/basic/docs/guide/use-mdx/code-blocks/_meta.json | Define sidebar ordering for code-blocks pages. |
| rspress/basic/docs/guide/use-mdx/_meta.json | Define sidebar ordering for the use-mdx section. |
| rspress/basic/docs/guide/start/introduction.md | Add new “Introduction” page for Getting Started section. |
| rspress/basic/docs/guide/start/getting-started.md | Add new “Getting started” page describing workflows/output. |
| rspress/basic/docs/guide/start/_meta.json | Define ordering for Getting Started pages. |
| rspress/basic/docs/guide/index.md | Remove old monolithic “Markdown & MDX” guide page. |
| rspress/basic/docs/guide/_meta.json | Replace old meta with section headers for new guide layout. |
| rspress/basic/docs/api/index.mdx | Add API overview page stub. |
| rspress/basic/docs/api/commands.mdx | Add commands page stub. |
| rspress/basic/docs/api/_meta.json | Define API section ordering. |
| rspress/basic/docs/_nav.json | Add top nav configuration (Guide/API/Document). |
| rspress/basic/docs/_meta.json | Remove old nav/meta config file. |
| rspress/basic/README.md | Add usage instructions for the basic example. |
| rspress/basic/.gitignore | Remove per-example gitignore. |
| pnpm-lock.yaml | Update lockfile to reflect v2 dependency graph changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ``` | ||
|
|
||
| By default, Rspress will output to `doc_build` directory. | ||
|
|
There was a problem hiding this comment.
This doc mentions the build output is doc_build, but the per-example .gitignore files were removed and the repo root .gitignore does not ignore doc_build. This makes it easy to accidentally commit generated site output; add an ignore rule (either restore a package-level .gitignore or add a repo-level ignore like **/doc_build/).
| ``` | ||
|
|
||
| By default, Rspress will output to `doc_build` directory. | ||
|
|
There was a problem hiding this comment.
This doc mentions the build output is doc_build, but the per-example .gitignore files were removed and the repo root .gitignore does not ignore doc_build. This makes it easy to accidentally commit generated site output; add an ignore rule (either restore a package-level .gitignore or add a repo-level ignore like **/doc_build/).
| import './index.css'; | ||
|
|
||
| // to replace home footer | ||
| export function HomeFooter() { | ||
| const { siteData } = usePageData(); | ||
| const { createdBy } = (siteData.themeConfig.footer || {}) as any; | ||
| // use configuration from rspress.config | ||
|
|
||
| return ( | ||
| <footer className="absolute bottom-0 mt-12 py-8 px-6 sm:p-8 w-full border-t border-solid border-divider-light"> | ||
| <div className="m-auto w-full text-center"> | ||
| <div className="font-meduim text-sm text-text-2">Created by {createdBy} with love</div> | ||
| </div> | ||
| </footer> | ||
| ); | ||
| } | ||
|
|
||
| export default Theme; | ||
| export * from 'rspress/theme'; | ||
| export * from '@rspress/core/theme-original'; |
There was a problem hiding this comment.
export * from '@rspress/core/theme-original' does not re-export the module’s default export. If Rspress expects the theme entry to provide a default export (as the previous implementation did), this will break theme loading. Re-export the default (and keep named exports) from @rspress/core/theme-original.
| Install the dependencies: | ||
|
|
||
| ```bash | ||
| npm install | ||
| ``` |
There was a problem hiding this comment.
This README instructs npm install, but this repo is a pnpm workspace (root scripts use pnpm --filter ...). Using npm here can create an extra lockfile and different resolution; update the instructions to use pnpm (e.g. pnpm install at repo root and pnpm --filter @rspress-example/basic dev / pnpm dev).
| Install the dependencies: | ||
|
|
||
| ```bash | ||
| npm install | ||
| ``` |
There was a problem hiding this comment.
This README instructs npm install, but this repo is a pnpm workspace (root scripts use pnpm --filter ...). Using npm here can create an extra lockfile and different resolution; update the instructions to use pnpm (e.g. pnpm install at repo root and pnpm --filter @rspress-example/custom-theme dev / pnpm dev).

origin/mainnpm run dev,npm run build, andnpm run preview