Skip to content

Commit e21e230

Browse files
committed
docs: polish website documentation
1 parent 74f3869 commit e21e230

25 files changed

Lines changed: 141 additions & 140 deletions

website/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,26 @@
22

33
This website is built with [Rspress](https://rspress.rs/) through Rstack CLI.
44

5-
Documentation can be written with Markdown or MDX.
5+
The documentation source lives in `docs` and is written in Markdown or MDX.
66

77
## Development
88

9-
Run the development server from the repository root:
9+
Start the development server from the repository root:
1010

1111
```bash
1212
pnpm doc
1313
```
1414

15-
Build or preview the website from this directory:
15+
Alternatively, run the website scripts from this directory:
1616

1717
```bash
18+
pnpm dev
1819
pnpm build
1920
pnpm preview
2021
```
2122

2223
## Contributing
2324

24-
The website provides English and Chinese documentation. Keep both versions in
25-
sync when possible. Placeholder pages marked with `TODO` are ready for future
26-
documentation.
25+
Keep corresponding English and Chinese pages aligned in structure, meaning,
26+
links, and examples. When a translated heading would generate a different
27+
anchor, add an explicit anchor that matches the English heading.

website/docs/en/guide/api-reference.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# API reference
22

3-
Rstack 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 and tool versions remain aligned with Rstack.
3+
Rstack exposes a unified configuration API and dedicated entry points for the public APIs of Rsbuild, Rslib, Rstest, and Rslint. Prefer these entry points over direct imports from each tool's core package so that import paths and tool versions stay aligned with Rstack.
44

55
## Import paths
66

@@ -19,11 +19,11 @@ Rstack provides a unified configuration API and re-exports the public APIs of Rs
1919

2020
### `define`
2121

22-
Import `define` from `rstack` to register tool configurations in `rstack.config.ts`; see [Configuration APIs](./configuration#configuration-apis) for details.
22+
Import `define` from `rstack` to register tool configurations in `rstack.config.ts`. For details, see [Configuration APIs](./configuration#configuration-apis).
2323

2424
## Re-exports
2525

26-
The tool-specific subpaths below re-export the public APIs from their corresponding core packages. Using these Rstack entry points keeps dependency entry points and tool versions aligned with the toolchain integrated by Rstack.
26+
Each tool-specific subpath re-exports the public APIs of its corresponding core package.
2727

2828
### `rstack/app`
2929

@@ -53,7 +53,7 @@ For details, see the [Rslib core APIs](https://rslib.rs/api/javascript-api/core)
5353
import { describe, expect, test } from 'rstack/test';
5454
```
5555

56-
See the [Rstest runtime API](https://rstest.rs/api/runtime-api/) for test APIs and the [Rstest core APIs](https://rstest.rs/api/javascript-api/rstest-core) for configuration helpers.
56+
For test APIs, see the [Rstest runtime API](https://rstest.rs/api/runtime-api/). For configuration helpers, see the [Rstest core APIs](https://rstest.rs/api/javascript-api/rstest-core).
5757

5858
> For more guidance on testing, see [Testing](./testing).
5959
@@ -69,7 +69,7 @@ For details about the available presets and plugins, see [Rslint rules and prese
6969

7070
## TypeScript types
7171

72-
These type-only entry points add ambient declarations to a TypeScript project. Add only the entries your project needs to [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig/#types) in `tsconfig.json`.
72+
The following type-only entry points add ambient declarations to a TypeScript project. Add only the entries your project needs to [`compilerOptions.types`](https://www.typescriptlang.org/tsconfig/#types) in `tsconfig.json`.
7373

7474
### `rstack/types`
7575

@@ -85,7 +85,7 @@ These type-only entry points add ambient declarations to a TypeScript project. A
8585

8686
### `rstack/test/globals`
8787

88-
`rstack/test/globals` declares Rstest APIs such as `test`, `expect`, and lifecycle hooks as globals. Add it when tests use these APIs without explicit imports.
88+
`rstack/test/globals` declares Rstest APIs such as `test`, `expect`, and lifecycle hooks as globals. Add it when Rstest's [`globals`](https://rstest.rs/config/test/globals) option is enabled and tests use these APIs without explicit imports.
8989

9090
```json title="tsconfig.json"
9191
{
@@ -97,7 +97,7 @@ These type-only entry points add ambient declarations to a TypeScript project. A
9797

9898
### `rstack/test/importMeta`
9999

100-
`rstack/test/importMeta` augments `ImportMeta` with the optional `rstest` property, enabling `import.meta.rstest` in in-source tests.
100+
`rstack/test/importMeta` augments `ImportMeta` with the optional `rstest` property, providing type support for `import.meta.rstest` in in-source tests.
101101

102102
```json title="tsconfig.json"
103103
{

website/docs/en/guide/cli/build.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Examples:
2020
# Write output files to the output directory
2121
rs build --dist-path output
2222

23-
# Generate source maps for the output files
23+
# Generate source maps for output files
2424
rs build --source-map
2525

2626
# Rebuild when files change
@@ -29,7 +29,7 @@ rs build --watch
2929

3030
## Configuration
3131

32-
Configure the production build through [`define.app()`](../configuration#define-app) in the [Rstack configuration file](/guide/configuration#configuration-file). It accepts the standard [Rsbuild configuration](https://rsbuild.rs/config/):
32+
Configure production builds with [`define.app()`](../configuration#define-app) in `rstack.config.ts`. The API accepts the standard [Rsbuild configuration](https://rsbuild.rs/config/):
3333

3434
```ts title="rstack.config.ts"
3535
import { define } from 'rstack';

website/docs/en/guide/cli/dev.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Examples:
2020
# Start the server and open the page in the browser
2121
rs dev --open
2222

23-
# Use port 8080 and fail if it is already in use
23+
# Use port 8080 and exit if it is already in use
2424
rs dev --port 8080 --strict-port
2525

2626
# Make the server available on the local network
@@ -29,7 +29,7 @@ rs dev --host
2929

3030
## Configuration
3131

32-
Configure the development server through [`define.app()`](../configuration#define-app) in the [Rstack configuration file](/guide/configuration#configuration-file). It accepts the standard [Rsbuild configuration](https://rsbuild.rs/config/):
32+
Configure the development server with [`define.app()`](../configuration#define-app) in `rstack.config.ts`. The API accepts the standard [Rsbuild configuration](https://rsbuild.rs/config/):
3333

3434
```ts title="rstack.config.ts"
3535
import { define } from 'rstack';

website/docs/en/guide/cli/doc.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
import { PackageManagerTabs } from '@rspress/core/theme';
44

5-
The `rs doc` command uses [Rspress](https://rspress.rs/guide/start/introduction) to develop, build, and preview a documentation site.
5+
The `rs doc` command uses [Rspress](https://rspress.rs/guide/start/introduction) to develop, build, and locally preview a documentation site.
66

7-
Install [`@rspress/core`](https://www.npmjs.com/package/@rspress/core) before using the command:
7+
[`@rspress/core`](https://www.npmjs.com/package/@rspress/core) is an optional dependency. Install it before using `rs doc`:
88

99
<PackageManagerTabs command="install -D @rspress/core" />
1010

@@ -54,15 +54,15 @@ rs doc preview
5454

5555
### eject
5656

57-
[`rs doc eject`](https://rspress.rs/api/commands#rspress-eject) copies a built-in Rspress theme component into the project for customization. Run it without a component name to list all ejectable components.
57+
[`rs doc eject`](https://rspress.rs/api/commands#rspress-eject) copies a built-in Rspress theme component into the project for customization. Run it without a component name to list the available components.
5858

5959
```bash
6060
rs doc eject
6161
```
6262

6363
## Configuration
6464

65-
Configure the documentation site through [`define.doc()`](../configuration#define-doc) in the [Rstack configuration file](/guide/configuration#configuration-file). It accepts the standard [Rspress configuration](https://rspress.rs/api/config/config-basic):
65+
Configure the documentation site with [`define.doc()`](../configuration#define-doc) in `rstack.config.ts`. The API accepts the standard [Rspress configuration](https://rspress.rs/api/config/config-basic):
6666

6767
```ts title="rstack.config.ts"
6868
import { define } from 'rstack';

website/docs/en/guide/cli/lib.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ rs lib mf-dev
4444

4545
## Configuration
4646

47-
Configure library builds through [`define.lib()`](../configuration#define-lib) in the [Rstack configuration file](/guide/configuration#configuration-file). It accepts the standard [Rslib configuration](https://rslib.rs/config/):
47+
Configure library builds with [`define.lib()`](../configuration#define-lib) in `rstack.config.ts`. The API accepts the standard [Rslib configuration](https://rslib.rs/config/):
4848

4949
```ts title="rstack.config.ts"
5050
import { define } from 'rstack';

website/docs/en/guide/cli/lint.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# lint
22

3-
The `rs lint` command uses [Rslint](https://rslint.rs/guide/) to lint source code.
3+
The `rs lint` command uses [Rslint](https://rslint.rs/guide/) to lint source files.
44

55
## Usage
66

@@ -29,7 +29,7 @@ rs lint --type-check
2929

3030
## Configuration
3131

32-
Configure linting through [`define.lint()`](../configuration#define-lint) in the [Rstack configuration file](/guide/configuration#configuration-file). It accepts the standard [Rslint configuration](https://rslint.rs/config/). Presets and plugins can be imported from `rstack/lint` on demand:
32+
Configure linting with [`define.lint()`](../configuration#define-lint) in `rstack.config.ts`. The API accepts the standard [Rslint configuration](https://rslint.rs/config/). Presets and plugins can be imported from `rstack/lint` on demand:
3333

3434
```ts title="rstack.config.ts"
3535
import { define } from 'rstack';

website/docs/en/guide/cli/preview.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# preview
22

3-
The `rs preview` command uses [Rsbuild](https://rsbuild.rs/guide/basic/cli#rsbuild-preview) to preview an application's production build locally.
3+
The `rs preview` command uses [Rsbuild](https://rsbuild.rs/guide/basic/cli#rsbuild-preview) to preview an application's production output locally.
44

55
## Usage
66

77
```bash
88
rs preview [options]
99
```
1010

11-
The command loads the application configuration registered with [`define.app()`](../configuration#define-app). Run [`rs build`](./build) before starting the preview server to generate the production output:
11+
The command loads the application configuration registered with [`define.app()`](../configuration#define-app). Before starting the preview server, run [`rs build`](./build) to generate the production output:
1212

1313
```bash
1414
rs build
@@ -27,7 +27,7 @@ Examples:
2727
# Start the preview server and open the page in the browser
2828
rs preview --open
2929

30-
# Use port 8080 and fail if it is already in use
30+
# Use port 8080 and exit if it is already in use
3131
rs preview --port 8080 --strict-port
3232

3333
# Make the preview server available on the local network
@@ -36,7 +36,7 @@ rs preview --host
3636

3737
## Configuration
3838

39-
Configure the preview server through [`define.app()`](../configuration#define-app) in the [Rstack configuration file](/guide/configuration#configuration-file). It accepts the standard [Rsbuild configuration](https://rsbuild.rs/config/):
39+
Configure the preview server with [`define.app()`](../configuration#define-app) in `rstack.config.ts`. The API accepts the standard [Rsbuild configuration](https://rsbuild.rs/config/):
4040

4141
```ts title="rstack.config.ts"
4242
import { define } from 'rstack';

website/docs/en/guide/cli/staged.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# staged
22

3-
The `rs staged` command uses [lint-staged](https://github.com/lint-staged/lint-staged) to run tasks against files staged in Git.
3+
The `rs staged` command uses [lint-staged](https://github.com/lint-staged/lint-staged) to run tasks against files staged for commit.
44

5-
A common use case is to run linters, formatters, or other checks on staged files before committing code.
5+
It is typically used in a Git hook to lint, format, or otherwise check files before a commit.
66

77
## Usage
88

@@ -16,7 +16,7 @@ The command loads the staged-file tasks registered with [`define.staged()`](../c
1616

1717
### `--allow-empty`
1818

19-
`--allow-empty` allows an empty commit when tasks revert all staged changes.
19+
`--allow-empty` allows the commit to proceed if tasks revert all staged changes.
2020

2121
```bash
2222
rs staged --allow-empty
@@ -48,7 +48,7 @@ rs staged --debug
4848

4949
### `--no-stash`
5050

51-
`--no-stash` disables the backup stash and keeps changes made by tasks when an error occurs.
51+
`--no-stash` disables the backup stash and automatic reversion when a task fails.
5252

5353
```bash
5454
rs staged --no-stash
@@ -88,7 +88,7 @@ rs staged --help
8888

8989
## Configuration
9090

91-
Configure staged-file tasks through [`define.staged()`](../configuration#define-staged) in the [Rstack configuration file](/guide/configuration#configuration-file). It accepts the standard [lint-staged configuration](https://github.com/lint-staged/lint-staged#configuration):
91+
Configure staged-file tasks with [`define.staged()`](../configuration#define-staged) in `rstack.config.ts`. The API accepts the standard [lint-staged configuration](https://github.com/lint-staged/lint-staged#configuration):
9292

9393
```ts title="rstack.config.ts"
9494
import { define } from 'rstack';

website/docs/en/guide/cli/test.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The `rs test` command uses [Rstest](https://rstest.rs/guide/basic/cli) to run tests.
44

5-
For more guidance on testing, see [Testing](../testing).
5+
> For more guidance on testing, see [Testing](../testing).
66
77
## Usage
88

@@ -65,15 +65,15 @@ rs test merge-reports
6565

6666
### init
6767

68-
[`rs test init`](https://rstest.rs/guide/basic/cli#rstest-init) creates starter files for a supported Rstest project type.
68+
[`rs test init`](https://rstest.rs/guide/basic/cli#rstest-init) initializes an Rstest configuration for a supported project type.
6969

7070
```bash
7171
rs test init browser
7272
```
7373

7474
## Configuration
7575

76-
Configure tests through [`define.test()`](../configuration#define-test) in the [Rstack configuration file](/guide/configuration#configuration-file). It accepts the standard [Rstest configuration](https://rstest.rs/config/):
76+
Configure tests with [`define.test()`](../configuration#define-test) in `rstack.config.ts`. The API accepts the standard [Rstest configuration](https://rstest.rs/config/):
7777

7878
```ts title="rstack.config.ts"
7979
import { define } from 'rstack';

0 commit comments

Comments
 (0)