Skip to content

Commit ae2aa61

Browse files
authored
bump: update to vue-cli@4 (PanJiaChen#3028)
1 parent f6d8204 commit ae2aa61

File tree

7 files changed

+89
-91
lines changed

7 files changed

+89
-91
lines changed

.env.development

-9
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,3 @@ ENV = 'development'
33

44
# base api
55
VUE_APP_BASE_API = '/dev-api'
6-
7-
# vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable,
8-
# to control whether the babel-plugin-dynamic-import-node plugin is enabled.
9-
# It only does one thing by converting all import() to require().
10-
# This configuration can significantly increase the speed of hot updates,
11-
# when you have a large number of pages.
12-
# Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js
13-
14-
VUE_CLI_BABEL_TRANSPILE_MODULES = true

babel.config.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
module.exports = {
22
presets: [
3-
'@vue/app'
4-
]
3+
// https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app
4+
'@vue/cli-plugin-babel/preset'
5+
],
6+
'env': {
7+
'development': {
8+
// babel-plugin-dynamic-import-node plugin only does one thing by converting all import() to require().
9+
// This plugin can significantly increase the speed of hot updates, when you have a large number of pages.
10+
// https://panjiachen.github.io/vue-element-admin-site/guide/advanced/lazy-loading.html
11+
'plugins': ['dynamic-import-node']
12+
}
13+
}
514
}

package.json

+50-49
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,22 @@
33
"version": "4.3.1",
44
"description": "A magical vue admin. An out-of-box UI solution for enterprise applications. Newest development stack of vue. Lots of awesome features",
55
"author": "Pan <[email protected]>",
6-
"license": "MIT",
76
"scripts": {
87
"dev": "vue-cli-service serve",
8+
"lint": "eslint --ext .js,.vue src",
99
"build:prod": "vue-cli-service build",
1010
"build:stage": "vue-cli-service build --mode staging",
1111
"preview": "node build/index.js --preview",
12-
"lint": "eslint --ext .js,.vue src",
13-
"test:unit": "jest --clearCache && vue-cli-service test:unit",
14-
"test:ci": "npm run lint && npm run test:unit",
12+
"new": "plop",
1513
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
16-
"new": "plop"
17-
},
18-
"husky": {
19-
"hooks": {
20-
"pre-commit": "lint-staged"
21-
}
22-
},
23-
"lint-staged": {
24-
"src/**/*.{js,vue}": [
25-
"eslint --fix",
26-
"git add"
27-
]
28-
},
29-
"keywords": [
30-
"vue",
31-
"admin",
32-
"dashboard",
33-
"element-ui",
34-
"boilerplate",
35-
"admin-template",
36-
"management-system"
37-
],
38-
"repository": {
39-
"type": "git",
40-
"url": "git+https://github.com/PanJiaChen/vue-element-admin.git"
41-
},
42-
"bugs": {
43-
"url": "https://github.com/PanJiaChen/vue-element-admin/issues"
14+
"test:unit": "jest --clearCache && vue-cli-service test:unit",
15+
"test:ci": "npm run lint && npm run test:unit"
4416
},
4517
"dependencies": {
4618
"axios": "0.18.1",
4719
"clipboard": "2.0.4",
4820
"codemirror": "5.45.0",
21+
"core-js": "3.6.5",
4922
"driver.js": "0.9.5",
5023
"dropzone": "5.5.1",
5124
"echarts": "4.2.1",
@@ -71,40 +44,68 @@
7144
"xlsx": "0.14.1"
7245
},
7346
"devDependencies": {
74-
"@vue/cli-plugin-babel": "3.5.3",
75-
"@vue/cli-plugin-eslint": "^3.9.1",
76-
"@vue/cli-plugin-unit-jest": "3.5.3",
77-
"@vue/cli-service": "3.5.3",
47+
"@vue/cli-plugin-babel": "4.4.4",
48+
"@vue/cli-plugin-eslint": "4.4.4",
49+
"@vue/cli-plugin-unit-jest": "4.4.4",
50+
"@vue/cli-service": "4.4.4",
7851
"@vue/test-utils": "1.0.0-beta.29",
79-
"autoprefixer": "^9.5.1",
80-
"babel-core": "7.0.0-bridge.0",
81-
"babel-eslint": "10.0.1",
52+
"autoprefixer": "9.5.1",
53+
"babel-eslint": "10.1.0",
8254
"babel-jest": "23.6.0",
55+
"babel-plugin-dynamic-import-node": "2.3.3",
8356
"chalk": "2.4.2",
8457
"chokidar": "2.1.5",
8558
"connect": "3.6.6",
86-
"eslint": "5.15.3",
87-
"eslint-plugin-vue": "5.2.2",
59+
"eslint": "6.7.2",
60+
"eslint-plugin-vue": "6.2.2",
8861
"html-webpack-plugin": "3.2.0",
8962
"husky": "1.3.1",
9063
"lint-staged": "8.1.5",
9164
"mockjs": "1.0.1-beta3",
9265
"plop": "2.3.0",
93-
"runjs": "^4.3.2",
94-
"sass": "^1.26.2",
95-
"sass-loader": "^7.1.0",
66+
"runjs": "4.3.2",
67+
"sass": "1.26.2",
68+
"sass-loader": "8.0.2",
9669
"script-ext-html-webpack-plugin": "2.1.3",
97-
"serve-static": "^1.13.2",
70+
"serve-static": "1.13.2",
9871
"svg-sprite-loader": "4.1.3",
9972
"svgo": "1.2.0",
10073
"vue-template-compiler": "2.6.10"
10174
},
75+
"browserslist": [
76+
"> 1%",
77+
"last 2 versions"
78+
],
79+
"bugs": {
80+
"url": "https://github.com/PanJiaChen/vue-element-admin/issues"
81+
},
10282
"engines": {
10383
"node": ">=8.9",
10484
"npm": ">= 3.0.0"
10585
},
106-
"browserslist": [
107-
"> 1%",
108-
"last 2 versions"
109-
]
86+
"keywords": [
87+
"vue",
88+
"admin",
89+
"dashboard",
90+
"element-ui",
91+
"boilerplate",
92+
"admin-template",
93+
"management-system"
94+
],
95+
"license": "MIT",
96+
"lint-staged": {
97+
"src/**/*.{js,vue}": [
98+
"eslint --fix",
99+
"git add"
100+
]
101+
},
102+
"husky": {
103+
"hooks": {
104+
"pre-commit": "lint-staged"
105+
}
106+
},
107+
"repository": {
108+
"type": "git",
109+
"url": "git+https://github.com/PanJiaChen/vue-element-admin.git"
110+
}
110111
}

src/components/ImageCropper/index.vue

+1
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ export default {
248248
// 浏览器是否支持该控件
249249
isSupported,
250250
// 浏览器是否支持触屏事件
251+
// eslint-disable-next-line no-prototype-builtins
251252
isSupportTouch: document.hasOwnProperty('ontouchstart'),
252253
// 步骤
253254
step: 1, // 1选择文件 2剪裁 3上传

src/store/modules/settings.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const state = {
1313

1414
const mutations = {
1515
CHANGE_SETTING: (state, { key, value }) => {
16+
// eslint-disable-next-line no-prototype-builtins
1617
if (state.hasOwnProperty(key)) {
1718
state[key] = value
1819
}

src/store/modules/user.js

+12-17
Original file line numberDiff line numberDiff line change
@@ -103,28 +103,23 @@ const actions = {
103103
},
104104

105105
// dynamically modify permissions
106-
changeRoles({ commit, dispatch }, role) {
107-
return new Promise(async resolve => {
108-
const token = role + '-token'
106+
async changeRoles({ commit, dispatch }, role) {
107+
const token = role + '-token'
109108

110-
commit('SET_TOKEN', token)
111-
setToken(token)
109+
commit('SET_TOKEN', token)
110+
setToken(token)
112111

113-
const { roles } = await dispatch('getInfo')
112+
const { roles } = await dispatch('getInfo')
114113

115-
resetRouter()
114+
resetRouter()
116115

117-
// generate accessible routes map based on roles
118-
const accessRoutes = await dispatch('permission/generateRoutes', roles, { root: true })
116+
// generate accessible routes map based on roles
117+
const accessRoutes = await dispatch('permission/generateRoutes', roles, { root: true })
118+
// dynamically add accessible routes
119+
router.addRoutes(accessRoutes)
119120

120-
// dynamically add accessible routes
121-
router.addRoutes(accessRoutes)
122-
123-
// reset visited views and cached views
124-
dispatch('tagsView/delAllViews', null, { root: true })
125-
126-
resolve()
127-
})
121+
// reset visited views and cached views
122+
dispatch('tagsView/delAllViews', null, { root: true })
128123
}
129124
}
130125

src/views/excel/merge-header.vue

+14-14
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,21 @@ export default {
7171
},
7272
handleDownload() {
7373
this.downloadLoading = true
74-
import('@/vendor/Export2Excel').then(excel => {
75-
const multiHeader = [['Id', 'Main Information', '', '', 'Date']]
76-
const header = ['', 'Title', 'Author', 'Readings', '']
77-
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
78-
const list = this.list
79-
const data = this.formatJson(filterVal, list)
80-
const merges = ['A1:A2', 'B1:D1', 'E1:E2']
81-
excel.export_json_to_excel({
82-
multiHeader,
83-
header,
84-
merges,
85-
data
86-
})
87-
this.downloadLoading = false
74+
import('@/vendor/Export2Excel').then(excel => {
75+
const multiHeader = [['Id', 'Main Information', '', '', 'Date']]
76+
const header = ['', 'Title', 'Author', 'Readings', '']
77+
const filterVal = ['id', 'title', 'author', 'pageviews', 'display_time']
78+
const list = this.list
79+
const data = this.formatJson(filterVal, list)
80+
const merges = ['A1:A2', 'B1:D1', 'E1:E2']
81+
excel.export_json_to_excel({
82+
multiHeader,
83+
header,
84+
merges,
85+
data
8886
})
87+
this.downloadLoading = false
88+
})
8989
},
9090
formatJson(filterVal, jsonData) {
9191
return jsonData.map(v => filterVal.map(j => {

0 commit comments

Comments
 (0)