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 bbfe800
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
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,36 @@ Rstack CLI provides a unified configuration API and re-exports the public APIs o
25
25
26
26
Import`define`from`rstack`toregistertoolconfigurationsin`rstack.config.ts`; see [ConfigurationAPIs](./configuration#configuration-apis) fordetails.
27
27
28
+
### `RstackConfig`
29
+
30
+
`RstackConfig` is the type for a [shared configuration](./configuration#shared-configurations). All fields are optional, so include only the settings you want to share.
31
+
32
+
Each tool field accepts the same configuration as its corresponding `define.*()` method. For example, `fmt` accepts the same input as `define.fmt()`.
33
+
34
+
```ts title="shared.ts"
35
+
importtype { RstackConfig } from'rstack';
36
+
37
+
exportconst sharedConfig:RstackConfig= {
38
+
fmt: {
39
+
singleQuote: true,
40
+
},
41
+
};
42
+
```
43
+
44
+
Use the `extends` field to inherit other shared configurations. Its type is `readonly RstackConfig[]`.
45
+
46
+
```ts title="team.ts"
47
+
importtype { RstackConfig } from'rstack';
48
+
import { sharedConfig } from'./shared.ts';
49
+
50
+
exportconst teamConfig:RstackConfig= {
51
+
extends: [sharedConfig],
52
+
fmt: {
53
+
printWidth: 100,
54
+
},
55
+
};
56
+
```
57
+
28
58
## Re-exports
29
59
30
60
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.
Copy file name to clipboardExpand all lines: website/docs/en/guide/configuration.mdx
+18-9Lines changed: 18 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,15 +78,16 @@ define.fmt({
78
78
79
79
Configuration options follow the formats of the underlying tools. When using APIs and helpers that Rstack CLI re-exports, prefer the `rstack/app`, `rstack/lib`, `rstack/test`, and `rstack/lint` entry points.
Provide a staged configuration through `define.staged()` or a [shared configuration](#shared-configurations). `rs staged` reports an error if neither provides one.
207
208
209
+
### `define.extends()`\{#define-extends}
210
+
211
+
Accepts an array of shared configuration objects and applies their tool settings before merging the project's own `define.*()` configurations.
See [Shared configurations](#shared-configurations) for usage and merge rules.
216
+
208
217
## Shared configurations
209
218
210
219
Use `define.extends()` to share build, test, lint, and formatting settings across projects. A shared configuration is a plain object whose fields accept the same values as the corresponding `define.*()` APIs. In TypeScript, use `RstackConfig` to check its types:
Copy file name to clipboardExpand all lines: website/docs/en/guide/testing.mdx
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,8 @@ import { defineInlineProject, expect, test } from 'rstack/test';
36
36
37
37
When `define.test()` does not set Rstest's [`extends`](https://rstest.rs/config/test/extends), Rstack CLI automatically converts the configuration registered by `define.app()` or `define.lib()` into an Rstest configuration. The inherited configuration is merged with the options passed directly to `define.test()`.
38
38
39
+
When using [shared configurations](./configuration#shared-configurations), Rstack first merges the shared and project test settings, then determines whether automatic inheritance is needed. If it is, Rstack uses the merged App or Lib configuration.
40
+
39
41
### Inherit the application configuration
40
42
41
43
When `define.app()` is registered, Rstack CLI converts it with [`@rstest/adapter-rsbuild`](https://rstest.rs/guide/integration/rsbuild) and uses the result as the test configuration's `extends` value:
0 commit comments