Skip to content
Merged
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
27 changes: 24 additions & 3 deletions src/content/docs/zh-cn/reference/cli-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Flags

构建你的网站以进行部署。默认情况下,这将生成静态文件并将它们放在 `dist/` 目录中。如果有任何路由是[按需渲染](/zh-cn/guides/on-demand-rendering/)的,这将生成必要的服务器文件为你的网站提供服务。

### 标志
<h3>标志</h3>

该命令接受 [通用标志](#通用标志) 和以下额外标志:

Expand All @@ -206,9 +206,11 @@ Flags

该命令允许你在部署之前[构建](#astro-build)本地预览你的网站,以便在构建输出中捕获任何错误。它不是为在生产环境中运行而设计的。有关生产托管的帮助,请查看我们的[部署 Astro 网站](/zh-cn/guides/deploy/)指南。

从 Astro 1.5.0 开始,[Node 适配器](/zh-cn/guides/integrations-guide/node/) 支持按需渲染构建生成的 `astro preview`。
在运行 Astro 预览服务器的终端中,可以使用以下快捷键:
- `o` + `enter` 在浏览器中打开 Astro 网站。
- `q` + `enter` 退出预览服务器。

可以与下面文档的[通用标志](#通用标志)结合使用。
`astro preview` 命令可以和下面文档的 [通用标志](#通用标志) 结合使用,以进一步控制预览体验

## `astro check`

Expand Down Expand Up @@ -298,6 +300,14 @@ Adapter none
Integrations @astrojs/starlight (v0.35.3)
```

<h3>标志</h3>

使用以下标志来定制命令的行为。

#### `--copy`

该命令会将输出复制到剪贴板,而不会发出提示。

## `astro preferences`

使用 `astro preferences` 命令管理用户偏好。用户偏好是特定于单个 Astro 用户的,不像 `astro.config.mjs` 文件,它会改变所有项目的所有人的行为。
Expand Down Expand Up @@ -376,6 +386,17 @@ astro telemetry reset
将 `astro telemetry disable` 命令添加到你的 CI 脚本或设置 `ASTRO_TELEMETRY_DISABLED` 环境变量。
:::

## `astro create-key`

生成一个密钥,用于加密传递给服务器群岛的属性。

```shell
astro create-key
```

将此密钥设置为 `ASTRO_KEY` 环境变量(例如在 `.env` 文件中),并在需要 [为服务器群岛提供常量加密密钥](/zh-cn/guides/server-islands/#复用加密密钥) 时,将其包含在 CI/CD 或主机的构建设置中,例如滚动部署、多区域托管或缓存包含服务器群岛的页面的 CDN。


## 通用标志

### `--root <path>`
Expand Down