diff --git a/docs/guide/commands.md b/docs/guide/commands.md new file mode 100644 index 0000000000..6f9cf2d3b5 --- /dev/null +++ b/docs/guide/commands.md @@ -0,0 +1,43 @@ +--- +toc: content +group: 其他 +order: 1 +--- + +# 命令行 + +## `dumi dev` + +启动本地开发服务器,进行项目的开发与调试。 + +## `dumi build` + +构建 dumi 文档产物,适用于生产环境的部署。 + +## `dumi preview` + +在本地启动一个静态 Web 服务器,将 docs-dist 文件夹运行在 http://127.0.0.1:4172, 用于预览构建后产物。 + +你可以通过 `--port` 参数来配置服务的运行端口。 + +```bash +dumi preview --port 9527 +``` + +现在 `preview` 命令会将服务器运行在 http://127.0.0.1:9527 + +## `dumi setup` + +初始化项目,会做临时文件的生成等操作。通常在 package.json 的 `scripts.prepare` 里设置。 + +```json +{ + "scripts": { + "prepare": "dumi setup" + } +} +``` + +## `dumi version` + +查看 dumi 版本,等同于 `dumi -v`。 diff --git a/docs/guide/faq.md b/docs/guide/faq.md index 071ae3554f..904012e804 100644 --- a/docs/guide/faq.md +++ b/docs/guide/faq.md @@ -1,6 +1,6 @@ --- group: 其他 -order: 2 +order: 3 --- # 常见问题 diff --git a/docs/guide/upgrading.md b/docs/guide/upgrading.md index df0dc83ce5..4eddc66174 100644 --- a/docs/guide/upgrading.md +++ b/docs/guide/upgrading.md @@ -2,6 +2,7 @@ group: title: 其他 order: 3 +order: 2 --- # 从 dumi 1.x 升级 diff --git a/suites/boilerplate/templates/react/README.md.tpl b/suites/boilerplate/templates/react/README.md.tpl index 6416578bd6..215100f9a8 100644 --- a/suites/boilerplate/templates/react/README.md.tpl +++ b/suites/boilerplate/templates/react/README.md.tpl @@ -31,6 +31,9 @@ $ {{ npmClient }} run build:watch # build docs $ {{ npmClient }} run docs:build +# Locally preview the production build. +$ {{ npmClient }} run docs:preview + # check your project for potential problems $ {{ npmClient }} run doctor ``` diff --git a/suites/boilerplate/templates/react/package.json.tpl b/suites/boilerplate/templates/react/package.json.tpl index 28d2c168f4..a213ad7db7 100644 --- a/suites/boilerplate/templates/react/package.json.tpl +++ b/suites/boilerplate/templates/react/package.json.tpl @@ -10,6 +10,7 @@ "build": "father build", "build:watch": "father dev", "docs:build": "dumi build", + "docs:preview: "dumi preview", "prepare": "husky install && dumi setup", "doctor": "father doctor", "lint": "npm run lint:es && npm run lint:css", diff --git a/suites/boilerplate/templates/site/README.md.tpl b/suites/boilerplate/templates/site/README.md.tpl index c2b423f365..65ae5cbbd4 100644 --- a/suites/boilerplate/templates/site/README.md.tpl +++ b/suites/boilerplate/templates/site/README.md.tpl @@ -13,6 +13,9 @@ $ {{ npmClient }} start # build docs $ {{ npmClient }} run build + +# Locally preview the production build +$ {{ npmClient }} run preview ``` ## LICENSE diff --git a/suites/boilerplate/templates/site/package.json.tpl b/suites/boilerplate/templates/site/package.json.tpl index 57100cbbb9..18f63c0fbf 100644 --- a/suites/boilerplate/templates/site/package.json.tpl +++ b/suites/boilerplate/templates/site/package.json.tpl @@ -6,6 +6,7 @@ "start": "npm run dev", "dev": "dumi dev", "build": "dumi build", + "preview: "dumi preview", "prepare": "husky install && dumi setup" }, "authors": [{{#author}}