Skip to content

Commit c4584e9

Browse files
committed
Updating the whole project to newer frontend-libraries & Switching from Karma to Jest:
"karma": "^1.4.1", --> "jest": "^22.0.4", (+ "vue-jest") Big Webpack & Node update: "webpack": "^2.6.1", --> "webpack": "^3.6.0", "node": ">= 4.0.0", --> "node": ">= 6.0.0", Also updated (among others): "vue-router": "^2.7.0" --> "vue-router": "^3.0.1" "axios": "^0.16.2", "bootstrap": "^4.1.0", "bootstrap-vue": "^1.5.1", "jquery": "^3.3.1", "babel-eslint": "^7.1.1", --> "babel-eslint": "^8.2.1", "file-loader": "^0.11.1", --> "file-loader": "^1.1.4",
1 parent 653be1d commit c4584e9

23 files changed

+8113
-6722
lines changed

frontend/.babelrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
}],
99
"stage-2"
1010
],
11-
"plugins": ["transform-runtime"],
11+
"plugins": ["transform-vue-jsx", "transform-runtime"],
1212
"env": {
1313
"test": {
1414
"presets": ["env", "stage-2"],
15-
"plugins": ["istanbul"]
15+
"plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs", "dynamic-import-node"]
1616
}
1717
}
1818
}

frontend/.eslintignore

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
build/*.js
2-
config/*.js
1+
/build/
2+
/config/
3+
/dist/
4+
/*.js
5+
/test/unit/coverage/

frontend/.eslintrc.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
// http://eslint.org/docs/user-guide/configuring
1+
// https://eslint.org/docs/user-guide/configuring
22

33
module.exports = {
44
root: true,
5-
parser: 'babel-eslint',
65
parserOptions: {
7-
sourceType: 'module'
6+
parser: 'babel-eslint'
87
},
98
env: {
109
browser: true,
1110
},
12-
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
13-
extends: 'standard',
11+
extends: [
12+
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
13+
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
14+
'plugin:vue/essential',
15+
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
16+
'standard'
17+
],
1418
// required to lint *.vue files
1519
plugins: [
16-
'html'
20+
'vue'
1721
],
1822
// add your custom rules here
19-
'rules': {
20-
// allow paren-less arrow functions
21-
'arrow-parens': 0,
23+
rules: {
2224
// allow async-await
23-
'generator-star-spacing': 0,
25+
'generator-star-spacing': 'off',
2426
// allow debugger during development
25-
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
27+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
2628
}
2729
}

frontend/.gitignore

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
.DS_Store
22
node_modules/
3-
dist/
3+
/dist/
44
npm-debug.log*
55
yarn-debug.log*
66
yarn-error.log*
7-
test/unit/coverage
8-
test/e2e/reports
7+
/test/unit/coverage/
8+
/test/e2e/reports/
99
selenium-debug.log
1010

1111
# Editor directories and files
1212
.idea
13+
.vscode
1314
*.suo
1415
*.ntvs*
1516
*.njsproj

frontend/.postcssrc.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// https://github.com/michael-ciniawsky/postcss-load-config
2+
3+
module.exports = {
4+
"plugins": {
5+
"postcss-import": {},
6+
"postcss-url": {},
7+
// to edit target browsers: use "browserslist" field in package.json
8+
"autoprefixer": {}
9+
}
10+
}

frontend/build/build.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1+
'use strict'
12
require('./check-versions')()
23

34
process.env.NODE_ENV = 'production'
45

5-
var ora = require('ora')
6-
var rm = require('rimraf')
7-
var path = require('path')
8-
var chalk = require('chalk')
9-
var webpack = require('webpack')
10-
var config = require('../config')
11-
var webpackConfig = require('./webpack.prod.conf')
6+
const ora = require('ora')
7+
const rm = require('rimraf')
8+
const path = require('path')
9+
const chalk = require('chalk')
10+
const webpack = require('webpack')
11+
const config = require('../config')
12+
const webpackConfig = require('./webpack.prod.conf')
1213

13-
var spinner = ora('building for production...')
14+
const spinner = ora('building for production...')
1415
spinner.start()
1516

1617
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
1718
if (err) throw err
18-
webpack(webpackConfig, function (err, stats) {
19+
webpack(webpackConfig, (err, stats) => {
1920
spinner.stop()
2021
if (err) throw err
2122
process.stdout.write(stats.toString({
2223
colors: true,
2324
modules: false,
24-
children: false,
25+
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
2526
chunks: false,
2627
chunkModules: false
2728
}) + '\n\n')

frontend/build/check-versions.js

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
var chalk = require('chalk')
2-
var semver = require('semver')
3-
var packageConfig = require('../package.json')
4-
var shell = require('shelljs')
1+
'use strict'
2+
const chalk = require('chalk')
3+
const semver = require('semver')
4+
const packageConfig = require('../package.json')
5+
const shell = require('shelljs')
6+
57
function exec (cmd) {
68
return require('child_process').execSync(cmd).toString().trim()
79
}
810

9-
var versionRequirements = [
11+
const versionRequirements = [
1012
{
1113
name: 'node',
1214
currentVersion: semver.clean(process.version),
@@ -23,9 +25,11 @@ if (shell.which('npm')) {
2325
}
2426

2527
module.exports = function () {
26-
var warnings = []
27-
for (var i = 0; i < versionRequirements.length; i++) {
28-
var mod = versionRequirements[i]
28+
const warnings = []
29+
30+
for (let i = 0; i < versionRequirements.length; i++) {
31+
const mod = versionRequirements[i]
32+
2933
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
3034
warnings.push(mod.name + ': ' +
3135
chalk.red(mod.currentVersion) + ' should be ' +
@@ -38,10 +42,12 @@ module.exports = function () {
3842
console.log('')
3943
console.log(chalk.yellow('To use this template, you must update following to modules:'))
4044
console.log()
41-
for (var i = 0; i < warnings.length; i++) {
42-
var warning = warnings[i]
45+
46+
for (let i = 0; i < warnings.length; i++) {
47+
const warning = warnings[i]
4348
console.log(' ' + warning)
4449
}
50+
4551
console.log()
4652
process.exit(1)
4753
}

frontend/build/dev-client.js

-9
This file was deleted.

frontend/build/dev-server.js

-92
This file was deleted.

frontend/build/utils.js

+41-11
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,38 @@
1-
var path = require('path')
2-
var config = require('../config')
3-
var ExtractTextPlugin = require('extract-text-webpack-plugin')
1+
'use strict'
2+
const path = require('path')
3+
const config = require('../config')
4+
const ExtractTextPlugin = require('extract-text-webpack-plugin')
5+
const packageConfig = require('../package.json')
46

57
exports.assetsPath = function (_path) {
6-
var assetsSubDirectory = process.env.NODE_ENV === 'production'
8+
const assetsSubDirectory = process.env.NODE_ENV === 'production'
79
? config.build.assetsSubDirectory
810
: config.dev.assetsSubDirectory
11+
912
return path.posix.join(assetsSubDirectory, _path)
1013
}
1114

1215
exports.cssLoaders = function (options) {
1316
options = options || {}
1417

15-
var cssLoader = {
18+
const cssLoader = {
1619
loader: 'css-loader',
1720
options: {
18-
minimize: process.env.NODE_ENV === 'production',
21+
sourceMap: options.sourceMap
22+
}
23+
}
24+
25+
const postcssLoader = {
26+
loader: 'postcss-loader',
27+
options: {
1928
sourceMap: options.sourceMap
2029
}
2130
}
2231

2332
// generate loader string to be used with extract text plugin
2433
function generateLoaders (loader, loaderOptions) {
25-
var loaders = [cssLoader]
34+
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
35+
2636
if (loader) {
2737
loaders.push({
2838
loader: loader + '-loader',
@@ -58,14 +68,34 @@ exports.cssLoaders = function (options) {
5868

5969
// Generate loaders for standalone style files (outside of .vue)
6070
exports.styleLoaders = function (options) {
61-
var output = []
62-
var loaders = exports.cssLoaders(options)
63-
for (var extension in loaders) {
64-
var loader = loaders[extension]
71+
const output = []
72+
const loaders = exports.cssLoaders(options)
73+
74+
for (const extension in loaders) {
75+
const loader = loaders[extension]
6576
output.push({
6677
test: new RegExp('\\.' + extension + '$'),
6778
use: loader
6879
})
6980
}
81+
7082
return output
7183
}
84+
85+
exports.createNotifierCallback = () => {
86+
const notifier = require('node-notifier')
87+
88+
return (severity, errors) => {
89+
if (severity !== 'error') return
90+
91+
const error = errors[0]
92+
const filename = error.file && error.file.split('!').pop()
93+
94+
notifier.notify({
95+
title: packageConfig.name,
96+
message: severity + ': ' + error.name,
97+
subtitle: filename || '',
98+
icon: path.join(__dirname, 'logo.png')
99+
})
100+
}
101+
}

frontend/build/vue-loader.conf.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
var utils = require('./utils')
2-
var config = require('../config')
3-
var isProduction = process.env.NODE_ENV === 'production'
1+
'use strict'
2+
const utils = require('./utils')
3+
const config = require('../config')
4+
const isProduction = process.env.NODE_ENV === 'production'
5+
const sourceMapEnabled = isProduction
6+
? config.build.productionSourceMap
7+
: config.dev.cssSourceMap
48

59
module.exports = {
610
loaders: utils.cssLoaders({
7-
sourceMap: isProduction
8-
? config.build.productionSourceMap
9-
: config.dev.cssSourceMap,
11+
sourceMap: sourceMapEnabled,
1012
extract: isProduction
1113
}),
14+
cssSourceMap: sourceMapEnabled,
15+
cacheBusting: config.dev.cacheBusting,
1216
transformToRequire: {
13-
video: 'src',
17+
video: ['src', 'poster'],
1418
source: 'src',
1519
img: 'src',
1620
image: 'xlink:href'

0 commit comments

Comments
 (0)