chore: merge branch 'dev' into docs

This commit is contained in:
Haoqun Jiang
2019-02-20 16:54:46 +08:00
51 changed files with 315 additions and 189 deletions
+38
View File
@@ -1,3 +1,41 @@
# [3.4.1](https://github.com/vuejs/vue-cli/compare/v3.4.0...v3.4.1) (2019-02-20)
## cli-plugin-babel
#### Bug Fixes
* fix hash difference on different terminal sessions ([a2bc927](https://github.com/vuejs/vue-cli/commit/a2bc927)), closes [#3416](https://github.com/vuejs/vue-cli/issues/3416)
## cli-plugin-eslint
#### Bug Fixes
* respect command line --ignore-pattern option ([f819f51](https://github.com/vuejs/vue-cli/commit/f819f51))
* **cli-plugin-eslint:** make eslint deps optional ([#3068](https://github.com/vuejs/vue-cli/issues/3068)) ([114313c](https://github.com/vuejs/vue-cli/commit/114313c))
## cli-plugin-typescript
#### Bug Fixes
* **tslint:** don't reread the input file on ts linting (close [#2786](https://github.com/vuejs/vue-cli/issues/2786)) ([#2787](https://github.com/vuejs/vue-cli/issues/2787)) ([364f28f](https://github.com/vuejs/vue-cli/commit/364f28f))
## cli-service
#### Bug Fixes
* run modern build in separate process ([#3477](https://github.com/vuejs/vue-cli/issues/3477)) ([e0983f4](https://github.com/vuejs/vue-cli/commit/e0983f4)), closes [#3438](https://github.com/vuejs/vue-cli/issues/3438) [#3474](https://github.com/vuejs/vue-cli/issues/3474)
#### Features
* **cli-service:** add history api fallback for multi-page mode ([#3181](https://github.com/vuejs/vue-cli/issues/3181)) ([ea5d9f7](https://github.com/vuejs/vue-cli/commit/ea5d9f7))
## cli-ui
#### Bug Fixes
* import createTimeAgo from vue-timeago because it isn't a default export ([#3437](https://github.com/vuejs/vue-cli/issues/3437)) ([38aa8d9](https://github.com/vuejs/vue-cli/commit/38aa8d9))
# [3.4.0](https://github.com/vuejs/vue-cli/compare/v3.3.0...v3.4.0) (2019-01-31)
## babel-preset-app
+3 -3
View File
@@ -2,17 +2,17 @@ module.exports = {
locales: {
'/': {
lang: 'en-US',
title: 'Vue CLI 3',
title: 'Vue CLI',
description: '🛠️ Standard Tooling for Vue.js Development'
},
'/zh/': {
lang: 'zh-CN',
title: 'Vue CLI 3',
title: 'Vue CLI',
description: '🛠️ Vue.js 开发的标准工具'
},
'/ru/': {
lang: 'ru',
title: 'Vue CLI 3',
title: 'Vue CLI',
description: '🛠️ Стандартный инструментарий для разработки на Vue.js'
}
},
+1 -1
View File
@@ -781,7 +781,7 @@ Example:
{
"name": "vue-cli-plugin-apollo",
"version": "0.7.7",
"description": "vue-cli 3 plugin to add Apollo and GraphQL"
"description": "vue-cli plugin to add Apollo and GraphQL"
}
```
+1 -1
View File
@@ -628,7 +628,7 @@ A Client addon is a JS bundle which is dynamically loaded into the cli-ui. It is
### Create a client addon
The recommended way to create a Client addon is by creating a new project using vue-cli 3. You can either do this in a subfolder of your plugin or in a different npm package.
The recommended way to create a Client addon is by creating a new project using vue cli. You can either do this in a subfolder of your plugin or in a different npm package.
Install `@vue/cli-ui` as a dev dependency.
+1 -1
View File
@@ -22,7 +22,7 @@ Example:
{
"name": "vue-cli-plugin-apollo",
"version": "0.7.7",
"description": "vue-cli 3 plugin to add Apollo and GraphQL"
"description": "vue-cli plugin to add Apollo and GraphQL"
}
```
+3 -3
View File
@@ -10,8 +10,8 @@ vue create hello-world
::: warning
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`.
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.
`alias vue='winpty vue.cmd'`
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.
`alias vue='winpty vue.cmd'`
You will need to restart your Git Bash terminal session to pull in the updated bashrc file.
:::
@@ -73,7 +73,7 @@ The above command will open a browser window with a GUI that guides you through
## Pulling 2.x Templates (Legacy)
Vue CLI 3 uses the same `vue` binary, so it overwrites Vue CLI 2 (`vue-cli`). If you still need the legacy `vue init` functionality, you can install a global bridge:
Vue CLI >= 3 uses the same `vue` binary, so it overwrites Vue CLI 2 (`vue-cli`). If you still need the legacy `vue init` functionality, you can install a global bridge:
``` bash
npm install -g @vue/cli-init
+2
View File
@@ -46,6 +46,8 @@ FOO=bar
VUE_APP_SECRET=secret
```
For more detailed env parsing rules, please refer to [the documentation of `dotenv`](https://github.com/motdotla/dotenv#rules).
Loaded variables will become available to all `vue-cli-service` commands, plugins and dependencies.
::: tip Env Loading Priorities
+1 -1
View File
@@ -628,7 +628,7 @@ api.addTask({
### Создание клиентского дополнения
Рекомендуемый способ создания клиентского дополнения — создать новый проект с помощью vue-cli 3. Вы можете либо сделать это в подкаталоге вашего плагина, либо в другом npm пакете.
Рекомендуемый способ создания клиентского дополнения — создать новый проект с помощью vue cli. Вы можете либо сделать это в подкаталоге вашего плагина, либо в другом npm пакете.
Установите `@vue/cli-ui` в качестве зависимости для разработки (dev dependency).
+1 -1
View File
@@ -22,7 +22,7 @@
{
"name": "vue-cli-plugin-apollo",
"version": "0.7.7",
"description": "vue-cli 3 plugin to add Apollo and GraphQL"
"description": "vue-cli plugin to add Apollo and GraphQL"
}
```
+1 -1
View File
@@ -73,7 +73,7 @@ vue ui
## Шаблоны для версии 2.x (старое поведение)
Vue CLI 3 использует команду `vue`, поэтому он перезаписывает Vue CLI 2 (`vue-cli`). Если вам по-прежнему необходимо старое поведение и функциональность команды `vue init`, нужно лишь установить глобально дополнительный плагин `@vue/cli-init`:
Vue CLI >= 3 использует команду `vue`, поэтому он перезаписывает Vue CLI 2 (`vue-cli`). Если вам по-прежнему необходимо старое поведение и функциональность команды `vue init`, нужно лишь установить глобально дополнительный плагин `@vue/cli-init`:
``` bash
npm install -g @vue/cli-init
+1 -1
View File
@@ -626,7 +626,7 @@ api.addTask({
### 创建一个客户端 addon
推荐的创建一个客户端 addon 的方式是通过 vue-cli 3 创建一个新项目。你也可以在插件的子目录或不同的 npm 包中这样做。
推荐的创建一个客户端 addon 的方式是通过 vue cli 创建一个新项目。你也可以在插件的子目录或不同的 npm 包中这样做。
作为开发依赖安装 `@vue/cli-ui`
+1 -1
View File
@@ -22,7 +22,7 @@
{
"name": "vue-cli-plugin-apollo",
"version": "0.7.7",
"description": "vue-cli 3 plugin to add Apollo and GraphQL"
"description": "vue cli plugin to add Apollo and GraphQL"
}
```
+3 -3
View File
@@ -9,8 +9,8 @@ vue create hello-world
```
::: warning 警告
如果你在 Windows 上通过 minTTY 使用 Git Bash,交互提示符并不工作。你必须通过 `winpty vue.cmd create hello-world` 启动这个命令。不过,如果你仍想使用 `vue create hello-world`,则可以通过在 `~/.bashrc` 文件中添加以下行来为命令添加别名。
`alias vue='winpty vue.cmd'`
如果你在 Windows 上通过 minTTY 使用 Git Bash,交互提示符并不工作。你必须通过 `winpty vue.cmd create hello-world` 启动这个命令。不过,如果你仍想使用 `vue create hello-world`,则可以通过在 `~/.bashrc` 文件中添加以下行来为命令添加别名。
`alias vue='winpty vue.cmd'`
你需要重新启动 Git Bash 终端会话以使更新后的 bashrc 文件生效。
:::
@@ -72,7 +72,7 @@ vue ui
## 拉取 2.x 模板 (旧版本)
Vue CLI 3 和旧版使用了相同的 `vue` 命令,所以 Vue CLI 2 (`vue-cli`) 被覆盖了。如果你仍然需要使用旧版本的 `vue init` 功能,你可以全局安装一个桥接工具:
Vue CLI >= 3 和旧版使用了相同的 `vue` 命令,所以 Vue CLI 2 (`vue-cli`) 被覆盖了。如果你仍然需要使用旧版本的 `vue init` 功能,你可以全局安装一个桥接工具:
``` bash
npm install -g @vue/cli-init
+1 -1
View File
@@ -1,7 +1,7 @@
{
"npmClient": "yarn",
"useWorkspaces": false,
"version": "3.4.0",
"version": "3.4.1",
"packages": [
"packages/@vue/babel-preset-app",
"packages/@vue/cli*"
+4 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/babel-preset-app",
"version": "3.4.0",
"version": "3.4.1",
"description": "babel-preset-app for vue-cli",
"main": "index.js",
"publishConfig": {
@@ -8,7 +8,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/babel-preset-app"
},
"keywords": [
"vue",
@@ -31,6 +32,6 @@
"@babel/runtime-corejs2": "^7.2.0",
"@vue/babel-preset-jsx": "^1.0.0-beta.2",
"babel-plugin-dynamic-import-node": "^2.2.0",
"core-js": "^2.6.3"
"core-js": "^2.6.5"
}
}
+3 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-init",
"version": "3.4.0",
"version": "3.4.1",
"description": "init addon for vue-cli",
"main": "index.js",
"publishConfig": {
@@ -8,7 +8,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-init"
},
"keywords": [
"vue",
+3 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-overlay",
"version": "3.4.0",
"version": "3.4.1",
"description": "error overlay & dev server middleware for vue-cli",
"main": "dist/client.js",
"files": [
@@ -8,7 +8,8 @@
],
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-overlay"
},
"keywords": [
"vue",
+5 -4
View File
@@ -1,11 +1,12 @@
{
"name": "@vue/cli-plugin-babel",
"version": "3.4.0",
"version": "3.4.1",
"description": "babel plugin for vue-cli",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-plugin-babel"
},
"keywords": [
"vue",
@@ -20,8 +21,8 @@
"homepage": "https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/cli-plugin-babel#readme",
"dependencies": {
"@babel/core": "^7.0.0",
"@vue/babel-preset-app": "^3.4.0",
"@vue/cli-shared-utils": "^3.4.0",
"@vue/babel-preset-app": "^3.4.1",
"@vue/cli-shared-utils": "^3.4.1",
"babel-loader": "^8.0.5",
"webpack": ">=4 < 4.29"
},
@@ -1,11 +1,12 @@
{
"name": "@vue/cli-plugin-e2e-cypress",
"version": "3.4.0",
"version": "3.4.1",
"description": "e2e-cypress plugin for vue-cli",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-plugin-e2e-cypress"
},
"keywords": [
"vue",
@@ -22,7 +23,7 @@
"access": "public"
},
"dependencies": {
"@vue/cli-shared-utils": "^3.4.0",
"@vue/cli-shared-utils": "^3.4.1",
"cypress": "^3.1.5",
"eslint-plugin-cypress": "^2.2.0"
}
@@ -1,11 +1,12 @@
{
"name": "@vue/cli-plugin-e2e-nightwatch",
"version": "3.4.0",
"version": "3.4.1",
"description": "e2e-nightwatch plugin for vue-cli",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-plugin-e2e-nightwatch"
},
"keywords": [
"vue",
@@ -22,9 +23,9 @@
"access": "public"
},
"dependencies": {
"@vue/cli-shared-utils": "^3.4.0",
"chromedriver": "^2.45.0",
"deepmerge": "^3.1.0",
"@vue/cli-shared-utils": "^3.4.1",
"chromedriver": "^2.46.0",
"deepmerge": "^3.2.0",
"execa": "^1.0.0",
"nightwatch": "^0.9.21",
"selenium-server": "^3.141.59"
+1 -1
View File
@@ -36,7 +36,7 @@ module.exports = function lint (args = {}, api) {
const noFixWarningsPredicate = (lintResult) => lintResult.severity === 2
config.fix = config.fix && (noFixWarnings ? noFixWarningsPredicate : true)
if (!fs.existsSync(api.resolve('.eslintignore'))) {
if (!fs.existsSync(api.resolve('.eslintignore')) && !config.ignorePattern) {
// .eslintrc.js files (ignored by default)
// However, we need to lint & fix them so as to make the default generated project's
// code style consistent with user's selected eslint config.
+9 -6
View File
@@ -1,11 +1,12 @@
{
"name": "@vue/cli-plugin-eslint",
"version": "3.4.0",
"version": "3.4.1",
"description": "eslint plugin for vue-cli",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-plugin-eslint"
},
"keywords": [
"vue",
@@ -22,12 +23,14 @@
"access": "public"
},
"dependencies": {
"@vue/cli-shared-utils": "^3.4.0",
"@vue/cli-shared-utils": "^3.4.1",
"babel-eslint": "^10.0.1",
"eslint": "^4.19.1",
"eslint-loader": "^2.1.1",
"eslint-plugin-vue": "^4.7.1",
"eslint-loader": "^2.1.2",
"globby": "^9.0.0",
"webpack": ">=4 < 4.29"
},
"optionalDependencies": {
"eslint": "^4.19.1",
"eslint-plugin-vue": "^4.7.1"
}
}
+4 -3
View File
@@ -1,11 +1,12 @@
{
"name": "@vue/cli-plugin-pwa",
"version": "3.4.0",
"version": "3.4.1",
"description": "pwa plugin for vue-cli",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-plugin-pwa"
},
"keywords": [
"vue",
@@ -22,7 +23,7 @@
"access": "public"
},
"dependencies": {
"@vue/cli-shared-utils": "^3.4.0",
"@vue/cli-shared-utils": "^3.4.1",
"webpack": ">=4 < 4.29",
"workbox-webpack-plugin": "^3.6.3"
},
@@ -88,3 +88,28 @@ test('should ignore issues in node_modules', async () => {
await run('vue-cli-service lint')
expect(await read('node_modules/bad.ts')).toMatch(updatedMain)
})
test('should be able to fix mixed line endings', async () => {
const project = await create('ts-lint-mixed-line-endings', {
plugins: {
'@vue/cli-plugin-typescript': {
tsLint: true
}
}
})
const { write, run } = project
const b64 = 'PHRlbXBsYXRlPjwvdGVtcGxhdGU+DQoNCjxzY3JpcHQgbGFuZz0idHMiPg0KZXhwb3J0IGRlZmF1bHQgY2xhc3MgVGVzdCAgew0KICBnZXQgYXNzaWduZWUoKSB7DQogICAgdmFyIGl0ZW1zOnt0ZXh0OnN0cmluZzsgdmFsdWU6c3RyaW5nIHwgbnVtYmVyIHwgbnVsbH1bXSA9IFtdOw0KICAgIHJldHVybiBpdGVtczsNCiAgfQ0KDQp9DQo8L3NjcmlwdD4NCg0K'
const buf = Buffer.from(b64, 'base64')
await write('src/bad.vue', buf)
// Try twice to fix the file.
// For now, it will fail the first time, which corresponds to the behaviour of tslint.
try {
await run('vue-cli-service lint -- src/bad.vue')
} catch (e) { }
await run('vue-cli-service lint -- src/bad.vue')
})
@@ -29,6 +29,7 @@ module.exports = function lint (args = {}, api, silent) {
if (isVueFile(file)) {
const parts = vueFileCache.get(path.normalize(file))
if (parts) {
parts.content = content
const { before, after } = parts
content = `${before}\n${content.trim()}\n${after}`
}
@@ -42,12 +43,18 @@ module.exports = function lint (args = {}, api, silent) {
}
const parseTSFromVueFile = file => {
// If the file has already been cached, don't read the file again. Use the cache instead.
if (vueFileCache.has(file)) {
return vueFileCache.get(file)
}
const content = fs.readFileSync(file, 'utf-8')
const { script } = vueCompiler.parseComponent(content, { pad: 'line' })
if (script && /^tsx?$/.test(script.lang)) {
vueFileCache.set(file, {
before: content.slice(0, script.start),
after: content.slice(script.end)
after: content.slice(script.end),
content: script.content
})
return script
}
@@ -62,7 +69,7 @@ module.exports = function lint (args = {}, api, silent) {
program.getSourceFile = function (file, languageVersion, onError) {
if (isVueFile(file)) {
const { content, lang = 'js' } = parseTSFromVueFile(file) || { content: '', lang: 'js' }
const contentLang = ts.ScriptKind[lang.toUpperCase()];
const contentLang = ts.ScriptKind[lang.toUpperCase()]
return ts.createSourceFile(file, content, languageVersion, true, contentLang)
} else {
return getSourceFile.call(this, file, languageVersion, onError)
@@ -1,11 +1,12 @@
{
"name": "@vue/cli-plugin-typescript",
"version": "3.4.0",
"version": "3.4.1",
"description": "typescript plugin for vue-cli",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-plugin-typescript"
},
"keywords": [
"vue",
@@ -23,7 +24,7 @@
},
"dependencies": {
"@types/webpack-env": "^1.13.6",
"@vue/cli-shared-utils": "^3.4.0",
"@vue/cli-shared-utils": "^3.4.1",
"fork-ts-checker-webpack-plugin": "^0.5.2",
"globby": "^9.0.0",
"ts-loader": "^5.3.3",
@@ -1,11 +1,12 @@
{
"name": "@vue/cli-plugin-unit-jest",
"version": "3.4.0",
"version": "3.4.1",
"description": "unit-jest plugin for vue-cli",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-plugin-unit-jest"
},
"keywords": [
"vue",
@@ -22,13 +23,13 @@
"access": "public"
},
"dependencies": {
"@vue/cli-shared-utils": "^3.4.0",
"@vue/cli-shared-utils": "^3.4.1",
"babel-jest": "^23.6.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"jest": "^23.6.0",
"jest-serializer-vue": "^2.0.2",
"jest-transform-stub": "^1.0.0",
"vue-jest": "^3.0.2"
"jest-transform-stub": "^2.0.0",
"vue-jest": "^3.0.3"
},
"devDependencies": {
"@vue/test-utils": "^1.0.0-beta.20",
@@ -1,11 +1,12 @@
{
"name": "@vue/cli-plugin-unit-mocha",
"version": "3.4.0",
"version": "3.4.1",
"description": "mocha unit testing plugin for vue-cli",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-plugin-unit-mocha"
},
"keywords": [
"vue",
@@ -21,7 +22,7 @@
},
"homepage": "https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/cli-plugin-unit-mocha#readme",
"dependencies": {
"@vue/cli-shared-utils": "^3.4.0",
"@vue/cli-shared-utils": "^3.4.1",
"jsdom": "^13.2.0",
"jsdom-global": "^3.0.2",
"mocha": "^5.2.0",
+11 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-service-global",
"version": "3.4.0",
"version": "3.4.1",
"description": "vue-cli-service global addon for vue-cli",
"main": "index.js",
"publishConfig": {
@@ -8,7 +8,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-service-global"
},
"keywords": [
"vue",
@@ -21,14 +22,16 @@
},
"homepage": "https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/cli-build#readme",
"dependencies": {
"@vue/babel-preset-app": "^3.4.0",
"@vue/cli-plugin-babel": "^3.4.0",
"@vue/cli-plugin-eslint": "^3.4.0",
"@vue/cli-service": "^3.4.0",
"@vue/babel-preset-app": "^3.4.1",
"@vue/cli-plugin-babel": "^3.4.1",
"@vue/cli-plugin-eslint": "^3.4.1",
"@vue/cli-service": "^3.4.1",
"babel-eslint": "^10.0.1",
"chalk": "^2.4.2",
"eslint": "^4.19.1",
"eslint-plugin-vue": "^4.7.1",
"resolve": "^1.10.0",
"vue": "^2.5.22",
"vue-template-compiler": "^2.5.22"
"vue": "^2.6.6",
"vue-template-compiler": "^2.6.6"
}
}
@@ -22,6 +22,10 @@ test('modern mode', async () => {
expect(files.some(f => /^chunk-vendors\.\w{8}\.js$/.test(f))).toBe(true)
expect(files.some(f => /^chunk-vendors-legacy\.\w{8}\.js$/.test(f))).toBe(true)
// arrow function should be reserved in the modern build
const app = await project.read(`dist/js/${files.find(f => /^app\.\w{8}\.js$/.test(f))}`)
expect(app).toMatch(/=>/)
// assert correct asset links
const index = await project.read('dist/index.html')
@@ -14,7 +14,8 @@ async function makeProjectMultiPage (project) {
pages: {
index: { entry: 'src/main.js' },
foo: { entry: 'src/foo.js' },
bar: { entry: 'src/bar.js' }
bar: { entry: 'src/bar.js' },
foobar: { entry: 'src/foobar.js' }
},
chainWebpack: config => {
const splitOptions = config.optimization.get('splitChunks')
@@ -39,6 +40,13 @@ async function makeProjectMultiPage (project) {
render: h => h(App)
})
`)
await project.write('src/foobar.js', `
import Vue from 'vue'
new Vue({
el: '#app',
render: h => h('h1', 'FooBar')
})
`)
const app = await project.read('src/App.vue')
await project.write('src/App.vue', app.replace(
`import HelloWorld from './components/HelloWorld.vue'`,
@@ -61,6 +69,15 @@ test('serve w/ multi page', async () => {
await page.goto(`${url}/bar.html`)
expect(await helpers.getText('h1')).toMatch(`Welcome to Your Vue.js App`)
await page.goto(`${url}foo`)
expect(await helpers.getText('h1')).toMatch(`Foo`)
await page.goto(`${url}bar`)
expect(await helpers.getText('h1')).toMatch(`Welcome to Your Vue.js App`)
await page.goto(`${url}foobar`)
expect(await helpers.getText('h1')).toMatch(`FooBar`)
}
)
})
+1 -1
View File
@@ -9,7 +9,7 @@ module.exports = (api, options) => {
'build': 'vue-cli-service build'
},
dependencies: {
'vue': '^2.5.22'
'vue': '^2.6.6'
},
devDependencies: {
'vue-template-compiler': '^2.5.21'
+2 -2
View File
@@ -6,7 +6,7 @@ const readPkg = require('read-pkg')
const merge = require('webpack-merge')
const Config = require('webpack-chain')
const PluginAPI = require('./PluginAPI')
const loadEnv = require('./util/loadEnv')
const dotenv = require('dotenv')
const defaultsDeep = require('lodash.defaultsdeep')
const { warn, error, isPlugin, loadModule } = require('@vue/cli-shared-utils')
@@ -95,7 +95,7 @@ module.exports = class Service {
const load = path => {
try {
const res = loadEnv(path)
const res = dotenv.config({ path, debug: process.env.DEBUG })
logger(path, res)
} catch (err) {
// only ignore error if file is not found
@@ -36,7 +36,7 @@ module.exports = (api, options) => {
'--report-json': 'generate report.json to help analyze bundle content',
'--watch': `watch for changes`
}
}, async (args) => {
}, async (args, rawArgs) => {
for (const key in defaults) {
if (args[key] == null) {
args[key] = defaults[key]
@@ -50,20 +50,29 @@ module.exports = (api, options) => {
process.env.VUE_CLI_BUILD_TARGET = args.target
if (args.modern && args.target === 'app') {
process.env.VUE_CLI_MODERN_MODE = true
delete process.env.VUE_CLI_MODERN_BUILD
await build(Object.assign({}, args, {
modernBuild: false,
keepAlive: true
}), api, options)
process.env.VUE_CLI_MODERN_BUILD = true
await build(Object.assign({}, args, {
modernBuild: true,
clean: false
}), api, options)
if (!process.env.VUE_CLI_MODERN_BUILD) {
// main-process for legacy build
await build(Object.assign({}, args, {
modernBuild: false,
keepAlive: true
}), api, options)
// spawn sub-process of self for modern build
const { execa } = require('@vue/cli-shared-utils')
const cliBin = api.resolve('node_modules/.bin/vue-cli-service')
await execa(cliBin, ['build', ...rawArgs], {
stdio: 'inherit',
env: {
VUE_CLI_MODERN_BUILD: true
}
})
} else {
// sub-process for modern build
await build(Object.assign({}, args, {
modernBuild: true,
clean: false
}), api, options)
}
delete process.env.VUE_CLI_MODERN_MODE
delete process.env.VUE_CLI_MODERN_BUILD
} else {
if (args.modern) {
const { warn } = require('@vue/cli-shared-utils')
@@ -33,7 +33,6 @@ module.exports = (api, options) => {
const isProduction = process.env.NODE_ENV === 'production'
const url = require('url')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
@@ -139,9 +138,7 @@ module.exports = (api, options) => {
clientLogLevel: 'none',
historyApiFallback: {
disableDotRule: true,
rewrites: [
{ from: /./, to: path.posix.join(options.publicPath, 'index.html') }
]
rewrites: genHistoryApiFallbackRewrites(options.publicPath, options.pages)
},
contentBase: api.resolve('public'),
watchContentBase: !isProduction,
@@ -302,6 +299,23 @@ function checkInContainer () {
}
}
function genHistoryApiFallbackRewrites (baseUrl, pages = {}) {
const path = require('path')
const multiPageRewrites = Object
.keys(pages)
// sort by length in reversed order to avoid overrides
// eg. 'page11' should appear in front of 'page1'
.sort((a, b) => b.length - a.length)
.map(name => ({
from: new RegExp(`^/${name}`),
to: path.posix.join(baseUrl, pages[name].filename || `${name}.html`)
}))
return [
...multiPageRewrites,
{ from: /./, to: path.posix.join(baseUrl, 'index.html') }
]
}
module.exports.defaultModes = {
serve: 'development'
}
@@ -1,36 +0,0 @@
const fs = require('fs')
module.exports = function loadEnv (path = '.env') {
const config = parse(fs.readFileSync(path, 'utf-8'))
Object.keys(config).forEach(key => {
if (typeof process.env[key] === 'undefined') {
process.env[key] = config[key]
}
})
return config
}
function parse (src) {
const res = {}
src.split('\n').forEach(line => {
// matching "KEY' and 'VAL' in 'KEY=VAL'
const keyValueArr = line.match(/^\s*([\w\.\-]+)\s*=\s*(.*)?\s*$/)
// matched?
if (keyValueArr != null) {
const key = keyValueArr[1]
let value = keyValueArr[2] || ''
// expand newlines in quoted values
const len = value ? value.length : 0
if (len > 0 && value.charAt(0) === '"' && value.charAt(len - 1) === '"') {
value = value.replace(/\\n/gm, '\n')
}
// remove any surrounding quotes and extra spaces
value = value.replace(/(^['"]|['"]$)/g, '').trim()
res[key] = value
}
})
return res
}
+11 -9
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-service",
"version": "3.4.0",
"version": "3.4.1",
"description": "local service for vue-cli projects",
"main": "lib/Service.js",
"typings": "types/index.d.ts",
@@ -9,7 +9,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-service"
},
"keywords": [
"vue",
@@ -24,12 +25,12 @@
"dependencies": {
"@intervolga/optimize-cssnano-plugin": "^1.0.5",
"@soda/friendly-errors-webpack-plugin": "^1.7.1",
"@vue/cli-overlay": "^3.4.0",
"@vue/cli-shared-utils": "^3.4.0",
"@vue/cli-overlay": "^3.4.1",
"@vue/cli-shared-utils": "^3.4.1",
"@vue/component-compiler-utils": "^2.5.2",
"@vue/preload-webpack-plugin": "^1.1.0",
"@vue/web-component-wrapper": "^1.2.0",
"acorn": "^6.0.6",
"acorn": "^6.1.0",
"acorn-walk": "^6.1.1",
"address": "^1.0.3",
"autoprefixer": "^9.4.7",
@@ -40,8 +41,9 @@
"cliui": "^4.1.0",
"copy-webpack-plugin": "^4.6.0",
"css-loader": "^1.0.1",
"cssnano": "^4.1.8",
"cssnano": "^4.1.10",
"debug": "^4.1.1",
"dotenv": "^6.2.0",
"escape-string-regexp": "^1.0.5",
"file-loader": "^3.0.1",
"fs-extra": "^7.0.1",
@@ -54,7 +56,7 @@
"lodash.transform": "^4.6.0",
"mini-css-extract-plugin": "^0.5.0",
"minimist": "^1.2.0",
"ora": "^3.0.0",
"ora": "^3.1.0",
"portfinder": "^1.0.20",
"postcss-loader": "^3.0.0",
"read-pkg": "^4.0.1",
@@ -63,12 +65,12 @@
"source-map-url": "^0.4.0",
"ssri": "^6.0.1",
"string.prototype.padend": "^3.0.0",
"terser-webpack-plugin": "^1.2.1",
"terser-webpack-plugin": "^1.2.2",
"thread-loader": "^2.1.2",
"url-loader": "^1.1.2",
"vue-loader": "^15.6.2",
"webpack": ">=4 < 4.29",
"webpack-bundle-analyzer": "^3.0.3",
"webpack-bundle-analyzer": "^3.0.4",
"webpack-chain": "^4.11.0",
"webpack-dev-server": "^3.1.14",
"webpack-merge": "^4.2.1",
+3 -2
View File
@@ -1,11 +1,12 @@
{
"name": "@vue/cli-shared-utils",
"version": "3.4.0",
"version": "3.4.1",
"description": "shared utilities for vue-cli packages",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-shared-utils"
},
"keywords": [
"vue",
+3 -2
View File
@@ -1,10 +1,11 @@
{
"name": "@vue/cli-test-utils",
"version": "3.4.0",
"version": "3.4.1",
"description": "test utilities for vue-cli packages",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-test-utils"
},
"keywords": [
"vue",
@@ -1,6 +1,11 @@
{
"name": "@vue/cli-ui-addon-webpack",
"version": "3.4.0",
"version": "3.4.1",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-ui-addon-webpack"
},
"files": [
"dist",
"src"
@@ -13,9 +18,9 @@
},
"license": "MIT",
"devDependencies": {
"@vue/cli-plugin-babel": "^3.4.0",
"@vue/cli-plugin-eslint": "^3.4.0",
"@vue/cli-service": "^3.4.0",
"@vue/cli-plugin-babel": "^3.4.1",
"@vue/cli-plugin-eslint": "^3.4.1",
"@vue/cli-service": "^3.4.1",
"@vue/eslint-config-standard": "^4.0.0",
"eslint": "^5.8.0",
"stylus": "^0.54.5",
@@ -1,6 +1,11 @@
{
"name": "@vue/cli-ui-addon-widgets",
"version": "3.4.0",
"version": "3.4.1",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-ui-addon-widgets"
},
"files": [
"dist",
"src"
@@ -13,9 +18,9 @@
},
"license": "MIT",
"devDependencies": {
"@vue/cli-plugin-babel": "^3.4.0",
"@vue/cli-plugin-eslint": "^3.4.0",
"@vue/cli-service": "^3.4.0",
"@vue/cli-plugin-babel": "^3.4.1",
"@vue/cli-plugin-eslint": "^3.4.1",
"@vue/cli-service": "^3.4.1",
"@vue/eslint-config-standard": "^4.0.0",
"eslint": "^5.8.0",
"stylus": "^0.54.5",
+11 -6
View File
@@ -1,6 +1,11 @@
{
"name": "@vue/cli-ui",
"version": "3.4.0",
"version": "3.4.1",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-ui"
},
"scripts": {
"serve": "cross-env VUE_APP_CLI_UI_URL=ws://localhost:4030/graphql VUE_APP_GRAPHQL_PORT=4030 vue-cli-service serve",
"build": "vue-cli-service build",
@@ -28,7 +33,7 @@
],
"dependencies": {
"@akryum/winattr": "^3.0.0",
"@vue/cli-shared-utils": "^3.4.0",
"@vue/cli-shared-utils": "^3.4.1",
"chalk": "^2.4.1",
"clone": "^2.1.1",
"deepmerge": "^3.0.0",
@@ -56,10 +61,10 @@
"watch": "^1.0.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.4.0",
"@vue/cli-plugin-e2e-cypress": "^3.4.0",
"@vue/cli-plugin-eslint": "^3.4.0",
"@vue/cli-service": "^3.4.0",
"@vue/cli-plugin-babel": "^3.4.1",
"@vue/cli-plugin-e2e-cypress": "^3.4.1",
"@vue/cli-plugin-eslint": "^3.4.1",
"@vue/cli-service": "^3.4.1",
"@vue/eslint-config-standard": "^4.0.0",
"@vue/ui": "^0.5.5",
"ansi_up": "^3.0.0",
+2 -2
View File
@@ -1,7 +1,7 @@
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import deepmerge from 'deepmerge'
import VueTimeago from 'vue-timeago'
import VueTimeago, { createTimeago } from 'vue-timeago'
Vue.use(VueI18n)
@@ -50,7 +50,7 @@ async function autoDetect () {
}
const dateFnsLocale = i18n.locale.toLowerCase().replace(/-/g, '_')
Vue.component('VueTimeago', VueTimeago.createTimeago({
Vue.component('VueTimeago', createTimeago({
name: 'VueTimeago',
locale: i18n.locale,
locales: {
+3 -2
View File
@@ -1,11 +1,12 @@
{
"name": "@vue/cli-upgrade",
"version": "3.4.0",
"version": "3.4.1",
"description": "utility to upgrade vue cli service / plugins in vue apps",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli-upgrade"
},
"keywords": [
"vue",
+7 -6
View File
@@ -1,13 +1,14 @@
{
"name": "@vue/cli",
"version": "3.4.0",
"version": "3.4.1",
"description": "Command line interface for rapid Vue.js development",
"bin": {
"vue": "bin/vue.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/cli"
},
"keywords": [
"vue",
@@ -23,10 +24,10 @@
"access": "public"
},
"dependencies": {
"@vue/cli-shared-utils": "^3.4.0",
"@vue/cli-ui": "^3.4.0",
"@vue/cli-ui-addon-webpack": "^3.4.0",
"@vue/cli-ui-addon-widgets": "^3.4.0",
"@vue/cli-shared-utils": "^3.4.1",
"@vue/cli-ui": "^3.4.1",
"@vue/cli-ui-addon-webpack": "^3.4.1",
"@vue/cli-ui-addon-widgets": "^3.4.1",
"chalk": "^2.4.1",
"cmd-shim": "^2.0.2",
"commander": "^2.16.0",
@@ -8,7 +8,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/eslint-config-airbnb"
},
"keywords": [
"vue",
@@ -8,7 +8,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/eslint-config-prettier"
},
"keywords": [
"vue",
@@ -23,6 +24,6 @@
"dependencies": {
"eslint-config-prettier": "^4.0.0",
"eslint-plugin-prettier": "^3.0.1",
"prettier": "^1.16.3"
"prettier": "^1.16.4"
}
}
@@ -8,7 +8,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/eslint-config-standard"
},
"keywords": [
"vue",
@@ -8,7 +8,8 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/vuejs/vue-cli.git"
"url": "git+https://github.com/vuejs/vue-cli.git",
"directory": "packages/@vue/eslint-config-typescript"
},
"keywords": [
"vue",
+21 -21
View File
@@ -1,30 +1,30 @@
{
"name": "vue-cli-version-marker",
"version": "3.4.0",
"version": "3.4.1",
"description": "version marker for @vue/cli",
"author": "Evan You",
"license": "MIT",
"main": "package.json",
"devDependencies": {
"@vue/babel-preset-app": "3.4.0",
"@vue/cli-init": "3.4.0",
"@vue/cli-overlay": "3.4.0",
"@vue/cli-plugin-babel": "3.4.0",
"@vue/cli-plugin-e2e-cypress": "3.4.0",
"@vue/cli-plugin-e2e-nightwatch": "3.4.0",
"@vue/cli-plugin-eslint": "3.4.0",
"@vue/cli-plugin-pwa": "3.4.0",
"@vue/cli-plugin-typescript": "3.4.0",
"@vue/cli-plugin-unit-jest": "3.4.0",
"@vue/cli-plugin-unit-mocha": "3.4.0",
"@vue/cli-service-global": "3.4.0",
"@vue/cli-service": "3.4.0",
"@vue/cli-shared-utils": "3.4.0",
"@vue/cli-test-utils": "3.4.0",
"@vue/cli-ui-addon-webpack": "3.4.0",
"@vue/cli-ui-addon-widgets": "3.4.0",
"@vue/cli-ui": "3.4.0",
"@vue/cli-upgrade": "3.4.0",
"@vue/cli": "3.4.0"
"@vue/babel-preset-app": "3.4.1",
"@vue/cli-init": "3.4.1",
"@vue/cli-overlay": "3.4.1",
"@vue/cli-plugin-babel": "3.4.1",
"@vue/cli-plugin-e2e-cypress": "3.4.1",
"@vue/cli-plugin-e2e-nightwatch": "3.4.1",
"@vue/cli-plugin-eslint": "3.4.1",
"@vue/cli-plugin-pwa": "3.4.1",
"@vue/cli-plugin-typescript": "3.4.1",
"@vue/cli-plugin-unit-jest": "3.4.1",
"@vue/cli-plugin-unit-mocha": "3.4.1",
"@vue/cli-service-global": "3.4.1",
"@vue/cli-service": "3.4.1",
"@vue/cli-shared-utils": "3.4.1",
"@vue/cli-test-utils": "3.4.1",
"@vue/cli-ui-addon-webpack": "3.4.1",
"@vue/cli-ui-addon-widgets": "3.4.1",
"@vue/cli-ui": "3.4.1",
"@vue/cli-upgrade": "3.4.1",
"@vue/cli": "3.4.1"
}
}
+5
View File
@@ -6059,6 +6059,11 @@ dot-prop@^4.1.0, dot-prop@^4.1.1, dot-prop@^4.2.0:
dependencies:
is-obj "^1.0.0"
dotenv@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-6.2.0.tgz#941c0410535d942c8becf28d3f357dbd9d476064"
integrity sha512-HygQCKUBSFl8wKQZBSemMywRWcEDNidvNbjGVyZu3nbZ8qq9ubiPoGLMdRDpfSrpkkm9BXYFkpKxxFX38o/76w==
download-git-repo@^1.0.1, download-git-repo@^1.0.2:
version "1.1.0"
resolved "https://registry.yarnpkg.com/download-git-repo/-/download-git-repo-1.1.0.tgz#7dc88a82ced064b1372a0002f8a3aebf10eb1d3c"