Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix mistakes in cli.mdx #4127

Merged
merged 1 commit into from
Dec 5, 2024
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
4 changes: 2 additions & 2 deletions website/docs/en/guide/basic/cli.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CLI

Rsbuild comes with a lightweight CLI that includes commands such as `dev` and `build`.
Rsbuild comes with a lightweight CLI that includes commands such as [rsbuild dev](#rsbuild-dev) and [rsbuild build](#rsbuild-build).

## rsbuild -h

Expand Down Expand Up @@ -124,7 +124,7 @@ Options:
-c --config <config> specify the configuration file, can be a relative or absolute path
-r --root <root> specify the project root directory, can be an absolute path or a path relative to cwd
-m --mode <mode> specify the build mode, can be `development`, `production` or `none`
--output <output> specify the path to output in the dist (default: "/")
--output <output> specify the path to output in the dist (default: ".rsbuild")
--verbose show the full function in the result
--env-mode <mode> specify the env mode to load the `.env.[mode]` file
--env-dir <dir> specify the directory to load `.env` files
Expand Down
8 changes: 4 additions & 4 deletions website/docs/zh/guide/advanced/env-vars.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ Rsbuild 会依次读取以下文件:
- .env.test.local

:::tip
`--env-mode` 选项的优先级高于 process.env.NODE_ENV。
`--env-mode` 选项的优先级高于 `process.env.NODE_ENV`

推荐使用 `--env-mode` 来指定 env 模式,不建议修改 process.env.NODE_ENV。
推荐使用 `--env-mode` 来指定 env 模式,不建议修改 `process.env.NODE_ENV`

:::

Expand Down Expand Up @@ -260,13 +260,13 @@ console.log(process.env.FOO); // 'hello'
console.log(process.env.BAR); // '1'
```

此时在创建 `.env.local` 文件,添加以下内容:
此时,创建一个 `.env.local` 文件,添加以下内容:

```shell title=".env.local"
BAR=2
```

此时 `BAR` 的值被覆盖为 `'2'`:
`BAR` 的值会被覆盖为 `'2'`:

```ts title="rsbuild.config.ts"
console.log(import.meta.env.BAR); // '2'
Expand Down
18 changes: 9 additions & 9 deletions website/docs/zh/guide/basic/cli.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 命令行工具

Rsbuild 内置了一个轻量的命令行工具,包含 devbuild 等命令。
Rsbuild 内置了一个轻量的命令行工具,包含 [rsbuild dev](#rsbuild-dev)、[rsbuild build](#rsbuild-build) 等命令。

## rsbuild -h

Expand All @@ -16,15 +16,15 @@ npx rsbuild -h
Usage: rsbuild <command> [options]

Options:
-V, --version output the version number
-h, --help display help for command
-V, --version 显示版本号
-h, --help 显示命令帮助

Commands:
dev [options] starting the dev server
build [options] build the app for production
preview [options] preview the production build locally
inspect [options] inspect the Rspack and Rsbuild configs
help [command] display help for command
dev [options] 启动开发服务器
build [options] 构建生产环境产物
preview [options] 本地预览生产环境产物
inspect [options] 检查 Rspack Rsbuild 配置
help [command] 显示命令帮助
```

## rsbuild dev
Expand Down Expand Up @@ -124,7 +124,7 @@ Options:
-c --config <config> 指定配置文件路径,可以为相对路径或绝对路径
-r --root <root> 指定项目根目录,可以是绝对路径或者相对于 cwd 的路径
-m --mode <mode> 指定构建模式,可以是 `development`,`production` 或 `none`
--output <output> 指定在 dist 目录下输出的路径 (default: "/")
--output <output> 指定在 dist 目录下输出的路径 (default: ".rsbuild")
--verbose 在结果中展示函数的完整内容
--env-mode <mode> 指定 env 模式来加载 `.env.[mode]` 文件
--env-dir <dir> 指定目录来加载 `.env` 文件
Expand Down
Loading