Skip to content

Commit 9225ff6

Browse files
Mister-Hopeulivz
authored andcommitted
docs($cn): sync (#1915)
1 parent fa8a41d commit 9225ff6

File tree

5 files changed

+126
-5
lines changed

5 files changed

+126
-5
lines changed

packages/docs/docs/zh/guide/deploy.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,15 @@ cd -
6565
如果你打算发布到 `https://<USERNAME or GROUP>.github.io/<REPO>/`(也就是说你的仓库在 `https://github.com/<USERNAME>/<REPO>`),则将 `base` 设置为 `"/<REPO>/"`
6666

6767
2. 在项目的根目录创建一个名为 `.travis.yml` 的文件;
68-
3. 使用 GitHub Pages 部署提供程序模板并遵循 [Travis 文档](https://docs.travis-ci.com/user/deployment/pages/)
68+
3. 在本地执行 `npm install` 并且在提交中包含 `package-lock.json` 因为 `npm ci` 需要它才能正确执行.
69+
4. 使用 GitHub Pages 部署提供程序模板并遵循 [Travis 文档](https://docs.travis-ci.com/user/deployment/pages/)
6970

7071
``` yaml
7172
language: node_js
7273
node_js:
7374
- lts/*
75+
install:
76+
- npm ci
7477
script:
7578
- npm run docs:build
7679
deploy:

packages/docs/docs/zh/guide/using-vue.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,32 @@ export default {
2626
</script>
2727
```
2828

29+
如果你的模块通过 `export default` 导出一个 Vue 组件,那么你可以动态注册它:
30+
31+
```vue
32+
<template>
33+
<component v-if="dynamicComponent" :is="dynamicComponent"></component>
34+
</template>
35+
<script>
36+
export default {
37+
data() {
38+
return {
39+
dynamicComponent: null
40+
}
41+
},
42+
mounted () {
43+
import('./lib-that-access-window-on-import').then(module => {
44+
this.dynamicComponent = module.default
45+
})
46+
}
47+
}
48+
</script>
49+
```
50+
51+
**参考:**
52+
53+
- [Vue.js > 动态组件](https://cn.vuejs.org/v2/guide/components.html#动态组件)
54+
2955
## 模板语法
3056

3157
### 插值

packages/docs/docs/zh/miscellaneous/local-development.md

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,96 @@
22
sidebar: auto
33
---
44

5-
# need trad
5+
# 本地开发
6+
7+
## 摘要
8+
9+
如果你看到此处,你可能会对改进 VuePress 核心感兴趣。
10+
11+
VuePress 正在使用包含了 [Yarn Workspaces](https://yarnpkg.com/zh-Hans/docs/workspaces/)[Lerna](https://github.com/lerna/lerna) 的一个组合。
12+
13+
## 初始化 package
14+
15+
```bash
16+
yarn bootstrap // 它将运行并安装根目录和所有 package 的依赖
17+
```
18+
19+
`yarn bootstrap` 将使用 `hoist`。它对你意味着什么?
20+
21+
它将重组工作空间根目录中的所有依赖项并链接所有 package。
22+
23+
通过运行以下命令来检查链接:
24+
25+
```bash
26+
ls -la node_modules/@vuepress
27+
```
28+
29+
你将全部链接完成。
30+
31+
::: warning
32+
你必须注意应在子文件夹的 package.json 中声明所有依赖项。如果未声明 package 的 dependencies,则在发布到 npm 时将无法正常工作。
33+
:::
34+
35+
::: warning
36+
你应该留意一个特殊的 package `@vuepress/shared-utils`,它是由 Typescript 编写的。
37+
:::
38+
39+
安装完所有依赖后,它将运行 `yarn tsc` 。该命令将告诉 workspace 的 `@vuepress/shared-utils` 来编译他的 js。
40+
41+
::: warning
42+
从这里开始,如果你要在此 package 中进行更改,则必须始终运行 `yarn tsc` 或在单独的终端中运行 `yarn run tsc -w` 。当检测到 shared-utils 有任何更改时,它将重新运行 tsc。
43+
:::
44+
45+
## 链接
46+
47+
从这里开始就很不错了,你已经准备就绪。你需要将 VuePress 链接到你的项目。
48+
49+
```bash
50+
yarn register-vuepress
51+
```
52+
53+
你将看到类似这样的内容:`success Registered "vuepress".`
54+
55+
它将链接来自 `packages/vuepress` 的 VuePress 包。 你将可以访问 VuePress 脚手架和其他内部的 packages,他们在 `packages/vuepress/package.json` 被声明。
56+
57+
```js
58+
{
59+
"main": "index.js",
60+
///
61+
"bin": {
62+
"vuepress": "cli.js"
63+
}
64+
///
65+
}
66+
```
67+
68+
现在转到你的项目并运行 `yarn link vuepress`
69+
70+
你应该得到 `success Using linked package for "vuepress".`
71+
72+
## 取消链接
73+
74+
你可能想要取消所有链接。在工作区根文件夹中,运行:
75+
76+
```bash
77+
yarn unregister-vuepress
78+
```
79+
80+
现在你可以在你的项目文件夹中运行 `yarn unlink vuepress`
81+
82+
如果一切运行正常,当你在你的项目文件夹中再次运行 `yarn link vuepress` ,你应该获得一个错误提示你找不到名为 vuepress 的软件包。
83+
84+
## BUGS / 问答
85+
86+
你可能会发现链接有些困难。如果你触发了一些类似 `There's already a package called "vuepress" registered` 之类的内容,你已经注册了 VuePress :
87+
88+
- 如果你已经从[链接](#链接)链接了 VuePress ,就已经很好了。如果你进行更改,由于它是 symbolic link,你不必重新运行任何指令。只有当你更新 shared-utils 软件包时,才必须重新运行 `yarn tsc` ,仅此而已。
89+
- 如果你什么也没做。那么你已经将 VuePress 链接到某处。你要做的就是删除你运行 `yarn link``yarn unlink` 的文件夹。
90+
91+
## 更多相关
92+
93+
你可以使用更多有趣的命令:
94+
95+
- `yarn packages:list` 将列出所有存在的 packages 及其版本 [更多](https://github.com/lerna/lerna/tree/master/commands/list#readme)
96+
- `yarn packages:changed` 会告诉你哪些 packages 将受到下一个 lerna 的 发布/版本 的影响 [更多](https://github.com/lerna/lerna/tree/master/commands/changed#readme)
97+
- `yarn packages:diff` 将显示上一个版本依赖所有差异 [更多](https://github.com/lerna/lerna/tree/master/commands/diff#readme)

packages/docs/docs/zh/plugin/official/plugin-google-analytics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ metaTitle: Google Analytics 插件 | VuePress
1010
## 安装
1111

1212
```bash
13-
yarn add -D @vuepress/plugin-google-analytics@next
14-
# OR npm install -D @vuepress/plugin-google-analytics@next
13+
yarn add -D @vuepress/plugin-google-analytics
14+
# OR npm install -D @vuepress/plugin-google-analytics
1515
```
1616

1717
## 使用

packages/docs/docs/zh/theme/option-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ module.exports = {
9191
}
9292
```
9393

94-
全局布局组件是负责管理全局布局方案的一个组件,VuePress [默认的 globalLayout](https://github.com/vuejs/vuepress/blob/master/packages/%40vuepress/core/lib/app/components/GlobalLayout.vue)会帮你根据 [$frontmatter.layout](../guide/frontmatter.md#layout) 来渲染不同的布局,所以大部分情况下你不要配置此选项。
94+
全局布局组件是负责管理全局布局方案的一个组件,VuePress [默认的 globalLayout](https://github.com/vuejs/vuepress/blob/master/packages/%40vuepress/core/lib/client/components/GlobalLayout.vue)会帮你根据 [$frontmatter.layout](../guide/frontmatter.md#layout) 来渲染不同的布局,所以大部分情况下你不要配置此选项。
9595

9696
举例来说,当你想为当前主题设置全局的 header 和 footer 时,你可以这样做:
9797

0 commit comments

Comments
 (0)