Skip to content

Commit d2b9550

Browse files
authored
docs: clarify CLI invocation in quick start (#522)
1 parent 2b8a15f commit d2b9550

3 files changed

Lines changed: 84 additions & 27 deletions

File tree

‎scripts/dictionary.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Custom Dictionary Words
22
applypatch
33
bundleless
4+
bunx
45
cdpath
56
clippy
67
dirents

‎website/docs/en/guide/quick-start.mdx‎

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,23 @@ Install [`rstack`](https://www.npmjs.com/package/rstack) as a development depend
124124

125125
## CLI commands
126126

127-
Add the commands your project needs to the `scripts` field in `package.json`. For example:
127+
The following commands are available:
128+
129+
- [`rs dev`](./cli/dev): Start the application development server.
130+
- [`rs build`](./cli/build): Build the application for production.
131+
- [`rs preview`](./cli/preview): Preview the application's production build locally.
132+
- [`rs lib`](./cli/lib): Build a library with Rslib.
133+
- [`rs doc`](./cli/doc): Develop, build, or preview a documentation site with Rspress.
134+
- [`rs test`](./cli/test): Run tests with Rstest.
135+
- [`rs check`](./cli/check): Run linting and formatting checks, with optional TypeScript type checking.
136+
- [`rs lint`](./cli/lint): Lint source code with Rslint.
137+
- [`rs fmt`](./cli/fmt): Format code.
138+
- [`rs hooks`](./cli/hooks): Install, update, or uninstall repository-level Git hooks.
139+
- [`rs staged`](./cli/staged): Run tasks against files staged in Git with lint-staged.
140+
141+
### Run with package scripts
142+
143+
Add frequently used commands to the `scripts` field in `package.json`:
128144

129145
```json title="package.json"
130146
{
@@ -140,21 +156,33 @@ Add the commands your project needs to the `scripts` field in `package.json`. Fo
140156
}
141157
```
142158

159+
Then run the script with your package manager. For example, to run the `dev` script above:
160+
161+
<PackageManagerTabs
162+
command={{
163+
pnpm: 'pnpm run dev',
164+
npm: 'npm run dev',
165+
yarn: 'yarn run dev',
166+
bun: 'bun run dev',
167+
}}
168+
/>
169+
143170
Package scripts use the project-local `rs` binary, so Rstack CLI does not need to be installed globally.
144171

145-
The following commands are available:
172+
### Run directly in the terminal
146173

147-
- [`rs dev`](./cli/dev): Start the application development server.
148-
- [`rs build`](./cli/build): Build the application for production.
149-
- [`rs preview`](./cli/preview): Preview the application's production build locally.
150-
- [`rs lib`](./cli/lib): Build a library with Rslib.
151-
- [`rs doc`](./cli/doc): Develop, build, or preview a documentation site with Rspress.
152-
- [`rs test`](./cli/test): Run tests with Rstest.
153-
- [`rs check`](./cli/check): Run linting and formatting checks, with optional TypeScript type checking.
154-
- [`rs lint`](./cli/lint): Lint source code with Rslint.
155-
- [`rs fmt`](./cli/fmt): Format code.
156-
- [`rs hooks`](./cli/hooks): Install, update, or uninstall repository-level Git hooks.
157-
- [`rs staged`](./cli/staged): Run tasks against files staged in Git with lint-staged.
174+
You can also run Rstack CLI through your package manager without adding a package script. For example, to start the development server directly:
175+
176+
<PackageManagerTabs
177+
command={{
178+
pnpm: 'pnpm rs dev',
179+
npm: 'npx rs dev',
180+
yarn: 'yarn exec rs dev',
181+
bun: 'bunx rs dev',
182+
}}
183+
/>
184+
185+
Rstack CLI also provides `rstack` as an alias for `rs`. For example, `pnpm rstack dev` is equivalent to `pnpm rs dev`.
158186

159187
## Configure Rstack CLI \{#configure-rstack}
160188

‎website/docs/zh/guide/quick-start.mdx‎

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,23 @@ Available templates: app-vanilla, app-vanilla-ts, app-react, app-react-ts, app-p
124124

125125
## CLI 命令 \{#cli-commands}
126126

127-
在 `package.json` 的 `scripts` 字段中添加项目所需的命令,例如:
127+
Rstack CLI 提供以下命令:
128+
129+
- [`rs dev`](./cli/dev):启动应用开发服务器。
130+
- [`rs build`](./cli/build):构建应用的生产版本。
131+
- [`rs preview`](./cli/preview):在本地预览应用的生产构建产物。
132+
- [`rs lib`](./cli/lib):使用 Rslib 构建库。
133+
- [`rs doc`](./cli/doc):使用 Rspress 开发、构建或预览文档站点。
134+
- [`rs test`](./cli/test):使用 Rstest 运行测试。
135+
- [`rs check`](./cli/check):运行 lint 和格式检查,并可选启用 TypeScript 类型检查。
136+
- [`rs lint`](./cli/lint):使用 Rslint 检查源代码。
137+
- [`rs fmt`](./cli/fmt):格式化代码。
138+
- [`rs hooks`](./cli/hooks):安装、更新或卸载仓库级 Git hooks。
139+
- [`rs staged`](./cli/staged):使用 lint-staged 对 Git 暂存区中的文件运行任务。
140+
141+
### 通过项目脚本运行 \{#run-with-package-scripts}
142+
143+
将常用命令添加到 `package.json` 的 `scripts` 字段中:
128144

129145
```json title="package.json"
130146
{
@@ -140,21 +156,33 @@ Available templates: app-vanilla, app-vanilla-ts, app-react, app-react-ts, app-p
140156
}
141157
```
142158

143-
package scripts 会使用项目本地安装的 `rs` 命令,因此无需全局安装 Rstack CLI。
159+
然后通过包管理器运行对应的脚本。例如,运行上面定义的 `dev` 脚本:
144160

145-
Rstack CLI 提供以下命令:
161+
<PackageManagerTabs
162+
command={{
163+
pnpm: 'pnpm run dev',
164+
npm: 'npm run dev',
165+
yarn: 'yarn run dev',
166+
bun: 'bun run dev',
167+
}}
168+
/>
146169

147-
- [`rs dev`](./cli/dev):启动应用开发服务器。
148-
- [`rs build`](./cli/build):构建应用的生产版本。
149-
- [`rs preview`](./cli/preview):在本地预览应用的生产构建产物。
150-
- [`rs lib`](./cli/lib):使用 Rslib 构建库。
151-
- [`rs doc`](./cli/doc):使用 Rspress 开发、构建或预览文档站点。
152-
- [`rs test`](./cli/test):使用 Rstest 运行测试。
153-
- [`rs check`](./cli/check):运行 lint 和格式检查,并可选启用 TypeScript 类型检查。
154-
- [`rs lint`](./cli/lint):使用 Rslint 检查源代码。
155-
- [`rs fmt`](./cli/fmt):格式化代码。
156-
- [`rs hooks`](./cli/hooks):安装、更新或卸载仓库级 Git hooks。
157-
- [`rs staged`](./cli/staged):使用 lint-staged 对 Git 暂存区中的文件运行任务。
170+
项目脚本会使用本地安装的 `rs` 命令,因此无需全局安装 Rstack CLI。
171+
172+
### 直接在终端运行 \{#run-directly-in-the-terminal}
173+
174+
也可以直接通过包管理器运行 Rstack CLI,无需在 `package.json` 中添加脚本。例如,直接启动开发服务器:
175+
176+
<PackageManagerTabs
177+
command={{
178+
pnpm: 'pnpm rs dev',
179+
npm: 'npx rs dev',
180+
yarn: 'yarn exec rs dev',
181+
bun: 'bunx rs dev',
182+
}}
183+
/>
184+
185+
Rstack CLI 也提供 `rstack` 作为 `rs` 的别名。例如,`pnpm rstack dev` 与 `pnpm rs dev` 等效。
158186

159187
## 配置 Rstack CLI \{#configure-rstack}
160188

0 commit comments

Comments
 (0)