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
1 change: 1 addition & 0 deletions .agents/skills/migrate-to-rstack-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Use one of the default names: `rstack.config.ts`, `.js`, `.mts`, or `.mjs`.
Use `rs -c <path>` or `rs --config <path>` only for a custom path.

```ts
// Rstack configuration guide: https://rstack.rs/config
import { define } from 'rstack';

define.app({
Expand Down
1 change: 1 addition & 0 deletions examples/app-react/rstack.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Rstack configuration guide: https://rstack.rs/config
import { define } from 'rstack';

define.app(async () => {
Expand Down
1 change: 1 addition & 0 deletions examples/app-vanilla/rstack.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Rstack configuration guide: https://rstack.rs/config
import { define } from 'rstack';

define.test({
Expand Down
1 change: 1 addition & 0 deletions examples/documentation/rstack.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Rstack configuration guide: https://rstack.rs/config
import { define } from 'rstack';
import path from 'node:path';

Expand Down
1 change: 1 addition & 0 deletions examples/lib-node/rstack.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Rstack configuration guide: https://rstack.rs/config
import { define } from 'rstack';

define.lib({
Expand Down
1 change: 1 addition & 0 deletions examples/lib-react/rstack.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Rstack configuration guide: https://rstack.rs/config
import { define } from 'rstack';

define.lib(async () => {
Expand Down
1 change: 1 addition & 0 deletions examples/rstest-inline-projects/rstack.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Rstack configuration guide: https://rstack.rs/config
import { define } from 'rstack';
import { defineInlineProject } from 'rstack/test';

Expand Down
1 change: 1 addition & 0 deletions packages/rstack/rstack.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Rstack configuration guide: https://rstack.rs/config
import { define } from 'rstack';

define.test(async () => {
Expand Down
14 changes: 14 additions & 0 deletions packages/rstack/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/**
Expand All @@ -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<RslintConfig>)) => 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;
};
Expand Down
16 changes: 16 additions & 0 deletions pnpm-lock.yaml

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

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions rstack.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Rstack configuration guide: https://rstack.rs/config
import { define } from 'rstack';

define.lint(async () => {
Expand Down
1 change: 1 addition & 0 deletions website/docs/en/guide/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
1 change: 1 addition & 0 deletions website/docs/en/guide/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
1 change: 1 addition & 0 deletions website/docs/zh/guide/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
1 change: 1 addition & 0 deletions website/docs/zh/guide/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
1 change: 1 addition & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:",
Expand Down
15 changes: 14 additions & 1 deletion website/rstack.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Rstack configuration guide: https://rstack.rs/config
import path from 'node:path';
import { define } from 'rstack';

Expand All @@ -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');
Expand Down Expand Up @@ -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: [
{
Expand Down