Skip to content

Commit f683ee8

Browse files
committed
chore: merge branch 'v3' into docs
2 parents b092e25 + e84de1a commit f683ee8

File tree

14 files changed

+98
-28
lines changed

14 files changed

+98
-28
lines changed

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
2+
## 3.8.3 (2019-06-13)
3+
4+
#### :bug: Bug Fix
5+
* `@vue/cli-service`
6+
* [#4083](https://github.com/vuejs/vue-cli/pull/4083) fix: display correct address when multiple network adapters present ([@sodatea](https://github.com/sodatea))
7+
* [#4095](https://github.com/vuejs/vue-cli/pull/4095) fix: fix resolve project local plugin's file path ([@sodatea](https://github.com/sodatea))
8+
9+
#### :memo: Documentation
10+
* [#3924](https://github.com/vuejs/vue-cli/pull/3924) docs: add more explanation at prompts ([@kazupon](https://github.com/kazupon))
11+
12+
#### Committers: 2
13+
- Haoqun Jiang ([@sodatea](https://github.com/sodatea))
14+
- kazuya kawaguchi ([@kazupon](https://github.com/kazupon))
15+
16+
117
## 3.8.2 (2019-05-26)
218

319
#### :bug: Bug Fix

docs/dev-guide/plugin-dev.md

+51-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ A generator should export a function which receives three arguments:
102102

103103
And if the user creates a project using the `foo` preset, then the generator of `@vue/cli-plugin-foo` will receive `{ option: 'bar' }` as its second argument.
104104

105-
For a 3rd party plugin, the options will be resolved from the prompts or command line arguments when the user executes `vue invoke` (see [Prompts for 3rd party plugins](#prompts-for-3rd-party-plugins)).
105+
For a 3rd party plugin, the options will be resolved from the prompts or command line arguments when the user executes `vue invoke` (see [Prompts](#prompts)).
106106

107107
3. The entire preset (`presets.foo`) will be passed as the third argument.
108108

@@ -430,7 +430,56 @@ This is because the command's expected mode needs to be known before loading env
430430

431431
Prompts are required to handle user choices when creating a new project or adding a new plugin to the existing one. All prompts logic is stored inside the `prompts.js` file. The prompts are presented using [inquirer](https://github.com/SBoudrias/Inquirer.js) under the hood.
432432

433-
When user initialize the plugin by calling `vue invoke`, if the plugin contains a `prompts.js` in its root directory, it will be used during invocation. The file should export an array of [Questions](https://github.com/SBoudrias/Inquirer.js#question) that will be handled by Inquirer.js. The resolved answers object will be passed to the plugin's generator as options.
433+
When user initialize the plugin by calling `vue invoke`, if the plugin contains a `prompts.js` in its root directory, it will be used during invocation. The file should export an array of [Questions](https://github.com/SBoudrias/Inquirer.js#question) that will be handled by Inquirer.js.
434+
435+
You should export directly array of questions, or export function that return those.
436+
437+
e.g. directly array of questions:
438+
```js
439+
// prompts.js
440+
441+
module.exports = [
442+
{
443+
type: 'input',
444+
name: 'locale',
445+
message: 'The locale of project localization.',
446+
validate: input => !!input,
447+
default: 'en'
448+
},
449+
// ...
450+
]
451+
```
452+
453+
e.g. function that return array of questions:
454+
```js
455+
// prompts.js
456+
457+
// pass `package.json` of project to function argument
458+
module.exports = pkg => {
459+
const prompts = [
460+
{
461+
type: 'input',
462+
name: 'locale',
463+
message: 'The locale of project localization.',
464+
validate: input => !!input,
465+
default: 'en'
466+
}
467+
]
468+
469+
// add dynamically propmpt
470+
if ('@vue/cli-plugin-eslint' in (pkg.devDependencies || {})) {
471+
prompts.push({
472+
type: 'confirm',
473+
name: 'useESLintPluginVueI18n',
474+
message: 'Use ESLint plugin for Vue I18n ?'
475+
})
476+
}
477+
478+
return prompts
479+
}
480+
```
481+
482+
The resolved answers object will be passed to the plugin's generator as options.
434483

435484
Alternatively, the user can skip the prompts and directly initialize the plugin by passing options via the command line, e.g.:
436485

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"npmClient": "yarn",
33
"useWorkspaces": false,
4-
"version": "3.8.2",
4+
"version": "3.8.3",
55
"packages": [
66
"packages/@vue/babel-preset-app",
77
"packages/@vue/cli*"

packages/@vue/cli-service-global/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/cli-service-global",
3-
"version": "3.8.0",
3+
"version": "3.8.3",
44
"description": "vue-cli-service global addon for vue-cli",
55
"main": "index.js",
66
"publishConfig": {
@@ -25,7 +25,7 @@
2525
"@vue/babel-preset-app": "^3.8.0",
2626
"@vue/cli-plugin-babel": "^3.8.0",
2727
"@vue/cli-plugin-eslint": "^3.8.0",
28-
"@vue/cli-service": "^3.8.0",
28+
"@vue/cli-service": "^3.8.3",
2929
"babel-eslint": "^10.0.1",
3030
"chalk": "^2.4.2",
3131
"eslint": "^4.19.1",

packages/@vue/cli-service/lib/Service.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ module.exports = class Service {
189189
}
190190
plugins = plugins.concat(files.map(file => ({
191191
id: `local:${file}`,
192-
apply: loadModule(file, this.pkgContext)
192+
apply: loadModule(`./${file}`, this.pkgContext)
193193
})))
194194
}
195195

packages/@vue/cli-service/lib/commands/serve.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ module.exports = (api, options) => {
164164
api.service.devServerConfigFns.forEach(fn => fn(app, server))
165165
// apply in project middlewares
166166
projectDevServerOptions.before && projectDevServerOptions.before(app, server)
167-
}
167+
},
168+
// avoid opening browser
169+
open: false
168170
}))
169171

170172
;['SIGINT', 'SIGTERM'].forEach(signal => {

packages/@vue/cli-service/lib/util/prepareURLs.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
const url = require('url')
1010
const chalk = require('chalk')
1111
const address = require('address')
12+
const defaultGateway = require('default-gateway')
1213

1314
module.exports = function prepareUrls (protocol, host, port, pathname = '/') {
1415
const formatUrl = hostname =>
@@ -33,7 +34,8 @@ module.exports = function prepareUrls (protocol, host, port, pathname = '/') {
3334
prettyHost = 'localhost'
3435
try {
3536
// This can only return an IPv4 address
36-
lanUrlForConfig = address.ip()
37+
const result = defaultGateway.v4.sync()
38+
lanUrlForConfig = address.ip(result && result.interface)
3739
if (lanUrlForConfig) {
3840
// Check if the address is a private ip
3941
// https://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces

packages/@vue/cli-service/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/cli-service",
3-
"version": "3.8.0",
3+
"version": "3.8.3",
44
"description": "local service for vue-cli projects",
55
"main": "lib/Service.js",
66
"typings": "types/index.d.ts",
@@ -46,6 +46,7 @@
4646
"cssnano": "^4.1.10",
4747
"current-script-polyfill": "^1.0.0",
4848
"debug": "^4.1.1",
49+
"default-gateway": "^4.2.0",
4950
"dotenv": "^7.0.0",
5051
"dotenv-expand": "^5.1.0",
5152
"escape-string-regexp": "^1.0.5",

packages/@vue/cli-ui-addon-webpack/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/cli-ui-addon-webpack",
3-
"version": "3.8.0",
3+
"version": "3.8.3",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/vuejs/vue-cli.git",
@@ -20,7 +20,7 @@
2020
"devDependencies": {
2121
"@vue/cli-plugin-babel": "^3.8.0",
2222
"@vue/cli-plugin-eslint": "^3.8.0",
23-
"@vue/cli-service": "^3.8.0",
23+
"@vue/cli-service": "^3.8.3",
2424
"@vue/eslint-config-standard": "^4.0.0",
2525
"eslint": "^5.16.0",
2626
"stylus": "^0.54.5",

packages/@vue/cli-ui-addon-widgets/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/cli-ui-addon-widgets",
3-
"version": "3.8.0",
3+
"version": "3.8.3",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/vuejs/vue-cli.git",
@@ -20,7 +20,7 @@
2020
"devDependencies": {
2121
"@vue/cli-plugin-babel": "^3.8.0",
2222
"@vue/cli-plugin-eslint": "^3.8.0",
23-
"@vue/cli-service": "^3.8.0",
23+
"@vue/cli-service": "^3.8.3",
2424
"@vue/eslint-config-standard": "^4.0.0",
2525
"eslint": "^5.16.0",
2626
"stylus": "^0.54.5",

packages/@vue/cli-ui/apollo-server/util/parse-args.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ exports.parseArgs = function (args) {
99
for (const part of parts) {
1010
const l = part.length
1111
if (!arg && part.charAt(0) === '"') {
12-
arg = part.substr(1)
12+
arg = part
1313
} else if (part.charAt(l - 1) === '"' && (
1414
l === 1 || part.charAt(l - 2) !== '\\'
1515
)) {
16-
arg += args.charAt(index - 1) + part.substr(0, l - 1)
16+
arg += args.charAt(index - 1) + part.substr(0, l)
1717
result.push(arg)
1818
arg = null
1919
} else if (arg) {

packages/@vue/cli-ui/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/cli-ui",
3-
"version": "3.8.0",
3+
"version": "3.8.3",
44
"repository": {
55
"type": "git",
66
"url": "git+https://github.com/vuejs/vue-cli.git",
@@ -69,7 +69,7 @@
6969
"@vue/cli-plugin-babel": "^3.8.0",
7070
"@vue/cli-plugin-e2e-cypress": "^3.8.0",
7171
"@vue/cli-plugin-eslint": "^3.8.0",
72-
"@vue/cli-service": "^3.8.0",
72+
"@vue/cli-service": "^3.8.3",
7373
"@vue/eslint-config-standard": "^4.0.0",
7474
"@vue/ui": "^0.9.1",
7575
"ansi_up": "^3.0.0",

packages/@vue/cli/package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vue/cli",
3-
"version": "3.8.2",
3+
"version": "3.8.3",
44
"description": "Command line interface for rapid Vue.js development",
55
"bin": {
66
"vue": "bin/vue.js"
@@ -25,9 +25,9 @@
2525
},
2626
"dependencies": {
2727
"@vue/cli-shared-utils": "^3.8.0",
28-
"@vue/cli-ui": "^3.8.0",
29-
"@vue/cli-ui-addon-webpack": "^3.8.0",
30-
"@vue/cli-ui-addon-widgets": "^3.8.0",
28+
"@vue/cli-ui": "^3.8.3",
29+
"@vue/cli-ui-addon-webpack": "^3.8.3",
30+
"@vue/cli-ui-addon-widgets": "^3.8.3",
3131
"chalk": "^2.4.1",
3232
"cmd-shim": "^2.0.2",
3333
"commander": "^2.20.0",

packages/vue-cli-version-marker/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-cli-version-marker",
3-
"version": "3.8.2",
3+
"version": "3.8.3",
44
"description": "version marker for @vue/cli",
55
"author": "Evan You",
66
"license": "MIT",
@@ -17,14 +17,14 @@
1717
"@vue/cli-plugin-typescript": "3.8.1",
1818
"@vue/cli-plugin-unit-jest": "3.8.0",
1919
"@vue/cli-plugin-unit-mocha": "3.8.0",
20-
"@vue/cli-service-global": "3.8.0",
21-
"@vue/cli-service": "3.8.0",
20+
"@vue/cli-service-global": "3.8.3",
21+
"@vue/cli-service": "3.8.3",
2222
"@vue/cli-shared-utils": "3.8.0",
2323
"@vue/cli-test-utils": "3.8.0",
24-
"@vue/cli-ui-addon-webpack": "3.8.0",
25-
"@vue/cli-ui-addon-widgets": "3.8.0",
26-
"@vue/cli-ui": "3.8.0",
24+
"@vue/cli-ui-addon-webpack": "3.8.3",
25+
"@vue/cli-ui-addon-widgets": "3.8.3",
26+
"@vue/cli-ui": "3.8.3",
2727
"@vue/cli-upgrade": "3.8.0",
28-
"@vue/cli": "3.8.2"
28+
"@vue/cli": "3.8.3"
2929
}
3030
}

0 commit comments

Comments
 (0)