Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  bump v1.2.4
  revert #996 chunk names to minify prodution JS (#1086)
  fix missing comma
  Batman!
  add missing cacheBusting option
  make jest ignore the e2e test folder because its likely to contain files matching the jest's filename pattern
  Improved Jest config (#1074)
  Fix # 1070 When index.html has a positional variable, the error can be printed correctly (#1071)
  [enhancement]Remove useless files and performance enhancement in dev server. (#1072)
  • Loading branch information
LinusBorg committed Nov 21, 2017
2 parents 5b138f3 + 7ba65e8 commit 3c15450
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 42 deletions.
2 changes: 2 additions & 0 deletions meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ module.exports = {
".eslintrc.js": "lint",
".eslintignore": "lint",
"config/test.env.js": "unit || e2e",
"build/webpack.test.conf.js": "e2e || (unit && runner === 'karma')",
"test/unit/**/*": "unit",
"test/unit/index.js": "unit && runner === 'karma'",
"test/unit/jest.conf.js": "unit && runner === 'jest'",
"test/unit/karma.conf.js": "unit && runner === 'karma'",
"test/unit/specs/index.js": "unit && runner === 'karma'",
"test/unit/setup.js": "unit && runner === 'jest'",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-cli-template-webpack",
"version": "1.2.3",
"version": "1.2.4",
"license": "MIT",
"description": "A full-featured Webpack setup with hot-reload, lint-on-save, unit testing & css extraction.",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions template/.babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
}],
"stage-2"
],
"plugins": ["transform-runtime"],
"plugins": ["transform-runtime"]{{#if_or unit e2e}},
"env": {
"test": {
"presets": ["env", "stage-2"]{{#if_eq runner "karma"}},
"plugins": ["istanbul"]
{{/if_eq}}
"plugins": ["istanbul"]{{/if_eq}}{{#if_eq runner "jest"}},
"plugins": ["transform-es2015-modules-commonjs", "dynamic-import-node"]{{/if_eq}}
}
}
}{{/if_or}}
}
2 changes: 1 addition & 1 deletion template/build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ exports.createNotifierCallback = function () {
}
const error = errors[0]

const filename = error.file.split('!').pop()
const filename = error.file && error.file.split('!').pop()
notifier.notify({
title: pkg.name,
message: severity + ': ' + error.name,
Expand Down
1 change: 1 addition & 0 deletions template/build/vue-loader.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
extract: isProduction
}),
cssSourceMap: sourceMapEnabled,
cacheBusting: config.dev.cacheBusting,
transformToRequire: {
video: 'src',
source: 'src',
Expand Down
5 changes: 3 additions & 2 deletions template/build/webpack.dev.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ const devWebpackConfig = merge(baseWebpackConfig, {
},
// cheap-module-eval-source-map is faster for development
devtool: config.dev.devtool,

// these devServer options should be customized in /config/index.js
devServer: {
clientLogLevel: 'warning',
historyApiFallback: true,
hot: true,
compress: true,
host: process.env.HOST || config.dev.host,
port: process.env.PORT || config.dev.port,
open: config.dev.autoOpenBrowser,
Expand All @@ -37,7 +38,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
plugins: [
new webpack.DefinePlugin({
'process.env': require('../config/dev.env')
}),
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(),
Expand Down
2 changes: 1 addition & 1 deletion template/build/webpack.prod.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const webpackConfig = merge(baseWebpackConfig, {
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[name].[chunkhash].js')
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
},
plugins: [
// http://vuejs.github.io/vue-loader/en/workflow/production.html
Expand Down
10 changes: 5 additions & 5 deletions template/config/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
// Template version: 1.2.3
// Template version: 1.2.4
// see http://vuejs-templates.github.io/webpack for documentation.

const path = require('path')
Expand All @@ -14,7 +14,7 @@ module.exports = {

// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.HOST, if port is in use, a free one will be determined
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
Expand Down Expand Up @@ -47,7 +47,7 @@ module.exports = {
// just be aware of this issue when enabling this option.
cssSourceMap: false,
},

build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
Expand All @@ -64,14 +64,14 @@ module.exports = {
productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',

// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],

// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
Expand Down
32 changes: 4 additions & 28 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
{{#if_eq runner "jest"}}
"unit": "jest test/unit/specs --coverage",
"unit": "jest --config test/unit/jest.conf.js --coverage",
{{/if_eq}}
{{#if_eq runner "karma"}}
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
Expand Down Expand Up @@ -67,7 +67,10 @@
"webpack-bundle-analyzer": "^2.9.0",
{{#if_eq runner "jest"}}
"babel-jest": "^21.0.2",
"babel-plugin-dynamic-import-node": "^1.2.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"jest": "^21.2.0",
"jest-serializer-vue": "^0.3.0",
"vue-jest": "^1.0.2",
{{/if_eq}}
{{#if_eq runner "karma"}}
Expand Down Expand Up @@ -112,33 +115,6 @@
"webpack-dev-server": "^2.9.1",
"webpack-merge": "^4.1.0"
},
{{#if_eq runner "jest"}}
"jest": {
"moduleFileExtensions": [
"js",
"json",
"vue"
],
"moduleNameMapper": {
"^@/(.*)$": "<rootDir>/src/$1"
},
"transform": {
"^.+\\.js$": "<rootDir>/node_modules/babel-jest",
".*\\.(vue)$": "<rootDir>/node_modules/vue-jest"
},
"setupFiles": ["<rootDir>/test/unit/setup"],
"mapCoverage": true,
"coverageDirectory": "<rootDir>/test/unit/coverage",
"collectCoverageFrom" : [
"src/**/*.{js,vue}",
"!src/main.js",
{{#router}}
"!src/router/index.js",
{{/router}}
"!**/node_modules/**"
]
},
{{/if_eq}}
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
Expand Down
32 changes: 32 additions & 0 deletions template/test/unit/jest.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const path = require('path')

module.exports = {
rootDir: path.resolve(__dirname, '../../'),
moduleFileExtensions: [
'js',
'json',
'vue'
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
transform: {
'^.+\\.js$': '<rootDir>/node_modules/babel-jest',
'.*\\.(vue)$': '<rootDir>/node_modules/vue-jest'
},{{#e2e}}
testPathIgnorePatterns: [
'<rootDir>/test/e2e'
],{{/e2e}}
snapshotSerializers: ['<rootDir>/node_modules/jest-serializer-vue'],
setupFiles: ['<rootDir>/test/unit/setup'],
mapCoverage: true,
coverageDirectory: '<rootDir>/test/unit/coverage',
collectCoverageFrom: [
'src/**/*.{js,vue}',
'!src/main.js',
{{#router}}
'!src/router/index.js',
{{/router}}
'!**/node_modules/**'
]
}

0 comments on commit 3c15450

Please sign in to comment.