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: serve command package component #6261

Merged
merged 2 commits into from
Sep 25, 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
5 changes: 5 additions & 0 deletions .changeset/twelve-ghosts-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@modern-js/main-doc': patch
---

serve command package component
25 changes: 3 additions & 22 deletions packages/document/main-doc/docs/en/apis/app/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -153,28 +153,9 @@ The `--config` parameter needs to use a JSON string.
pnpm does not support the use of JSON strings as parameter values currently. Use `npm new` to turn on.【[Relate Issue](https://github.com/pnpm/pnpm/issues/3876)】
:::

## modern serve
import ServeCommand from "@site-docs-en/components/serve-command";

The `modern serve` command is used to start a Modern.js project in the production environment. It can also be used to preview the artifacts built for the production environment locally. Please note that you need to execute the [`build`](/apis/app/commands#modern-build) command beforehand to generate the corresponding artifacts.

```bash
Usage: modern serve [options]

Options:
-c --config <config> specify the configuration file, which can be a relative or absolute path
-h, --help show command help
--api-only only run API service
```

By default, the project will run in `localhost:8080`, you can modify the server port number with `server.port`:

```js
export default defineConfig({
server: {
port: 8081,
},
});
```
<ServeCommand />

## modern upgrade

Expand Down Expand Up @@ -252,4 +233,4 @@ Inspect config succeed, open following files to view the content:

import DeployCommand from "@site-docs-en/components/deploy-command";

<DeployCommand />
<DeployCommand />
22 changes: 22 additions & 0 deletions packages/document/main-doc/docs/en/components/serve-command.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## modern serve

The `modern serve` command is used to start a Modern.js project in the production environment. It can also be used to preview the artifacts built for the production environment locally. Please note that you need to execute the [`build`](/apis/app/commands#modern-build) command beforehand to generate the corresponding artifacts.

```bash
Usage: modern serve [options]

Options:
-c --config <config> specify the configuration file, which can be a relative or absolute path
-h, --help show command help
--api-only only run API service
```

By default, the project will run in `localhost:8080`, you can modify the server port number with `server.port`:

```js
export default defineConfig({
server: {
port: 8081,
},
});
```
25 changes: 3 additions & 22 deletions packages/document/main-doc/docs/zh/apis/app/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -153,28 +153,9 @@ pnpm 暂不支持使用 JSON 字符串作为参数值,可使用 `npm new` 开

:::

## modern serve
import ServeCommand from "@site-docs/components/serve-command";

`modern serve` 命令用于在生产环境下启动 Modern.js 工程, 也可以用于在本地预览生产环境构建的产物。注意你需要提前执行 [`build`](/apis/app/commands#modern-build) 命令构建出对应产物。

```bash
Usage: modern serve [options]

Options:
-c --config <config> 指定配置文件路径,可以为相对路径或绝对路径
-h, --help 显示命令帮助
--api-only 仅启动 API 接口服务
```

默认情况下,应用将会在 `localhost:8080` 启动,可以通过 `server.port` 修改 Server 端口号:

```js
export default defineConfig({
server: {
port: 8081,
},
});
```
<ServeCommand />

## modern upgrade

Expand Down Expand Up @@ -252,4 +233,4 @@ Inspect config succeed, open following files to view the content:

import DeployCommand from "@site-docs/components/deploy-command";

<DeployCommand />
<DeployCommand />
22 changes: 22 additions & 0 deletions packages/document/main-doc/docs/zh/components/serve-command.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## modern serve

`modern serve` 命令用于在生产环境下启动 Modern.js 工程, 也可以用于在本地预览生产环境构建的产物。注意你需要提前执行 [`build`](/apis/app/commands#modern-build) 命令构建出对应产物。

```bash
Usage: modern serve [options]

Options:
-c --config <config> 指定配置文件路径,可以为相对路径或绝对路径
-h, --help 显示命令帮助
--api-only 仅启动 API 接口服务
```

默认情况下,应用将会在 `localhost:8080` 启动,可以通过 `server.port` 修改 Server 端口号:

```js
export default defineConfig({
server: {
port: 8081,
},
});
```
Loading