From 6c1647e95e6836e60e6efe1dfa0768a7752af38d Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 5 Dec 2024 16:50:43 +0800 Subject: [PATCH] docs: fix mistakes in cli.mdx --- website/docs/en/guide/basic/cli.mdx | 4 ++-- website/docs/zh/guide/advanced/env-vars.mdx | 8 ++++---- website/docs/zh/guide/basic/cli.mdx | 18 +++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/website/docs/en/guide/basic/cli.mdx b/website/docs/en/guide/basic/cli.mdx index 3afea1020d..4380072231 100644 --- a/website/docs/en/guide/basic/cli.mdx +++ b/website/docs/en/guide/basic/cli.mdx @@ -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 @@ -124,7 +124,7 @@ Options: -c --config specify the configuration file, can be a relative or absolute path -r --root specify the project root directory, can be an absolute path or a path relative to cwd -m --mode specify the build mode, can be `development`, `production` or `none` - --output specify the path to output in the dist (default: "/") + --output specify the path to output in the dist (default: ".rsbuild") --verbose show the full function in the result --env-mode specify the env mode to load the `.env.[mode]` file --env-dir specify the directory to load `.env` files diff --git a/website/docs/zh/guide/advanced/env-vars.mdx b/website/docs/zh/guide/advanced/env-vars.mdx index 3a4fffe07c..5105429a28 100644 --- a/website/docs/zh/guide/advanced/env-vars.mdx +++ b/website/docs/zh/guide/advanced/env-vars.mdx @@ -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`。 ::: @@ -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' diff --git a/website/docs/zh/guide/basic/cli.mdx b/website/docs/zh/guide/basic/cli.mdx index 21a0e71e39..44869f940f 100644 --- a/website/docs/zh/guide/basic/cli.mdx +++ b/website/docs/zh/guide/basic/cli.mdx @@ -1,6 +1,6 @@ # 命令行工具 -Rsbuild 内置了一个轻量的命令行工具,包含 dev、build 等命令。 +Rsbuild 内置了一个轻量的命令行工具,包含 [rsbuild dev](#rsbuild-dev)、[rsbuild build](#rsbuild-build) 等命令。 ## rsbuild -h @@ -16,15 +16,15 @@ npx rsbuild -h Usage: rsbuild [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 @@ -124,7 +124,7 @@ Options: -c --config 指定配置文件路径,可以为相对路径或绝对路径 -r --root 指定项目根目录,可以是绝对路径或者相对于 cwd 的路径 -m --mode 指定构建模式,可以是 `development`,`production` 或 `none` - --output 指定在 dist 目录下输出的路径 (default: "/") + --output 指定在 dist 目录下输出的路径 (default: ".rsbuild") --verbose 在结果中展示函数的完整内容 --env-mode 指定 env 模式来加载 `.env.[mode]` 文件 --env-dir 指定目录来加载 `.env` 文件