Skip to content

Commit 5f18189

Browse files
Jinjianghaoqunjiang
authored andcommitted
docs(zh): keep updated (#2301)
* docs(zh): keep updated * docs(zh): added Bitbucket cloud deployment
1 parent b5fe501 commit 5f18189

File tree

7 files changed

+102
-12
lines changed

7 files changed

+102
-12
lines changed

docs/zh/config/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module.exports = {
3232
- Type: `string`
3333
- Default: `'/'`
3434

35-
部署应用时的基本 URL。用法和 webpack 本身的 `output.publicPath` 一致,但是 Vue CLI 在一些其他地方也需要用到这个值,所以**请始终使用 `baseUrl` 而不要直接修改 webpack 的 `output.publicPath`**
35+
部署应用包时的基本 URL。用法和 webpack 本身的 `output.publicPath` 一致,但是 Vue CLI 在一些其他地方也需要用到这个值,所以**请始终使用 `baseUrl` 而不要直接修改 webpack 的 `output.publicPath`**
3636

3737
默认情况下,Vue CLI 会假设你的应用是被部署在一个域名的根路径上,例如 `https://www.my-app.com/`。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 `https://www.my-app.com/my-app/`,则设置 `baseUrl``/my-app/`
3838

@@ -198,7 +198,7 @@ module.exports = {
198198

199199
需要注意的是该选项仅影响由 `html-webpack-plugin` 在构建时注入的标签 - 直接写在模版 (`public/index.html`) 中的标签不受影响。
200200

201-
更多细节可查阅: [CORS settings attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes)
201+
更多细节可查阅: [CORS settings attributes](https://developer.mozilla.org/zh-CN/docs/Web/HTML/CORS_settings_attributes)
202202

203203
### integrity
204204

docs/zh/dev-guide/ui-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ api.describeConfig({
9797
})
9898
```
9999

100-
如果你没有定义图标,那就展示该插件可能存在的 logo (详见 [Logo](#logo))。
100+
如果你没有定义图标,那就展示该插件可能存在的 logo (详见 [Logo](./ui-info.md#logo))。
101101

102102
### 配置文件
103103

@@ -364,7 +364,7 @@ api.describeTask({
364364
})
365365
```
366366

367-
如果你没有定义图标,那就展示该插件可能存在的 logo (详见 [Logo](#logo))。
367+
如果你没有定义图标,那就展示该插件可能存在的 logo (详见 [Logo](./ui-info.md#logo))。
368368

369369
### 任务参数
370370

docs/zh/guide/build-targets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
- `index.html` 会带有注入的资源和 resource hint
1010
- 第三方库会被分到一个独立包以便更好的缓存
11-
- 小于 10kb 的静态资源会被内联在 JavaScript 中
11+
- 小于 4kb 的静态资源会被内联在 JavaScript 中
1212
- `public` 中的静态资源会被复制到输出目录中
1313

1414
##

docs/zh/guide/cli-service.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ npx vue-cli-service serve
5252
--https 使用 https (默认值:false)
5353
```
5454

55-
`serve` 命令会启动一个开发服务器 (基于 [webpack-dev-server](https://github.com/webpack/webpack-dev-server)) 并附带开箱即用的模块热重载 (Hot-Module-Replacement)。
55+
`vue-cli-service serve` 命令会启动一个开发服务器 (基于 [webpack-dev-server](https://github.com/webpack/webpack-dev-server)) 并附带开箱即用的模块热重载 (Hot-Module-Replacement)。
5656

5757
除了通过命令行参数,你也可以使用 `vue.config.js` 里的 [devServer](../config/#devserver) 字段配置开发服务器。
5858

docs/zh/guide/deployment.md

Lines changed: 74 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
### 本地预览
1010

11-
`dist` 目录需要启动一个 HTTP 服务器来访问,所以以 `file://` 协议直接打开 `dist/index.html` 是不会工作的。在本地预览生产环境构建最简单的方式就是使用一个 Node.js 静态文件服务器,例如 [serve](https://github.com/zeit/serve)
11+
`dist` 目录需要启动一个 HTTP 服务器来访问 (除非你已经将 `baseUrl` 配置为了一个相对的值),所以以 `file://` 协议直接打开 `dist/index.html` 是不会工作的。在本地预览生产环境构建最简单的方式就是使用一个 Node.js 静态文件服务器,例如 [serve](https://github.com/zeit/serve)
1212

1313
``` bash
1414
npm install -g serve
@@ -168,7 +168,7 @@ Firebase will ask some questions on how to setup your project.
168168
169169
{
170170
"hosting": {
171-
"public": "app"
171+
"public": "dist"
172172
}
173173
}
174174
```
@@ -206,7 +206,45 @@ Please refer to the [Firebase Documentation](https://firebase.google.com/docs/ho
206206

207207
### Now
208208

209-
> TODO | Open to contribution.
209+
1. Install the Now CLI globally: `npm install -g now`
210+
211+
2. Add a `now.json` file to your project root:
212+
213+
```json
214+
{
215+
"name": "my-example-app",
216+
"type": "static",
217+
"static": {
218+
"public": "dist",
219+
"rewrites": [
220+
{
221+
"source": "**",
222+
"destination": "/index.html"
223+
}
224+
]
225+
},
226+
"alias": "vue-example",
227+
"files": [
228+
"dist"
229+
]
230+
}
231+
```
232+
233+
You can further customize the static serving behavior by consulting [Now's documentation](https://zeit.co/docs/deployment-types/static).
234+
235+
3. Adding a deployment script in `package.json`:
236+
237+
```json
238+
"deploy": "npm run build && now && now alias"
239+
```
240+
241+
If you want to deploy publicly by default, you can change the deployment script to the following one:
242+
243+
```json
244+
"deploy": "npm run build && now --public && now alias"
245+
```
246+
247+
This will automatically point your site's alias to the latest deployment. Now, just run `npm run deploy` to deploy your app.
210248

211249
### Stdlib
212250

@@ -239,3 +277,36 @@ Then cd into the `dist/` folder of your project and then run `surge` and follow
239277
```
240278

241279
Verify your project is successfully published by Surge by visiting `myawesomeproject.surge.sh`, vola! For more setup details such as custom domains, you can visit [Surge's help page](https://surge.sh/help/).
280+
281+
### Bitbucket Cloud
282+
283+
1. As described in the [Bitbucket documentation](https://confluence.atlassian.com/bitbucket/publishing-a-website-on-bitbucket-cloud-221449776.html) you need to create a repository named exactly `<USERNAME>.bitbucket.io`.
284+
285+
2. It is possible to publish to a subfolder of the main repository, for instance if you want to have multiple websites. In that case set correct `baseUrl` in `vue.config.js`.
286+
287+
If you are deploying to `https://<USERNAME>.bitbucket.io/`, you can omit `baseUrl` as it defaults to `"/"`.
288+
289+
If you are deploying to `https://<USERNAME>.bitbucket.io/<SUBFOLDER>/`, set `baseUrl` to `"/<SUBFOLDER>/"`. In this case the directory structure of the repository should reflect the url structure, for instance the repository should have a `/<SUBFOLDER>` directory.
290+
291+
3. Inside your project, create `deploy.sh` with the following content and run it to deploy:
292+
293+
``` bash{13,20,23}
294+
#!/usr/bin/env sh
295+
296+
# abort on errors
297+
set -e
298+
299+
# build
300+
npm run build
301+
302+
# navigate into the build output directory
303+
cd dist
304+
305+
git init
306+
git add -A
307+
git commit -m 'deploy'
308+
309+
git push -f git@bitbucket.org:<USERNAME>/<USERNAME>.bitbucket.io.git master
310+
311+
cd -
312+
```

docs/zh/guide/html-and-static-assets.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,22 @@ module.exports = {
125125
h('img', { attrs: { src: require('./image.png') }})
126126
```
127127

128-
在其内部,我们通过 `file-loader` 用版本哈希值和正确的公共基础路径来决定最终的文件路径,再用 `url-loader` 将小于 10kb 的资源内联,以减少 HTTP 请求的数量。
128+
在其内部,我们通过 `file-loader` 用版本哈希值和正确的公共基础路径来决定最终的文件路径,再用 `url-loader` 将小于 4kb 的资源内联,以减少 HTTP 请求的数量。
129+
130+
你可以通过 [chainWebpack](../config/#chainwebpack) 调整内联文件的大小限制。例如,下列代码会将其限制设置为 10kb:
131+
132+
``` js
133+
// vue.config.js
134+
module.exports = {
135+
chainWebpack: config => {
136+
config.module
137+
.rule('images')
138+
.use('url-loader')
139+
.loader('url-loader')
140+
.tap(options => Object.assign(options, { limit: 10240 }))
141+
}
142+
}
143+
```
129144

130145
### URL 转换规则
131146

@@ -136,7 +151,7 @@ h('img', { attrs: { src: require('./image.png') }})
136151
- 如果 URL 以 `~` 开头,其后的任何内容都会作为一个模块请求被解析。这意味着你甚至可以引用 Node 模块中的资源:
137152

138153
``` html
139-
<img src="~/some-npm-package/foo.png">
154+
<img src="~some-npm-package/foo.png">
140155
```
141156

142157
- 如果 URL 以 `@` 开头,它也会作为一个模块请求被解析。它的用处在于 Vue CLI 默认会设置一个指向 `<projectRoot>/src` 的别名 `@`**(仅作用于模版中)**

docs/zh/guide/mode-and-env.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ VUE_APP_SECRET=secret
2222

2323
为一个特定模式准备的环境文件的 (例如 `.env.production`) 将会比一般的环境文件 (例如 `.env`) 拥有更高的优先级。
2424

25-
此外,Vue CLI 启动时已经存在的环境变量拥有最高优先级,并不会被 `.env` 文件覆写。如果在环境中有默认的 `NODE_ENV`,你可能需要考虑移除它。
25+
此外,Vue CLI 启动时已经存在的环境变量拥有最高优先级,并不会被 `.env` 文件覆写。
26+
:::
27+
28+
::: warning NODE_ENV
29+
如果在环境中有默认的 `NODE_ENV`,你应该移除它或在运行 `vue-cli-service` 命令的时候明确地设置 `NODE_ENV`
2630
:::
2731

2832
## 模式

0 commit comments

Comments
 (0)