You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 39db75d
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: website/docs/en/guide/api-reference.mdx
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: 'Public Rstack APIs, including configuration helpers, tool API re-e
4
4
5
5
# API reference
6
6
7
-
Rstack CLI provides a unified configuration API and re-exports the public APIs of Rsbuild, Rslib, Rstest, and Rslint through dedicated subpaths. Prefer these subpaths to direct imports from each tool's core package so that dependency entry points stay unified and APIs match the tool versions integrated by Rstack CLI.
7
+
Rstack CLI provides a unified configuration API and re-exports the public APIs of Rsbuild, Rslib, Rstest, and Rslint through the subpaths below. Import from these entry points to use APIs that match the tool versions in Rstack CLI.
The tool-specific subpaths below re-export the public APIs from their corresponding core packages. Using these entry points keeps imports unified and APIs aligned with the tool versions integrated by Rstack CLI.
62
-
63
61
### `rstack/app`
64
62
65
63
`rstack/app` re-exports all public APIs from `@rsbuild/core`, including APIs for creating and controlling Rsbuild instances.
Copy file name to clipboardExpand all lines: website/docs/en/guide/cli/fmt.mdx
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,7 @@ The command uses the following exit codes:
55
55
56
56
### `-h, --help`
57
57
58
-
Display usage and option information without formatting files:
58
+
Display usage and options:
59
59
60
60
```bash
61
61
rs fmt --help
@@ -79,7 +79,7 @@ If `config/format.ignore` contains this rule:
79
79
generated/**
80
80
```
81
81
82
-
Here, `config/format.ignore` is located relative to the project root. The `generated/**` rule is relative to `config/`. It therefore ignores `config/generated/**` instead of`generated/**` in the project root.
82
+
The `generated/**` rule is relative to `config/`, where the ignore file is located. It excludes `config/generated/**`, not`generated/**` in the project root.
83
83
84
84
Loaded rules apply to scanned paths, explicitly passed files, `--stdin-filepath`, and documents formatted through `--lsp`.
85
85
@@ -133,9 +133,11 @@ Run a language server that formats editor buffers over the [Language Server Prot
133
133
rs fmt --lsp
134
134
```
135
135
136
-
The server only advertises document formatting and formats the buffer held by the editor, not the file on disk. Formatting options sent by the editor, such as tab size, are ignored: the Rstack config is the single source of truth. Ignored, unsupported, and unparsable documents produce no edits rather than an error.
136
+
The server supports document formatting only and works on the editor's buffer. Formatting rules come from the Rstack config; editor options such as tab size are ignored. Ignored, unsupported, and unparsable documents produce no formatting edits.
137
137
138
-
The server loads a single config for the workspace root reported by the editor and does not discover nested configs per file; launch one server per config root when a project contains several. The config is loaded on the first formatting request and reused for the lifetime of the server; restart the server after changing it. Besides the global [`--config`](../configuration#configuration-file) option, only [`--ignore-path`](#--ignore-path-path) affects the server. Relative values for both are resolved from the directory the server was launched in.
138
+
The server uses the config at the workspace root reported by the editor and does not discover nested configs for individual files. If a project has multiple configs, launch a server for each config root. The server reuses the loaded config, so restart it after changing the config.
139
+
140
+
Besides the global [`--config`](../configuration#configuration-file) option, only [`--ignore-path`](#--ignore-path-path) affects the server's formatting behavior. Relative paths for both are resolved from the directory where the server was launched.
139
141
140
142
Register `rs fmt --lsp` as a custom language server in any editor with LSP support to format on demand or on save.
141
143
@@ -161,7 +163,7 @@ Store the persistent cache in a custom directory:
161
163
rs fmt --cache-location .cache/rs-fmt
162
164
```
163
165
164
-
Relative paths are resolved from the current working directory, while absolute paths are used as-is. The directory is created as needed and excluded from file discovery. Unlike the default cache location, a custom directory does not receive an automatic `.gitignore`; exclude it from version control or manage it through your CI cache configuration.
166
+
Relative paths are resolved from the current working directory. The custom cache directory is excluded from formatting and does not receive an automatic `.gitignore`. Add the directory to `.gitignore` if you do not want to commit the cache to Git.
165
167
166
168
If you also pass `--no-cache`, `--cache-location` is ignored and the directory follows the normal file discovery rules.
Copy file name to clipboardExpand all lines: website/docs/en/guide/cli/hooks.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,7 +95,7 @@ When using a custom directory, add the full command to the `prepare` script of t
95
95
}
96
96
```
97
97
98
-
> The path must not contain `..`. This prevents hook files from being created or overwritten outside the repository through a parent directory path.
98
+
> The path must not contain `..` to prevent creating or overwriting hook files outside the repository.
99
99
100
100
### `--help`
101
101
@@ -136,7 +136,7 @@ The default directory structure is:
136
136
└── ...
137
137
```
138
138
139
-
Files alongside `_` are repository hook scripts. The `_` directory contains generated files and is ignored by Git. `rs hooks` points `core.hooksPath` to `.rstack/hooks/_`.
139
+
`rs hooks` points `core.hooksPath` to `.rstack/hooks/_`.
140
140
141
141
## Supported hooks
142
142
@@ -189,7 +189,7 @@ Use it to initialize a Node.js version manager, update `PATH`, or set `RSTACK_HO
189
189
190
190
## Ownership safety
191
191
192
-
Each generated hooks directory records its owning project. Only that project should include `rs hooks` in its `prepare` script. Rstack skips installation from any other project, even with `--force`, and refuses to remove hooks owned by another project.
192
+
Each hooks directory is managed by one project. Include `rs hooks`only in that project's `prepare` script. Installation from other projects is skipped, even with `--force`; uninstallation from other projects is rejected.
Copy file name to clipboardExpand all lines: website/docs/en/guide/cli/staged.mdx
+2-6Lines changed: 2 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,7 @@ description: 'Run lint-staged tasks against Git-staged files with the rs staged
4
4
5
5
# staged
6
6
7
-
The `rs staged` command uses [lint-staged](https://github.com/lint-staged/lint-staged) to run tasks against files staged in Git.
8
-
9
-
`rs staged` can run linters, formatters, or other checks on staged files before committing code.
7
+
`rs staged` uses [lint-staged](https://github.com/lint-staged/lint-staged) to run linters, formatters, or other checks on files staged in Git.
10
8
11
9
A common pattern is to pair `rs staged` with [`rs hooks`](./hooks) and run staged-file tasks from a `pre-commit` hook.
12
10
@@ -30,9 +28,7 @@ rs staged --allow-empty
30
28
31
29
### `--concurrent`
32
30
33
-
`--concurrent` controls how many tasks may run at the same time. It accepts `true`, `false`, or a positive integer.
34
-
35
-
When the option is omitted, it defaults to `true`, so `rs staged` runs tasks concurrently without a fixed limit. Set it to `false` to run one task at a time, or use a positive integer to limit the number of concurrent tasks.
31
+
`--concurrent` controls how many tasks run at once: `true` (the default) allows unlimited concurrency, `false` runs one task at a time, and a positive integer sets the maximum.
36
32
37
33
```bash
38
34
# Use the default: run tasks concurrently without a fixed limit
Copy file name to clipboardExpand all lines: website/docs/en/guide/configuration.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ define.fmt({
33
33
});
34
34
```
35
35
36
-
The configuration file does not require a default export. Each `define.*()` API can be called at most once; defining the same configuration type more than once throws an error.
36
+
The configuration file does not require a default export. Call each `define.*()` API at most once; repeated calls throw an error.
37
37
38
38
By default, Rstack CLI looks for a file with one of the following names:
Rstack keeps a project's build, test, lint, formatting, and other settings in one `rstack.config.*`file. When a command loads the config file, it also loads every top-level import, even if it does not use the related configuration. Importing every tool and plugin at the top level can therefore add startup overhead to commands such as `rs lint` and `rs fmt`.
53
+
Tools and plugins imported at the top level of `rstack.config.*`are loaded with the config, even if the current command does not use them. This can add startup overhead to commands such as `rs lint` and `rs fmt`.
54
54
55
55
Choose the import style based on the config contents:
Copy file name to clipboardExpand all lines: website/docs/en/guide/formatting.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -243,7 +243,7 @@ The command deletes only the cache file, then exits without formatting files. Se
243
243
244
244
To add formatting capabilities that are not built into Rstack CLI, install the corresponding [Prettier plugin](https://prettier.io/docs/plugins) and add it to `plugins`. Plugins can be referenced by package name, file path, or URL. Package names and relative paths are resolved from the directory containing the Rstack configuration file.
245
245
246
-
Because `rs fmt` loads plugins in workers, plugin objects cannot be passed directly. Reference each plugin by package name, path, or URL instead.
246
+
Because `rs fmt` loads plugins in workers, plugin objects cannot be passed directly.
247
247
248
248
For example, install and enable [`prettier-plugin-tailwindcss`](https://github.com/tailwindlabs/prettier-plugin-tailwindcss):
Copy file name to clipboardExpand all lines: website/docs/en/guide/git-hooks.mdx
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,8 +49,6 @@ git config --get core.hooksPath
49
49
50
50
## Pre-commit checks
51
51
52
-
A `pre-commit` hook can lint and format the files staged for the current commit.
53
-
54
52
### Configure tasks
55
53
56
54
Add staged-file tasks to the Rstack config file. Adjust the glob patterns for the languages used by your project:
@@ -76,6 +74,6 @@ rs staged
76
74
77
75
When you run `git commit`, Git invokes the hook installed by `rs hooks`. The hook executes `.rstack/hooks/pre-commit`, and `rs staged` then runs the configured tasks on the staged files.
78
76
79
-
`rs staged` passes matching staged files to each command. Commands in an array run in order: [`rs lint --fix`](./cli/lint) first applies available fixes, then [`rs fmt`](./cli/fmt) formats the result. Remove `--fix` if lint errors should block the commit without changing files.
77
+
`rs staged` passes matching staged files to each command. Commands in an array run in order: [`rs lint --fix`](./cli/lint) first applies available lint fixes, then [`rs fmt`](./cli/fmt) formats the files. Remove `--fix` if you do not want lint issues fixed automatically.
80
78
81
-
After every task passes, the commit continues and includes the fixed and formatted results. If any task fails, the commit stops; fix the issue and then try again.
79
+
If all tasks pass, the commit includes the fixed and formatted results. If any task fails, the commit stops.
This guide explains how to use Rstack CLI in a monorepo, including how it works with task orchestrators such as [Turborepo](https://turborepo.com/docs) and [Nx](https://nx.dev/docs/getting-started/intro).
8
8
9
-
It covers managing the Rstack CLI dependency, configuring lint, formatting, and staged-file tasks at the root, and defining separate configurations for web applications and libraries.
10
-
11
9
## Project structure
12
10
13
11
The recommended setup has two levels:
@@ -29,7 +27,7 @@ The recommended setup has two levels:
29
27
└── rstack.config.ts
30
28
```
31
29
32
-
This structure keeps the Rstack CLI version in one place while keeping build and test configuration close to the project that uses it.
30
+
This structure centralizes tool versions and check rules while letting each project maintain its own build and test configuration.
0 commit comments