chore(ui): merge dev

This commit is contained in:
Guillaume Chau
2018-04-26 20:22:02 +02:00
58 changed files with 1841 additions and 1403 deletions
+19
View File
@@ -1,3 +1,22 @@
<a name="3.0.0-beta.7"></a>
# [3.0.0-beta.7](https://github.com/vuejs/vue-cli/compare/v3.0.0-beta.6...v3.0.0-beta.7) (2018-04-25)
### Bug Fixes
* allow user to define onProxyReq ([#955](https://github.com/vuejs/vue-cli/issues/955)) ([179033d](https://github.com/vuejs/vue-cli/commit/179033d))
* **invoke:** issue [#1037](https://github.com/vuejs/vue-cli/issues/1037) invoke binary files ([#1038](https://github.com/vuejs/vue-cli/issues/1038)) ([e65110f](https://github.com/vuejs/vue-cli/commit/e65110f))
* babel legacy decorator ([#1163](https://github.com/vuejs/vue-cli/issues/1163)) ([fb013da](https://github.com/vuejs/vue-cli/commit/fb013da))
* pin babel version (fix [#1162](https://github.com/vuejs/vue-cli/issues/1162)) ([dbc3f10](https://github.com/vuejs/vue-cli/commit/dbc3f10))
### Features
* allow vue add to work with plugins without a generator ([#1032](https://github.com/vuejs/vue-cli/issues/1032)) ([11956ac](https://github.com/vuejs/vue-cli/commit/11956ac))
* use `esnext` targets for downleveling and modules. ([#966](https://github.com/vuejs/vue-cli/issues/966)) ([ba5a375](https://github.com/vuejs/vue-cli/commit/ba5a375))
<a name="3.0.0-beta.6"></a>
# [3.0.0-beta.6](https://github.com/vuejs/vue-cli/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2018-03-06)
+33
View File
@@ -77,6 +77,21 @@ module.exports = {
}
```
#### Replace existing Base Loader
If you want to replace an existing [Base Loader](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-service/lib/config/base.js), for example using `vue-svg-loader` to inline SVG files instead of loading the file:
``` js
// vue.config.js
module.exports = {
chainWebpack: config => {
config.module
.rule('svg')
.use('file-loader')
.loader('vue-svg-loader')
}
}
```
#### Modifying Plugin Options
@@ -95,6 +110,24 @@ module.exports = {
You will need to familiarize yourself with [webpack-chain's API](https://github.com/mozilla-neutrino/webpack-chain#getting-started) and [read some source code](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-service/lib/config) in order to understand how to leverage the full power of this option, but it gives you a more expressive and safer way to modify the webpack config than directly mutation values.
For example, say you want to change the default location of index.html from */Users/username/proj/public/index.html* to */Users/username/proj/app/templates/index.html*. By referencing [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin#options) you can see a list of options you can pass in. To change our template path we can pass in a new template path with the following config:
``` js
// vue.config.js
module.exports = {
chainWebpack: config => {
config
.plugin('html')
.tap(args => {
args[0].template = '/Users/username/proj/app/templates/index.html'
return args
})
}
}
```
You can confirm that this change has taken place by examining the vue webpack config with the **vue inspect** utility, which we will discuss next.
### Inspecting the Project's Webpack Config
Since `@vue/cli-service` abstracts away the webpack config, it may be more difficult to understand what is included in the config, especially when you are trying to make tweaks yourself.
+1 -1
View File
@@ -2,5 +2,5 @@
"lerna": "2.5.1",
"npmClient": "yarn",
"useWorkspaces": true,
"version": "3.0.0-beta.6"
"version": "3.0.0-beta.7"
}
+1 -1
View File
@@ -42,7 +42,7 @@
]
},
"devDependencies": {
"babel-core": "^7.0.0-0",
"babel-core": "7.0.0-bridge.0",
"debug": "^3.1.0",
"eslint": "^4.16.0",
"eslint-plugin-vue-libs": "^2.1.0",
@@ -31,8 +31,8 @@ test('object spread', () => {
const { code } = babel.transformSync(`
const a = { ...b }
`.trim(), defaultOptions)
expect(code).toMatch(`import "core-js/modules/es6.object.assign"`)
expect(code).toMatch(`var a = Object.assign({}, b)`)
expect(code).toMatch(`import _objectSpread from`)
expect(code).toMatch(`var a = _objectSpread({}, b)`)
})
test('dynamic import', () => {
+2 -1
View File
@@ -37,7 +37,8 @@ module.exports = (context, options = {}) => {
// stage 2. This includes some important transforms, e.g. dynamic import
// and rest object spread.
presets.push([require('@babel/preset-stage-2'), {
useBuiltIns: true
useBuiltIns: true,
decoratorsLegacy: options.decoratorsLegacy !== false
}])
// transform runtime, but only for helpers
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/babel-preset-app",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "babel-preset-app for vue-cli",
"main": "index.js",
"publishConfig": {
@@ -21,11 +21,11 @@
},
"homepage": "https://github.com/vuejs/vue-cli/packages/@vue/babel-preset-app#readme",
"dependencies": {
"@babel/plugin-syntax-jsx": "^7.0.0-0",
"@babel/plugin-transform-runtime": "^7.0.0-0",
"@babel/preset-env": "^7.0.0-0",
"@babel/preset-stage-2": "^7.0.0-0",
"@babel/runtime": "^7.0.0-0",
"@babel/plugin-syntax-jsx": "7.0.0-beta.46",
"@babel/plugin-transform-runtime": "7.0.0-beta.46",
"@babel/preset-env": "7.0.0-beta.46",
"@babel/preset-stage-2": "7.0.0-beta.46",
"@babel/runtime": "7.0.0-beta.46",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-plugin-dynamic-import-node": "^1.2.0",
"babel-plugin-transform-vue-jsx": "^4.0.1"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-init",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "init addon for vue-cli",
"main": "index.js",
"publishConfig": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-overlay",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "error overlay & dev server middleware for vue-cli",
"main": "dist/client.js",
"files": [
+1 -1
View File
@@ -6,7 +6,7 @@
Uses Babel 7 + `babel-loader` + [@vue/babel-preset-app](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app) by default, but can be configured via `.babelrc` to use any other Babel presets or plugins.
By default, `babel-loader` is only applied to files inside `src` and `test` directories. If you wish to explicitly transpile a dependency module, you will need to configure webpack in `vue.config.js`:
By default, `babel-loader` is only applied to files inside `src` and `tests` directories. If you wish to explicitly transpile a dependency module, you will need to configure webpack in `vue.config.js`:
``` js
module.exports = {
+1 -1
View File
@@ -8,7 +8,7 @@ module.exports = (api, options) => {
.test(/\.jsx?$/)
.include
.add(api.resolve('src'))
.add(api.resolve('test'))
.add(api.resolve('tests'))
.end()
.use('cache-loader')
.loader('cache-loader')
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-plugin-babel",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "babel plugin for vue-cli",
"main": "index.js",
"repository": {
@@ -19,8 +19,8 @@
},
"homepage": "https://github.com/vuejs/vue-cli/packages/@vue/cli-plugin-babel#readme",
"dependencies": {
"@babel/core": "^7.0.0-0",
"@vue/babel-preset-app": "^3.0.0-beta.6",
"@babel/core": "7.0.0-beta.46",
"@vue/babel-preset-app": "^3.0.0-beta.7",
"babel-loader": "^8.0.0-0"
},
"publishConfig": {
@@ -1,7 +1,7 @@
// https://docs.cypress.io/api/introduction/api.html
describe('My First Test', () => {
it('Visits the Kitchen Sink', () => {
it('Visits the app root url', () => {
cy.visit('/')
cy.contains('h1', 'Welcome to Your Vue.js <%- hasTS ? '+ TypeScript ' : '' %>App')
})
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-plugin-e2e-cypress",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "e2e-cypress plugin for vue-cli",
"main": "index.js",
"repository": {
@@ -12,6 +12,7 @@
```
--url run e2e tests against given url instead of auto-starting dev server
--config use custom nightwatch config file (overrides internals)
-e, --env specify comma-delimited browser envs to run in (default: chrome)
-t, --test sepcify a test to run by name
-f, --filter glob to filter tests by filename
@@ -23,6 +24,8 @@
We've pre-configured Nightwatch to run with Chrome by default. If you wish to run e2e tests in additional browsers, you will need to add a `nightwatch.config.js` or `nightwatch.json` in your project root to configure additional browsers. The config will be merged into the [internal Nightwatch config](https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-plugin-e2e-nightwatch/nightwatch.config.js).
Alternatively, you can completely replace the internal config with a custom config file using the `--config` option.
Consult Nightwatch docs for [configuration options](http://nightwatchjs.org/gettingstarted#settings-file) and how to [setup browser drivers](http://nightwatchjs.org/gettingstarted#browser-drivers-setup).
## Installing in an Already Created Project
@@ -13,6 +13,7 @@ module.exports = (api, options) => {
usage: 'vue-cli-service e2e [options]',
options: {
'--url': 'run e2e tests against given url instead of auto-starting dev server',
'--config': 'use custom nightwatch config file (overrides internals)',
'-e, --env': 'specify comma-delimited browser envs to run in (default: chrome)',
'-t, --test': 'sepcify a test to run by name',
'-f, --filter': 'glob to filter tests by filename'
@@ -31,17 +32,20 @@ module.exports = (api, options) => {
return serverPromise.then(({ server, url }) => {
// expose dev server url to tests
process.env.VUE_DEV_SERVER_URL = url
// expose user options to config file
const fs = require('fs')
let userOptionsPath, userOptions
if (fs.existsSync(userOptionsPath = api.resolve('nightwatch.config.js'))) {
userOptions = require(userOptionsPath)
} else if (fs.existsSync(userOptionsPath = api.resolve('nightwatch.json'))) {
userOptions = require(userOptionsPath)
}
process.env.VUE_NIGHTWATCH_USER_OPTIONS = JSON.stringify(userOptions || {})
if (rawArgs.indexOf('--config') === -1) {
// expose user options to config file
const fs = require('fs')
let userOptionsPath, userOptions
if (fs.existsSync(userOptionsPath = api.resolve('nightwatch.config.js'))) {
userOptions = require(userOptionsPath)
} else if (fs.existsSync(userOptionsPath = api.resolve('nightwatch.json'))) {
userOptions = require(userOptionsPath)
}
process.env.VUE_NIGHTWATCH_USER_OPTIONS = JSON.stringify(userOptions || {})
rawArgs.push('--config', require.resolve('./nightwatch.config.js'))
}
rawArgs.push('--config', require.resolve('./nightwatch.config.js'))
if (rawArgs.indexOf('--env') === -1) {
rawArgs.push('--env', 'chrome')
}
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-plugin-e2e-nightwatch",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "e2e-nightwatch plugin for vue-cli",
"main": "index.js",
"repository": {
@@ -22,10 +22,10 @@
"access": "public"
},
"dependencies": {
"chromedriver": "^2.35.0",
"chromedriver": "^2.38.1",
"deepmerge": "^2.0.1",
"execa": "^0.9.0",
"nightwatch": "^0.9.20",
"selenium-server": "^3.10.0"
"nightwatch": "^0.9.21",
"selenium-server": "^3.11.0"
}
}
+4 -4
View File
@@ -17,17 +17,17 @@ module.exports = (api, { config, lintOn = [] }) => {
if (config === 'airbnb') {
pkg.eslintConfig.extends.push('@vue/airbnb')
Object.assign(pkg.devDependencies, {
'@vue/eslint-config-airbnb': '^3.0.0-beta.6'
'@vue/eslint-config-airbnb': '^3.0.0-beta.7'
})
} else if (config === 'standard') {
pkg.eslintConfig.extends.push('@vue/standard')
Object.assign(pkg.devDependencies, {
'@vue/eslint-config-standard': '^3.0.0-beta.6'
'@vue/eslint-config-standard': '^3.0.0-beta.7'
})
} else if (config === 'prettier') {
pkg.eslintConfig.extends.push('@vue/prettier')
Object.assign(pkg.devDependencies, {
'@vue/eslint-config-prettier': '^3.0.0-beta.6'
'@vue/eslint-config-prettier': '^3.0.0-beta.7'
})
} else {
// default
@@ -38,7 +38,7 @@ module.exports = (api, { config, lintOn = [] }) => {
if (api.hasPlugin('typescript')) {
pkg.eslintConfig.extends.push('@vue/typescript')
Object.assign(pkg.devDependencies, {
'@vue/eslint-config-typescript': '^3.0.0-beta.6'
'@vue/eslint-config-typescript': '^3.0.0-beta.7'
})
}
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-plugin-eslint",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "eslint plugin for vue-cli",
"main": "index.js",
"repository": {
@@ -22,9 +22,9 @@
"access": "public"
},
"dependencies": {
"babel-eslint": "^8.2.2",
"eslint": "^4.18.2",
"babel-eslint": "^8.2.3",
"eslint": "^4.19.1",
"eslint-loader": "^2.0.0",
"eslint-plugin-vue": "^4.3.0"
"eslint-plugin-vue": "^4.5.0"
}
}
+34 -3
View File
@@ -29,6 +29,30 @@ file, or the `"vue"` field in `package.json`.
[`GenerateSW`](https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin#full_generatesw_config)
or for [`InjectManifest`](https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin#full_injectmanifest_config).
- **pwa.name**
- Default: "name" field in `package.json`
Used as the value for the `apple-mobile-web-app-title` meta tag in the generated HTML. Note you will need to edit `public/manifest.json` to match this.
- **pwa.themeColor**
- Default: `'#4DBA87'`
- **pwa.msTileColor**
- Default: `'#000000'`
- **pwa.appleMobileWebAppCapable**
- Default: `'no'`
This defaults to `'no'` because iOS before 11.3 does not have proper PWA support. See [this article](https://medium.com/@firt/dont-use-ios-web-app-meta-tag-irresponsibly-in-your-progressive-web-apps-85d70f4438cb) for more details.
- **pwa.appleMobileWebAppStatusBarStyle**
- Default: `'default'`
### Example Configuration
```js
@@ -36,14 +60,21 @@ file, or the `"vue"` field in `package.json`.
module.exports = {
// ...other vue-cli plugin options...
pwa: {
name: 'My App',
themeColor: '#4DBA87',
msTileColor: '#000000',
appleMobileWebAppCapable: 'yes',
appleMobileWebAppStatusBarStyle: 'black',
// configure the workbox plugin
workboxPluginMode: 'InjectManifest',
workboxOptions: {
// swSrc is required in InjectManifest mode.
swSrc: 'dev/sw.js',
// ...other Workbox options...
},
},
};
}
}
}
```
## Installing in an Already Created Project
@@ -39,7 +39,7 @@ test('pwa', async () => {
// PWA specific directives
expect(index).toMatch(`<link rel=manifest href=/manifest.json>`)
expect(index).toMatch(`<!--[if IE]><link rel="shortcut icon" href="/favicon.ico"><![endif]-->`)
expect(index).toMatch(`<meta name=apple-mobile-web-app-capable content=yes>`)
expect(index).toMatch(`<meta name=apple-mobile-web-app-capable content=no>`)
// should import service worker script
const main = await project.read('src/main.js')
@@ -1,7 +1,9 @@
const defaults = {
name: 'PWA app',
themeColor: '#4DBA87', // The Vue color
msTileColor: '#000000'
msTileColor: '#000000',
appleMobileWebAppCapable: 'no',
appleMobileWebAppStatusBarStyle: 'default'
}
module.exports = class HtmlPwaPlugin {
@@ -18,7 +20,7 @@ module.exports = class HtmlPwaPlugin {
})
compilation.plugin('html-webpack-plugin-alter-asset-tags', (data, cb) => {
const { name, themeColor, msTileColor } = this.options
const { name, themeColor, msTileColor, appleMobileWebAppCapable, appleMobileWebAppStatusBarStyle } = this.options
const { publicPath } = compiler.options.output
data.head.push(
@@ -49,11 +51,11 @@ module.exports = class HtmlPwaPlugin {
// Add to home screen for Safari on iOS
makeTag('meta', {
name: 'apple-mobile-web-app-capable',
content: 'yes'
content: appleMobileWebAppCapable
}),
makeTag('meta', {
name: 'apple-mobile-web-app-status-bar-style',
content: 'black'
content: appleMobileWebAppStatusBarStyle
}),
makeTag('meta', {
name: 'apple-mobile-web-app-title',
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-plugin-pwa",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "pwa plugin for vue-cli",
"main": "index.js",
"repository": {
@@ -22,7 +22,7 @@
"access": "public"
},
"dependencies": {
"workbox-webpack-plugin": "^3.0.0-beta.1"
"workbox-webpack-plugin": "^3.1.0"
},
"devDependencies": {
"register-service-worker": "^1.0.0"
@@ -10,15 +10,16 @@ TypeScript can be configured via `tsconfig.json`.
This plugin can be used alongside `@vue/cli-plugin-babel`. When used with Babel, this plugin will output ES2015 and delegate the rest to Babel for auto polyfill based on browser targets.
By default, `ts-loader` is only applied to files inside `src` and `test` directories. If you wish to explicitly transpile a dependency module, you will need to configure webpack in `vue.config.js`:
By default, `ts-loader` is only applied to files inside `src` and `tests` directories. If you wish to explicitly transpile a dependency module, you will need to configure webpack in `vue.config.js`:
``` js
module.exports = {
chainWebpack: config => {
config
.rule('ts')
.include
.add(/module-to-transpile/)
.module
.rule('ts')
.include
.add(/module-to-transpile/)
}
}
```
@@ -35,8 +35,12 @@ test('classComponent', async () => {
expect(files['tsconfig.json']).toMatch(`"experimentalDecorators": true`)
expect(files['tsconfig.json']).toMatch(`"emitDecoratorMetadata": true`)
expect(files['src/App.vue']).toMatch(`export default class App extends Vue {`)
expect(files['src/components/HelloWorld.vue']).toMatch(`export default class HelloWorld extends Vue {`)
expect(files['src/App.vue']).toMatch(
`export default class App extends Vue {`
)
expect(files['src/components/HelloWorld.vue']).toMatch(
`export default class HelloWorld extends Vue {`
)
})
test('use with Babel', async () => {
@@ -96,6 +100,19 @@ test('lint with no lintOnSave', async () => {
expect(pkg.vue).toEqual({ lintOnSave: false })
})
test('tsconfig.json should be valid json', async () => {
const { files } = await generateWithPlugin([
{
id: 'ts',
apply: require('../generator'),
options: {}
}
])
expect(() => {
JSON.parse(files['tsconfig.json'])
}).not.toThrow()
})
test('compat with unit-mocha', async () => {
const { pkg } = await generateWithPlugin([
{
@@ -1,4 +1,4 @@
jest.setTimeout(40000)
jest.setTimeout(process.env.APPVEYOR ? 1200000 : 40000)
const create = require('@vue/cli-test-utils/createTestProject')
@@ -13,11 +13,10 @@
"sourceMap": true,
"baseUrl": ".",
"types": [
"node",
<%_ if (hasMocha) { _%>
"node"<%_ if (hasMocha) { _%>,
"mocha",
"chai"
<%_ } else if (hasJest) { _%>
<%_ } else if (hasJest) { _%>,
"jest"
<%_ } _%>
],
+1 -1
View File
@@ -21,7 +21,7 @@ module.exports = (api, {
.test(/\.tsx?$/)
.include
.add(api.resolve('src'))
.add(api.resolve('test'))
.add(api.resolve('tests'))
.end()
const vueLoader = config.module
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-plugin-typescript",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "typescript plugin for vue-cli",
"main": "index.js",
"repository": {
@@ -23,11 +23,11 @@
},
"dependencies": {
"@types/node": "^9.3.0",
"fork-ts-checker-webpack-plugin": "^0.4.0",
"fork-ts-checker-webpack-plugin": "^0.4.1",
"globby": "^8.0.1",
"ts-loader": "^3.4.0",
"tslint": "^5.9.1",
"typescript": "^2.7.2"
"typescript": "^2.8.3"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "7 || ^7.0.0-beta || ^7.0.0-rc",
@@ -11,3 +11,49 @@ test('should work', async () => {
})
await project.run(`vue-cli-service test`)
})
test('should respect jest testMatch config', async () => {
const project = await create('unit-jest-package.json', {
plugins: {
'@vue/cli-plugin-babel': {},
'@vue/cli-plugin-unit-jest': {}
}
})
const config = JSON.parse(await project.read('package.json'))
config.jest.testMatch = ['custom-test-directory/my.spec.js']
await project.write('package.json', JSON.stringify(config))
let result
try {
await project.run(`vue-cli-service test`)
} catch (e) {
result = e
}
expect(result.stdout).toMatch('testMatch: custom-test-directory/my.spec.js')
expect(result.stdout).toMatch('No tests found')
})
test('should respect jest.config.js testMatch config', async () => {
const project = await create('unit-jest-jest.config.js', {
plugins: {
'@vue/cli-plugin-babel': {},
'@vue/cli-plugin-unit-jest': {}
},
useConfigFiles: true
})
await project.write('jest.config.js', `
module.exports = ${JSON.stringify({
testMatch: ['custom-test-directory/my.spec.js']
})}
`)
let result
try {
await project.run(`vue-cli-service test`)
} catch (e) {
result = e
}
expect(result.stdout).toMatch('testMatch: custom-test-directory/my.spec.js')
expect(result.stdout).toMatch('No tests found')
})
@@ -28,6 +28,9 @@ module.exports = api => {
// serializer for snapshots
'snapshotSerializers': [
'jest-serializer-vue'
],
'testMatch': [
'<rootDir>/(tests/unit/**/*.spec.(ts|tsx|js)|**/__tests__/*.(ts|tsx|js))'
]
}
+1 -11
View File
@@ -17,18 +17,8 @@ module.exports = api => {
const execa = require('execa')
const jestBinPath = require.resolve('jest/bin/jest')
let testMatch = []
if (!args._.length) {
testMatch = [`--testMatch`, `<rootDir>/(tests/unit/**/*.spec.(ts|tsx|js)|**/__tests__/*.(ts|tsx|js))`]
}
const argv = [
...rawArgv,
...testMatch
]
return new Promise((resolve, reject) => {
const child = execa(jestBinPath, argv, {
const child = execa(jestBinPath, rawArgv, {
cwd: api.resolve('.'),
stdio: 'inherit'
})
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-plugin-unit-jest",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "unit-jest plugin for vue-cli",
"main": "index.js",
"repository": {
@@ -23,9 +23,9 @@
},
"dependencies": {
"execa": "^0.9.0",
"jest": "^22.4.2",
"jest-serializer-vue": "^0.3.0",
"vue-jest": "^2.1.1"
"jest": "^22.4.3",
"jest-serializer-vue": "^1.0.0",
"vue-jest": "^2.5.0"
},
"devDependencies": {
"@vue/test-utils": "^1.0.0-beta.10",
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-plugin-unit-mocha",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "mocha unit testing plugin for vue-cli",
"main": "index.js",
"repository": {
@@ -25,8 +25,8 @@
"jsdom": "^11.6.2",
"jsdom-global": "^3.0.2",
"mocha": "^4.1.0",
"mocha-webpack": "^1.0.1",
"webpack-node-externals": "^1.6.0"
"mocha-webpack": "^1.1.0",
"webpack-node-externals": "^1.7.2"
},
"devDependencies": {
"@vue/test-utils": "^1.0.0-beta.10",
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-service-global",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "vue-cli-service global addon for vue-cli",
"main": "index.js",
"publishConfig": {
@@ -21,15 +21,15 @@
},
"homepage": "https://github.com/vuejs/vue-cli/packages/@vue/cli-build#readme",
"dependencies": {
"@vue/babel-preset-app": "^3.0.0-beta.6",
"@vue/cli-plugin-babel": "^3.0.0-beta.6",
"@vue/cli-plugin-eslint": "^3.0.0-beta.6",
"@vue/cli-service": "^3.0.0-beta.6",
"@vue/babel-preset-app": "^3.0.0-beta.7",
"@vue/cli-plugin-babel": "^3.0.0-beta.7",
"@vue/cli-plugin-eslint": "^3.0.0-beta.7",
"@vue/cli-service": "^3.0.0-beta.7",
"@vue/cli-ui": "^3.0.0-beta.6",
"@vue/cli-ui-addon-webpack": "^3.0.0-beta.6",
"chalk": "^2.3.2",
"chalk": "^2.4.0",
"eslint-plugin-vue": "^4.3.0",
"resolve": "^1.5.0",
"vue": "^2.5.13"
"resolve": "^1.7.1",
"vue": "^2.5.16"
}
}
@@ -32,7 +32,7 @@ test('loading plugins from package.json', () => {
mockPkg({
devDependencies: {
'bar': '^1.0.0',
'@vue/cli-plugin-babel': '^3.0.0-beta.6',
'@vue/cli-plugin-babel': '^3.0.0-beta.7',
'vue-cli-plugin-foo': '^1.0.0'
}
})
+1 -1
View File
@@ -7,7 +7,7 @@ module.exports = (api, options) => {
'build': 'vue-cli-service build'
},
dependencies: {
'vue': '^2.5.13'
'vue': '^2.5.16'
},
devDependencies: {
'vue-template-compiler': '^2.5.13'
@@ -28,3 +28,4 @@ yarn-error.log*
*.ntvs*
*.njsproj
*.sln
*.sw*
+1 -1
View File
@@ -5,7 +5,7 @@ module.exports = (api, options) => {
.devtool('source-map')
.output
.filename(`js/[name].[chunkhash:8].js`)
.chunkFilename(`js/[id].[chunkhash:8].js`)
.chunkFilename(`js/[name].[id].[chunkhash:8].js`)
// keep module.id stable when vendor modules does not change
webpackConfig
+15 -15
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-service",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "local service for vue-cli projects",
"main": "lib/Service.js",
"bin": {
@@ -21,26 +21,26 @@
},
"homepage": "https://github.com/vuejs/vue-cli/packages/@vue/cli-service#readme",
"dependencies": {
"@vue/cli-overlay": "^3.0.0-beta.6",
"@vue/cli-shared-utils": "^3.0.0-beta.6",
"@vue/cli-overlay": "^3.0.0-beta.7",
"@vue/cli-shared-utils": "^3.0.0-beta.7",
"@vue/web-component-wrapper": "^1.2.0",
"acorn": "^5.5.3",
"address": "^1.0.3",
"autodll-webpack-plugin": "^0.3.9",
"autoprefixer": "^8.1.0",
"autoprefixer": "^8.3.0",
"cache-loader": "^1.2.2",
"case-sensitive-paths-webpack-plugin": "^2.1.2",
"chalk": "^2.3.2",
"cliui": "^4.0.0",
"copy-webpack-plugin": "^4.5.0",
"css-loader": "^0.28.10",
"chalk": "^2.4.0",
"cliui": "^4.1.0",
"copy-webpack-plugin": "^4.5.1",
"css-loader": "^0.28.11",
"escape-string-regexp": "^1.0.5",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.11",
"friendly-errors-webpack-plugin": "^1.6.1",
"get-value": "^3.0.0",
"get-value": "^3.0.1",
"globby": "^8.0.1",
"html-webpack-plugin": "^3.0.6",
"html-webpack-plugin": "^3.2.0",
"javascript-stringify": "^1.6.0",
"launch-editor-middleware": "^2.2.1",
"lodash.defaultsdeep": "^4.6.0",
@@ -54,22 +54,22 @@
"read-pkg": "^3.0.0",
"rimraf": "^2.6.2",
"semver": "^5.5.0",
"slash": "^1.0.0",
"slash": "^2.0.0",
"source-map-url": "^0.4.0",
"string.prototype.padend": "^3.0.0",
"thread-loader": "^1.1.5",
"uglifyjs-webpack-plugin": "^1.2.2",
"uglifyjs-webpack-plugin": "^1.2.5",
"url-loader": "^1.0.1",
"vue-loader": "^14.2.1",
"vue-template-compiler": "^2.5.17-beta.0",
"vue-template-compiler": "^2.5.16",
"webpack": "^3.10.0",
"webpack-chain": "^4.5.0",
"webpack-chain": "^4.6.0",
"webpack-dev-server": "^2.11.1",
"webpack-merge": "^4.1.2",
"yorkie": "^1.0.3"
},
"devDependencies": {
"vue": "^2.5.13",
"vue": "^2.5.16",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
},
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-shared-utils",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "shared utilities for vue-cli packages",
"main": "index.js",
"repository": {
+3 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/cli-test-utils",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "test utilities for vue-cli packages",
"repository": {
"type": "git",
@@ -22,6 +22,7 @@
},
"dependencies": {
"execa": "^0.8.0",
"puppeteer": "^1.0.0"
"puppeteer": "^1.0.0",
"strip-ansi": "^3.0.0"
}
}
@@ -1,3 +1,4 @@
const stripAnsi = require('strip-ansi')
const launchPuppeteer = require('./launchPuppeteer')
module.exports = async function serveWithPuppeteer (serve, test) {
@@ -36,8 +37,13 @@ module.exports = async function serveWithPuppeteer (serve, test) {
const urlMatch = data.match(/http:\/\/[^/]+\//)
if (urlMatch && isFirstMatch) {
isFirstMatch = false
let url = urlMatch[0]
// fix "Protocol error (Page.navigate): Cannot navigate to invalid URL undefined" error
// when running test in vscode terminal(zsh)
url = stripAnsi(url)
// start browser
const url = urlMatch[0]
const { page, browser } = await launchPuppeteer(url)
activeBrowser = browser
+15 -3
View File
@@ -49,7 +49,11 @@ test('api: extendPackage', async () => {
list: [1],
vue: {
foo: 1,
bar: 2
bar: 2,
pluginOptions: {
graphqlMock: true,
apolloEngine: false
}
}
},
plugins: [{
@@ -60,7 +64,10 @@ test('api: extendPackage', async () => {
list: [2],
vue: {
foo: 2,
baz: 3
baz: 3,
pluginOptions: {
enableInSFC: true
}
}
})
}
@@ -76,7 +83,12 @@ test('api: extendPackage', async () => {
vue: {
foo: 2,
bar: 2,
baz: 3
baz: 3,
pluginOptions: {
graphqlMock: true,
apolloEngine: false,
enableInSFC: true
}
}
})
})
@@ -128,3 +128,12 @@ extends:
- '@vue/airbnb'
`.trim())
})
test('invoking a plugin that renames files', async () => {
const project = await create(`invoke-rename`, { plugins: {}})
const pkg = JSON.parse(await project.read('package.json'))
pkg.devDependencies['@vue/cli-plugin-typescript'] = '*'
await project.write('package.json', JSON.stringify(pkg, null, 2))
await project.run(`${require.resolve('../bin/vue')} invoke typescript -d`)
expect(project.has('src/main.js')).toBe(false)
})
+4 -2
View File
@@ -51,6 +51,8 @@ module.exports = class Generator {
extractConfigFiles = false,
checkExisting = false
} = {}) {
// save the file system before applying plugin for comparison
const initialFiles = Object.assign({}, this.files)
// extract configs from package.json into dedicated files.
this.extractConfigFiles(extractConfigFiles, checkExisting)
// wait for file resolve
@@ -58,8 +60,8 @@ module.exports = class Generator {
// set package.json
this.sortPkg()
this.files['package.json'] = JSON.stringify(this.pkg, null, 2)
// write file tree to disk
await writeFileTree(this.context, this.files)
// write/update file tree to disk
await writeFileTree(this.context, this.files, initialFiles)
}
extractConfigFiles (extractAll, checkExisting) {
+2 -1
View File
@@ -2,6 +2,7 @@ const fs = require('fs')
const ejs = require('ejs')
const path = require('path')
const globby = require('globby')
const merge = require('deepmerge')
const resolve = require('resolve')
const isBinary = require('isbinaryfile')
const yaml = require('yaml-front-matter')
@@ -105,7 +106,7 @@ class GeneratorAPI {
} else if (Array.isArray(value) && Array.isArray(existing)) {
pkg[key] = existing.concat(value)
} else if (isObject(value) && isObject(existing)) {
pkg[key] = Object.assign({}, existing, value)
pkg[key] = merge(existing, value)
} else {
pkg[key] = value
}
+11 -1
View File
@@ -6,13 +6,23 @@ const inquirer = require('inquirer')
const Creator = require('./Creator')
const { clearConsole } = require('./util/clearConsole')
const { getPromptModules } = require('./util/createTools')
const { error, stopSpinner } = require('@vue/cli-shared-utils')
const { error, stopSpinner, exit } = require('@vue/cli-shared-utils')
const validateProjectName = require('validate-npm-package-name')
async function create (projectName, options) {
const inCurrent = projectName === '.'
const name = inCurrent ? path.relative('../', process.cwd()) : projectName
const targetDir = path.resolve(projectName || '.')
const result = validateProjectName(name)
if (!result.validForNewPackages) {
console.error(chalk.red(`Invalid project name: "${projectName}"`))
result.errors && result.errors.forEach(err => {
console.error(chalk.red(err))
})
exit(1)
}
if (fs.existsSync(targetDir)) {
if (options.force) {
rimraf.sync(targetDir)
+1 -1
View File
@@ -24,7 +24,7 @@ async function readFiles (context) {
cwd: context,
onlyFiles: true,
gitignore: true,
ignore: ['**node_modules**']
ignore: ['**/node_modules/**']
})
const res = {}
for (const file of files) {
+3 -3
View File
@@ -16,9 +16,9 @@ exports.generateTitle = async function (checkUpdate) {
}
if (checkUpdate && semver.gt(latest, current)) {
title += chalk.green(`
┌─────────────────────────${``.repeat(latest.length)}─┐
Update available: ${latest}
└─────────────────────────${``.repeat(latest.length)}─┘`)
┌────────────────────${``.repeat(latest.length)}
│ Update available: ${latest}
└────────────────────${``.repeat(latest.length)}`)
}
return title
+15 -1
View File
@@ -1,13 +1,27 @@
const fs = require('fs')
const path = require('path')
const { promisify } = require('util')
const unlink = promisify(fs.unlink)
const mkdirp = promisify(require('mkdirp'))
const write = promisify(fs.writeFile)
module.exports = function writeFileTree (dir, files) {
async function deleteRemovedFiles (directory, newFiles, previousFiles) {
// get all files that are not in the new filesystem and are still existing
const filesToDelete = Object.keys(previousFiles)
.filter(filename => !newFiles[filename])
// delete each of these files
const unlinkPromises = filesToDelete.map(filename => unlink(path.join(directory, filename)))
return Promise.all(unlinkPromises)
}
module.exports = async function writeFileTree (dir, files, previousFiles) {
if (process.env.VUE_CLI_SKIP_WRITE) {
return
}
if (previousFiles) {
await deleteRemovedFiles(dir, files, previousFiles)
}
return Promise.all(Object.keys(files).map(async (name) => {
const filePath = path.join(dir, name)
await mkdirp(path.dirname(filePath))
+3 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@vue/cli",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "Command line interface for rapid Vue.js development",
"bin": {
"vue": "bin/vue.js"
@@ -27,7 +27,7 @@
"access": "public"
},
"dependencies": {
"@vue/cli-shared-utils": "^3.0.0-beta.6",
"@vue/cli-shared-utils": "^3.0.0-beta.7",
"chalk": "^2.3.0",
"commander": "^2.12.2",
"debug": "^3.1.0",
@@ -48,6 +48,7 @@
"rimraf": "^2.6.2",
"semver": "^5.4.1",
"slash": "^1.0.0",
"validate-npm-package-name": "^3.0.0",
"yaml-front-matter": "^3.4.1"
},
"engines": {
@@ -1,6 +1,6 @@
{
"name": "@vue/eslint-config-airbnb",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "eslint-config-airbnb for vue-cli",
"main": "index.js",
"publishConfig": {
@@ -23,6 +23,6 @@
"dependencies": {
"eslint-config-airbnb-base": "^12.1.0",
"eslint-import-resolver-webpack": "^0.8.4",
"eslint-plugin-import": "^2.9.0"
"eslint-plugin-import": "^2.11.0"
}
}
@@ -1,6 +1,6 @@
{
"name": "@vue/eslint-config-prettier",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "eslint-config-prettier for vue-cli",
"main": "index.js",
"publishConfig": {
@@ -23,6 +23,6 @@
"dependencies": {
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-prettier": "^2.6.0",
"prettier": "^1.11.1"
"prettier": "^1.12.1"
}
}
@@ -1,6 +1,6 @@
{
"name": "@vue/eslint-config-standard",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "eslint-config-standard for vue-cli",
"main": "index.js",
"publishConfig": {
@@ -24,7 +24,7 @@
"eslint-config-standard": "^11.0.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-standard": "^3.0.1"
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-standard": "^3.1.0"
}
}
@@ -1,6 +1,6 @@
{
"name": "@vue/eslint-config-typescript",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "eslint-config-typescript for vue-cli",
"main": "index.js",
"publishConfig": {
@@ -21,7 +21,7 @@
},
"homepage": "https://github.com/vuejs/vue-cli/packages/@vue/eslint-config-typescript#readme",
"dependencies": {
"eslint-plugin-typescript": "^0.9.0",
"typescript-eslint-parser": "^14.0.0"
"eslint-plugin-typescript": "^0.11.0",
"typescript-eslint-parser": "^15.0.0"
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "vue-cli-version-marker",
"version": "3.0.0-beta.6",
"version": "3.0.0-beta.7",
"description": "version marker for @vue/cli",
"author": "Evan You",
"license": "MIT"
+1496 -1264
View File
File diff suppressed because it is too large Load Diff