Skip to content

Commit 4f379d4

Browse files
committed
chore: merge branch 'docs' into v3
2 parents 48f2dcd + 6fad417 commit 4f379d4

File tree

7 files changed

+69
-43
lines changed

7 files changed

+69
-43
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
IMPORTANT: Please use the following link to create a new issue:
1+
IMPORTANT: Please use our Issue Helper to create a new issue:
22

33
https://new-issue.vuejs.org/?repo=vuejs/vue-cli
44

5-
If your issue was not created using the app above, it will be closed immediately.
5+
If your issue was not created using Issue Helper from the link above, it will be closed immediately.
66

77
中文用户请注意:
88
请使用上面的链接来创建新的 issue。如果不是用上述工具创建的 issue 会被自动关闭。

docs/.vuepress/config.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ module.exports = {
8484
{
8585
text: 'Plugins',
8686
items: [
87-
{ text: 'Babel', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel' },
88-
{ text: 'TypeScript', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-typescript' },
89-
{ text: 'ESLint', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint' },
90-
{ text: 'PWA', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa' },
91-
{ text: 'Jest', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-unit-jest' },
92-
{ text: 'Mocha', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-unit-mocha' },
93-
{ text: 'Cypress', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-e2e-cypress' },
94-
{ text: 'Nightwatch', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-e2e-nightwatch' }
87+
{ text: 'Babel', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-babel' },
88+
{ text: 'TypeScript', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-typescript' },
89+
{ text: 'ESLint', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-eslint' },
90+
{ text: 'PWA', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-pwa' },
91+
{ text: 'Jest', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-unit-jest' },
92+
{ text: 'Mocha', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-unit-mocha' },
93+
{ text: 'Cypress', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-e2e-cypress' },
94+
{ text: 'Nightwatch', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-e2e-nightwatch' }
9595
]
9696
},
9797
{
@@ -259,14 +259,14 @@ module.exports = {
259259
{
260260
text: 'Плагины',
261261
items: [
262-
{ text: 'Babel', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel' },
263-
{ text: 'TypeScript', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-typescript' },
264-
{ text: 'ESLint', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint' },
265-
{ text: 'PWA', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa' },
266-
{ text: 'Jest', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-unit-jest' },
267-
{ text: 'Mocha', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-unit-mocha' },
268-
{ text: 'Cypress', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-e2e-cypress' },
269-
{ text: 'Nightwatch', link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-e2e-nightwatch' }
262+
{ text: 'Babel', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-babel' },
263+
{ text: 'TypeScript', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-typescript' },
264+
{ text: 'ESLint', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-eslint' },
265+
{ text: 'PWA', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-pwa' },
266+
{ text: 'Jest', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-unit-jest' },
267+
{ text: 'Mocha', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-unit-mocha' },
268+
{ text: 'Cypress', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-e2e-cypress' },
269+
{ text: 'Nightwatch', link: 'https://github.com/vuejs/vue-cli/tree/v3/packages/%40vue/cli-plugin-e2e-nightwatch' }
270270
]
271271
},
272272
{

docs/guide/creating-a-project.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ To create a new project, run:
88
vue create hello-world
99
```
1010

11+
A new project can also be generated inside an existing directory, like so:
12+
13+
``` bash
14+
vue create .
15+
```
16+
1117
::: warning
1218
If you are on Windows using Git Bash with minTTY, the interactive prompts will not work. You must launch the command as `winpty vue.cmd create hello-world`.
1319
If you however want to still use the `vue create hello-world` syntax, you can alias the command by adding the following line to your `~/.bashrc` file.

docs/guide/mode-and-env.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ vue-cli-service build --mode development
1616

1717
When running `vue-cli-service`, environment variables are loaded from all [corresponding files](#environment-variables). If they don't contain a `NODE_ENV` variable, it will be set accordingly. For example, `NODE_ENV` will be set to `"production"` in production mode, `"test"` in test mode, and defaults to `"development"` otherwise.
1818

19-
Then `NODE_ENV` will determine the primary mode your app is runnning in - development, production or test - and consequently, what kind of webpack config will be created.
19+
Then `NODE_ENV` will determine the primary mode your app is running in - development, production or test - and consequently, what kind of webpack config will be created.
2020

2121
With `NODE_ENV` set to "test" for example, Vue CLI creates a webpack config that is intended to be used and optimized for unit tests. It doesn't process images and other assets that are unnecessary for unit tests.
2222

docs/zh/dev-guide/plugin-dev.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,23 @@ vue invoke my-plugin --mode awesome
316316
- 被其它开发者搜索到;
317317
- 通过 `vue add <name>``vue invoke <name>` 安装下来。
318318

319+
### 本地测试插件
320+
321+
当你进行插件开发的时候,需要在本地对插件进行测试,你可以使用已有的 Vue CLI 项目或者新建一个项目来进行:
322+
323+
```bash
324+
vue create test-app
325+
```
326+
327+
然后,在项目的根目录,使用下面的命令添加需要测试的本地插件:
328+
329+
```bash
330+
npm install --save-dev file:/full/path/to/your/plugin
331+
vue invoke <your-plugin-name>
332+
```
333+
334+
当对插件进行了修改之后,你需要重复上面的步骤来使变动生效
335+
319336
## 开发核心插件的注意事项
320337

321338
::: tip 注意

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ VUE_APP_TITLE=My App (staging)
7676
console.log(process.env.VUE_APP_SECRET)
7777
```
7878

79-
在构建过程中,`process.env.VUE_APP_SECRET` 将会被相应的值所取代。在 `VUE_APP_SECRET=secret` 的情况下,它会被替换为 `"sercet"`
79+
在构建过程中,`process.env.VUE_APP_SECRET` 将会被相应的值所取代。在 `VUE_APP_SECRET=secret` 的情况下,它会被替换为 `"secret"`
8080

8181
除了 `VUE_APP_*` 变量之外,在你的应用代码中始终可用的还有两个特殊的变量:
8282

docs/zh/guide/plugins-and-presets.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# 插件和 Preset
1+
# 插件和预设配置
22

33
## 插件
44

5-
Vue CLI 使用了一套基于插件的架构。如果你查阅一个新创建项目的 `package.json`,就会发现依赖都是以 `@vue/cli-plugin-` 开头的。插件可以修改 webpack 的内部配置,也可以向 `vue-cli-service` 注入命令。在项目创建的过程中,绝大部分列出的特性都是通过插件来实现的
5+
Vue CLI 使用了一套基于插件的架构。如果你查阅一个新创建项目的 `package.json`,就会发现依赖都是以 `@vue/cli-plugin-` 开头的。插件可以修改内部的 webpack 配置,也可以向 `vue-cli-service` 注入命令。在项目创建的过程中列出的特性,绝大部分都是通过插件来实现的
66

7-
基于插件的架构使得 Vue CLI 灵活且可扩展。如果你对开发一个插件感兴趣,请翻阅[插件开发指南](../dev-guide/plugin-dev.md)
7+
基于插件的架构使得 Vue CLI 灵活且可扩展。如果你对开发插件感兴趣,请翻阅[插件开发指南](../dev-guide/plugin-dev.md)
88

99
::: tip
1010
你可以通过 `vue ui` 命令使用 GUI 安装和管理插件。
@@ -19,11 +19,11 @@ vue add @vue/eslint
1919
```
2020

2121
::: tip 提示
22-
`vue add` 的设计意图是为了安装和调用 Vue CLI 插件。这不意味着替换掉普通的 npm 。对于这些普通的 npm 包,你仍然需要选用包管理器
22+
`vue add` 的设计意图是为了安装和调用 Vue CLI 插件。对于普通的 npm 包而言,这不意味有一个替代(命令)。对于这些普通的 npm 包,你仍然需要(根据所选的 npm 包)使用包管理器
2323
:::
2424

2525
::: warning 警告
26-
我们推荐在运行 `vue add` 之前将项目的最新状态提交,因为该命令可能调用插件的文件生成器并很有可能更改你现有的文件
26+
我们推荐在运行 `vue add` 之前将项目的最新状态提交,因为该命令将会调用插件的文件生成器并很有可能更改你现有的文件
2727
:::
2828

2929
这个命令将 `@vue/eslint` 解析为完整的包名 `@vue/cli-plugin-eslint`,然后从 npm 安装它,调用它的生成器。
@@ -101,13 +101,13 @@ vue add vuex
101101

102102
更多信息请阅读 [UI 插件 API](../dev-guide/ui-api.md)
103103

104-
## Preset
104+
## 预设配置
105105

106-
一个 Vue CLI preset 是一个包含创建新项目所需预定义选项和插件的 JSON 对象,让用户无需在命令提示中选择它们。
106+
Vue CLI 预设配置是一个包含创建新项目所需的预定义选项和插件的 JSON 对象,让用户无需在命令提示中选择它们。
107107

108-
`vue create` 过程中保存的 preset 会被放在你的 home 目录下的一个配置文件中 (`~/.vuerc`)。你可以通过直接编辑这个文件来调整、添加、删除保存好的 preset
108+
`vue create` 过程中保存的预设配置会被放在你的 home 目录下的一个配置文件中 (`~/.vuerc`)。你可以通过直接编辑这个文件来调整、添加、删除保存好的配置
109109

110-
这里有一个 preset 的示例
110+
这里有一个预设配置的示例
111111

112112
``` json
113113
{
@@ -125,7 +125,7 @@ vue add vuex
125125
}
126126
```
127127

128-
Preset 的数据会被插件生成器用来生成相应的项目文件。除了上述这些字段,你也可以为集成工具添加配置:
128+
预设配置的数据会被插件生成器用来生成相应的项目文件。除了上述这些字段,你也可以为集成工具添加配置:
129129

130130
``` json
131131
{
@@ -142,7 +142,7 @@ Preset 的数据会被插件生成器用来生成相应的项目文件。除了
142142

143143
这些额外的配置将会根据 `useConfigFiles` 的值被合并到 `package.json` 或相应的配置文件中。例如,当 `"useConfigFiles": true` 的时候,`configs` 的值将会被合并到 `vue.config.js` 中。
144144

145-
### Preset 插件的版本管理
145+
### 预设配置插件的版本管理
146146

147147
你可以显式地指定用到的插件的版本:
148148

@@ -157,39 +157,39 @@ Preset 的数据会被插件生成器用来生成相应的项目文件。除了
157157
}
158158
```
159159

160-
注意对于官方插件来说这不是必须的——当被忽略时,CLI 会自动使用 registry 中最新的版本。不过**我们推荐为 preset 列出的所有第三方插件提供显式的版本范围**
160+
注意对于官方插件来说这不是必须的——当被忽略时,CLI 会自动使用 registry 中最新的版本。不过**我们推荐为预设配置所列出的所有第三方插件,提供明确的版本范围**
161161

162162
### 允许插件的命令提示
163163

164-
每个插件在项目创建的过程中都可以注入它自己的命令提示,不过当你使用了一个 preset,这些命令提示就会被跳过,因为 Vue CLI 假设所有的插件选项都已经在 preset 中声明过了
164+
每个插件在项目创建的过程中都可以注入它自己的命令提示,不过当你使用了预设配置,这些命令提示就会被跳过,因为 Vue CLI 假设所有的插件选项都已经在预设配置中声明过了
165165

166-
在有些情况下你可能希望 preset 只声明需要的插件,同时让用户通过插件注入的命令提示来保留一些灵活性。
166+
在有些情况下你可能希望预设配置只声明需要的插件,同时让用户通过插件注入的命令提示来保留一些灵活性。
167167

168168
对于这种场景你可以在插件选项中指定 `"prompts": true` 来允许注入命令提示:
169169

170170
``` json
171171
{
172172
"plugins": {
173173
"@vue/cli-plugin-eslint": {
174-
// 让用户选取他们自己的 ESLint config
174+
// 让用户选取他们自己的 ESLint 配置
175175
"prompts": true
176176
}
177177
}
178178
}
179179
```
180180

181-
### 远程 Preset
181+
### 远程预设
182182

183-
你可以通过发布 git repo 将一个 preset 分享给其他开发者。这个 repo 应该包含以下文件:
183+
你可以通过发布 git repo 将一个预设配置分享给其他开发者。这个 repo 应该包含以下文件:
184184

185-
- `preset.json`: 包含 preset 数据的主要文件(必需)。
185+
- `preset.json`: 包含预设配置数据的主要文件(必需)。
186186
- `generator.js`: 一个可以注入或是修改项目中文件的 [Generator](../dev-guide/plugin-dev.md#generator)
187-
- `prompts.js` 一个可以通过命令行对话为 generator 收集选项的 [prompts 文件](../dev-guide/plugin-dev.md#第三方插件的对话)
187+
- `prompts.js` 一个可以为 generator 收集选项的 [prompts 文件](../dev-guide/plugin-dev.md#prompts)
188188

189-
发布 repo 后,你就可以在创建项目的时候通过 `--preset` 选项使用这个远程的 preset 了
189+
发布 repo 后,你就可以在创建项目的时候通过 `--preset` 选项使用这个远程的预设配置了
190190

191191
``` bash
192-
# 从 GitHub repo 使用 preset
192+
# 从 GitHub repo 使用预设配置
193193
vue create --preset username/repo my-project
194194
```
195195

@@ -198,11 +198,14 @@ GitLab 和 BitBucket 也是支持的。如果要从私有 repo 获取,请确
198198
``` bash
199199
vue create --preset gitlab:username/repo --clone my-project
200200
vue create --preset bitbucket:username/repo --clone my-project
201+
# 自托管的 repo
202+
vue create --preset gitlab:my-gitlab-server.com:group/projectname --clone my-project
203+
vue create --preset direct:ssh://[email protected]/group/projectname.git --clone my-project
201204
```
202205

203-
### 加载文件系统中的 Preset
206+
### 加载文件系统中的预设配置
204207

205-
当开发一个远程 preset 的时候,你必须不厌其烦的向远程 repo 发出 push 进行反复测试。为了简化这个流程,你也可以直接在本地测试 preset。如果 `--preset` 选项的值是一个相对或绝对文件路径,或是以 `.json` 结尾,则 Vue CLI 会加载本地的 preset
208+
当开发远程预设配置的时候,重复地将预设配置 push 到远程 repo 中进行测试,会显得冗烦。为了简化这个流程,你也可以直接在本地测试预设配置。如果 `--preset` 选项的值是一个相对或绝对文件路径,或是以 `.json` 结尾,则 Vue CLI 会加载本地的预设配置
206209

207210
``` bash
208211
# ./my-preset 应当是一个包含 preset.json 的文件夹

0 commit comments

Comments
 (0)