diff --git a/.agents/skills/migrate-to-rstack-cli/SKILL.md b/.agents/skills/migrate-to-rstack-cli/SKILL.md index 811c188b..f1064762 100644 --- a/.agents/skills/migrate-to-rstack-cli/SKILL.md +++ b/.agents/skills/migrate-to-rstack-cli/SKILL.md @@ -40,6 +40,7 @@ Use one of the default names: `rstack.config.ts`, `.js`, `.mts`, or `.mjs`. Use `rs -c ` or `rs --config ` only for a custom path. ```ts +// Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; define.app({ diff --git a/examples/app-react/rstack.config.ts b/examples/app-react/rstack.config.ts index 6816c1f3..4d23b13c 100644 --- a/examples/app-react/rstack.config.ts +++ b/examples/app-react/rstack.config.ts @@ -1,3 +1,4 @@ +// Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; define.app(async () => { diff --git a/examples/app-vanilla/rstack.config.ts b/examples/app-vanilla/rstack.config.ts index ad5ae106..3504d640 100644 --- a/examples/app-vanilla/rstack.config.ts +++ b/examples/app-vanilla/rstack.config.ts @@ -1,3 +1,4 @@ +// Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; define.test({ diff --git a/examples/documentation/rstack.config.ts b/examples/documentation/rstack.config.ts index ac492ef8..f73f1863 100644 --- a/examples/documentation/rstack.config.ts +++ b/examples/documentation/rstack.config.ts @@ -1,3 +1,4 @@ +// Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; import path from 'node:path'; diff --git a/examples/lib-node/rstack.config.ts b/examples/lib-node/rstack.config.ts index ad7a8805..7febc0b6 100644 --- a/examples/lib-node/rstack.config.ts +++ b/examples/lib-node/rstack.config.ts @@ -1,3 +1,4 @@ +// Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; define.lib({ diff --git a/examples/lib-react/rstack.config.ts b/examples/lib-react/rstack.config.ts index c002aa3a..1b26f747 100644 --- a/examples/lib-react/rstack.config.ts +++ b/examples/lib-react/rstack.config.ts @@ -1,3 +1,4 @@ +// Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; define.lib(async () => { diff --git a/examples/rstest-inline-projects/rstack.config.ts b/examples/rstest-inline-projects/rstack.config.ts index 930ef5b5..501912cb 100644 --- a/examples/rstest-inline-projects/rstack.config.ts +++ b/examples/rstest-inline-projects/rstack.config.ts @@ -1,3 +1,4 @@ +// Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; import { defineInlineProject } from 'rstack/test'; diff --git a/packages/rstack/rstack.config.ts b/packages/rstack/rstack.config.ts index 789bc1fd..650c9379 100644 --- a/packages/rstack/rstack.config.ts +++ b/packages/rstack/rstack.config.ts @@ -1,3 +1,4 @@ +// Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; define.test(async () => { diff --git a/packages/rstack/src/config.ts b/packages/rstack/src/config.ts index 3411ffa4..8ca7bc54 100644 --- a/packages/rstack/src/config.ts +++ b/packages/rstack/src/config.ts @@ -78,18 +78,24 @@ type Define = { * Defines the Rsbuild config for the app. * * This config is used by the `rs dev`, `rs build`, and `rs preview` commands. + * + * @see {@link https://rstack.rs/config | Rstack configuration guide} */ app: (config: RsbuildConfigDefinition) => void; /** * Defines the Rslib config for libraries. * * This config is used by the `rs lib` command. + * + * @see {@link https://rstack.rs/config | Rstack configuration guide} */ lib: (config: RslibConfigDefinition) => void; /** * Defines the Rspress config for documentation. * * This config is used by the `rs doc` command. + * + * @see {@link https://rstack.rs/config | Rstack configuration guide} */ doc: (config: RspressConfigDefinition) => void; /** @@ -100,24 +106,32 @@ type Define = { * Unless `extends` is set explicitly, Rstest automatically extends `define.app` or * falls back to `define.lib`. For multi-project configs, this applies to every inline * project without an explicit `extends`. The app config takes precedence when both are defined. + * + * @see {@link https://rstack.rs/config | Rstack configuration guide} */ test: (config: RstestConfigExport) => void; /** * Defines the Rslint config for linting. * * This config is used by the `rs lint` command. + * + * @see {@link https://rstack.rs/config | Rstack configuration guide} */ lint: (config: RslintConfig | (() => Promise)) => void; /** * Defines the Prettier config for formatting. * * This config will be used by the `rs fmt` command. + * + * @see {@link https://rstack.rs/config | Rstack configuration guide} */ fmt: (config: FmtConfigDefinition) => void; /** * Defines the lint-staged config for staged files. * * This config is used by the `rs staged` command. + * + * @see {@link https://rstack.rs/config | Rstack configuration guide} */ staged: (config: StagedConfig) => void; }; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bd3fd3dd..8d541a65 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25,6 +25,9 @@ catalogs: '@rspress/core': specifier: ^2.0.19 version: 2.0.19 + '@rspress/plugin-client-redirects': + specifier: ^2.0.19 + version: 2.0.19 '@rspress/plugin-sitemap': specifier: ^2.0.19 version: 2.0.19 @@ -406,6 +409,9 @@ importers: '@rspress/core': specifier: 'catalog:' version: 2.0.19(micromark-util-types@2.0.2)(micromark@4.0.2)(supports-color@8.1.1) + '@rspress/plugin-client-redirects': + specifier: 'catalog:' + version: 2.0.19(@rspress/core@2.0.19) '@rspress/plugin-sitemap': specifier: 'catalog:' version: 2.0.19(@rspress/core@2.0.19) @@ -913,6 +919,12 @@ packages: engines: {node: ^20.19.0 || >=22.12.0} hasBin: true + '@rspress/plugin-client-redirects@2.0.19': + resolution: {integrity: sha512-BUwgEyj8vCkU58cV3Gp97aTSnfGJm7aXh40K0Dot1BqsCQ8ekdsMuaLXrICROdP9/ctd4oALtLBkOE+PKTa4Sg==} + engines: {node: ^20.19.0 || >=22.12.0} + peerDependencies: + '@rspress/core': ^2.0.10 + '@rspress/plugin-sitemap@2.0.19': resolution: {integrity: sha512-9ydrpj9hmmXWKWKIXUqJ1UrfxSvfxhHZRBZLb5OkTlOuQBNAg6BpsrW1WHoJqJr7p+3zqlz7S/9HTzSA3+EYcA==} engines: {node: ^20.19.0 || >=22.12.0} @@ -2788,6 +2800,10 @@ snapshots: - micromark-util-types - supports-color + '@rspress/plugin-client-redirects@2.0.19(@rspress/core@2.0.19)': + dependencies: + '@rspress/core': 2.0.19(micromark-util-types@2.0.2)(micromark@4.0.2)(supports-color@8.1.1) + '@rspress/plugin-sitemap@2.0.19(@rspress/core@2.0.19)': dependencies: '@rspress/core': 2.0.19(micromark-util-types@2.0.2)(micromark@4.0.2)(supports-color@8.1.1) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index b7dee3c3..c6cd96ad 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -18,6 +18,7 @@ catalog: '@rslib/core': '~1.0.0-beta.1' '@rslint/core': '~0.7.2' '@rspress/core': '^2.0.19' + '@rspress/plugin-client-redirects': '^2.0.19' '@rspress/plugin-sitemap': '^2.0.19' '@rstack-dev/doc-ui': '1.14.7' '@rstackjs/load-config': ^0.1.2 diff --git a/rstack.config.ts b/rstack.config.ts index 9ccdbd4a..7bac31fa 100644 --- a/rstack.config.ts +++ b/rstack.config.ts @@ -1,3 +1,4 @@ +// Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; define.lint(async () => { diff --git a/website/docs/en/guide/configuration.mdx b/website/docs/en/guide/configuration.mdx index d94fac3b..2dd823f4 100644 --- a/website/docs/en/guide/configuration.mdx +++ b/website/docs/en/guide/configuration.mdx @@ -7,6 +7,7 @@ Rstack centralizes the configuration for your project's tools in a single file. Create `rstack.config.ts` in the project root and call the relevant `define.*()` APIs: ```ts title="rstack.config.ts" +// Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; define.app({ diff --git a/website/docs/en/guide/quick-start.mdx b/website/docs/en/guide/quick-start.mdx index 2fe2f345..12d18103 100644 --- a/website/docs/en/guide/quick-start.mdx +++ b/website/docs/en/guide/quick-start.mdx @@ -68,6 +68,7 @@ The following commands are available: Create `rstack.config.ts` in the project root and register the configurations your project needs. The following is a minimal example for an application with testing and linting: ```ts title="rstack.config.ts" +// Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; define.app({ diff --git a/website/docs/zh/guide/configuration.mdx b/website/docs/zh/guide/configuration.mdx index c77694eb..59b66651 100644 --- a/website/docs/zh/guide/configuration.mdx +++ b/website/docs/zh/guide/configuration.mdx @@ -7,6 +7,7 @@ Rstack 将项目所用工具的配置集中到一份文件中。通过 `define.* 在项目根目录创建 `rstack.config.ts`,并调用对应的 `define.*()` API: ```ts title="rstack.config.ts" +// Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; define.app({ diff --git a/website/docs/zh/guide/quick-start.mdx b/website/docs/zh/guide/quick-start.mdx index db3a0f72..8a8a0bcf 100644 --- a/website/docs/zh/guide/quick-start.mdx +++ b/website/docs/zh/guide/quick-start.mdx @@ -68,6 +68,7 @@ Rstack 提供以下命令: 在项目根目录创建 `rstack.config.ts`,并注册项目所需的配置。以下是一个包含应用、测试和代码检查的最小示例: ```ts title="rstack.config.ts" +// Rstack configuration guide: https://rstack.rs/config import { define } from 'rstack'; define.app({ diff --git a/website/package.json b/website/package.json index 6c8d9a48..bb4a5f6b 100644 --- a/website/package.json +++ b/website/package.json @@ -11,6 +11,7 @@ "devDependencies": { "@rsbuild/plugin-sass": "catalog:", "@rspress/core": "catalog:", + "@rspress/plugin-client-redirects": "catalog:", "@rspress/plugin-sitemap": "catalog:", "@rstack-dev/doc-ui": "catalog:", "@shikijs/transformers": "catalog:", diff --git a/website/rstack.config.ts b/website/rstack.config.ts index fc41eaa3..c78997c8 100644 --- a/website/rstack.config.ts +++ b/website/rstack.config.ts @@ -1,3 +1,4 @@ +// Rstack configuration guide: https://rstack.rs/config import path from 'node:path'; import { define } from 'rstack'; @@ -10,6 +11,7 @@ define.doc(async () => { const { pluginSass } = await import('@rsbuild/plugin-sass'); const { transformerNotationDiff, transformerNotationFocus, transformerNotationHighlight } = await import('@shikijs/transformers'); + const { pluginClientRedirects } = await import('@rspress/plugin-client-redirects'); const { pluginSitemap } = await import('@rspress/plugin-sitemap'); const { pluginOpenGraph } = await import('rsbuild-plugin-open-graph'); const { pluginFontOpenSans } = await import('rspress-plugin-font-open-sans'); @@ -42,7 +44,18 @@ define.doc(async () => { route: { cleanUrls: true, }, - plugins: [pluginFontOpenSans(), pluginSitemap({ siteUrl })], + plugins: [ + pluginClientRedirects({ + redirects: [ + { + from: '^/config/?$', + to: '/guide/configuration', + }, + ], + }), + pluginFontOpenSans(), + pluginSitemap({ siteUrl }), + ], themeConfig: { socialLinks: [ {