yks-element 1.1.4 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bin/pack.js +155 -114
- package/lib/yks.js +1 -1
- package/package.json +1 -1
package/lib/bin/pack.js
CHANGED
|
@@ -10,117 +10,158 @@
|
|
|
10
10
|
* @function setPackParams 设置打包参数
|
|
11
11
|
* @function proxy 代理
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
13
|
+
const NPM_APP_CDN_URL = 'https://pub-static.yks365.net/assets'
|
|
14
|
+
const NPM_APP_DEV_URL = 'https://gldev.cetset.com'
|
|
15
|
+
const NPM_APP_TEST_URL = 'https://gltest.cetset.com'
|
|
16
|
+
const NPM_APP_PRE_URL = 'https://glpre.yks365.net'
|
|
17
|
+
const NPM_APP_PROD_URL = 'https://gl.yks365.net'
|
|
18
|
+
|
|
19
|
+
const getConfig = () => {
|
|
20
|
+
let cdnConfigs = [
|
|
21
|
+
{
|
|
22
|
+
name: 'vue',
|
|
23
|
+
library: 'Vue',
|
|
24
|
+
js: `${NPM_APP_CDN_URL}/cdn/vue.min@2.6.11.js`,
|
|
25
|
+
dev: `${NPM_APP_CDN_URL}/cdn/vue@2.6.11.js`,
|
|
26
|
+
css: ''
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'vuex',
|
|
30
|
+
library: 'Vuex',
|
|
31
|
+
js: `${NPM_APP_CDN_URL}/cdn/vuex.min@3.3.0.js`,
|
|
32
|
+
css: ''
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'vue-router',
|
|
36
|
+
library: 'VueRouter',
|
|
37
|
+
js: `${NPM_APP_CDN_URL}/cdn/vue-router@3.5.3.js`,
|
|
38
|
+
css: ''
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'axios',
|
|
42
|
+
library: 'axios',
|
|
43
|
+
js: `${NPM_APP_CDN_URL}/cdn/axios.min@0.19.2.js`,
|
|
44
|
+
css: ''
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'yks-element',
|
|
48
|
+
library: 'YKSEMENT',
|
|
49
|
+
js: `${NPM_APP_CDN_URL}/yks-element/latest/yks.js`,
|
|
50
|
+
css: `${NPM_APP_CDN_URL}/yks-element/latest/theme-chalk/index.css`
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'lodash',
|
|
54
|
+
library: 'lodash',
|
|
55
|
+
js: `${NPM_APP_CDN_URL}/cdn/lodash.min@4.17.15.js`,
|
|
56
|
+
css: ''
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'echarts',
|
|
60
|
+
library: 'echarts',
|
|
61
|
+
js: `${NPM_APP_CDN_URL}/cdn/echarts.min@4.7.0.js`,
|
|
62
|
+
css: ''
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
return cdnConfigs
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const externals = () => {
|
|
69
|
+
let externals = {}
|
|
70
|
+
let cdnConfig = getConfig()
|
|
71
|
+
cdnConfig.forEach((pkg) => {
|
|
72
|
+
externals[pkg.name] = pkg.library === 'Vue' ? `${pkg.library}` : pkg.library
|
|
73
|
+
})
|
|
74
|
+
return externals
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const cdn = (env) => {
|
|
78
|
+
const cdnConfig = getConfig()
|
|
79
|
+
const js = []
|
|
80
|
+
const css = []
|
|
81
|
+
cdnConfig.forEach((v) => {
|
|
82
|
+
const value = env === 'development' && v.name === 'vue' ? v.dev : v.js
|
|
83
|
+
js.push(value)
|
|
84
|
+
if (v.css && v.css !== '') css.push(v.css)
|
|
85
|
+
})
|
|
86
|
+
return {
|
|
87
|
+
css,
|
|
88
|
+
js
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const setPackParams = (config, env) => {
|
|
93
|
+
config.plugin('html').tap((args) => {
|
|
94
|
+
let cdns = cdn(env)
|
|
95
|
+
args[0].cdn = cdns
|
|
96
|
+
return args
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const proxy = (pro, env, targets) => {
|
|
101
|
+
if (!pro || !env) {
|
|
102
|
+
return new Error('pro or env is not difine !')
|
|
103
|
+
}
|
|
104
|
+
const params = {
|
|
105
|
+
dev: NPM_APP_DEV_URL,
|
|
106
|
+
test: NPM_APP_TEST_URL,
|
|
107
|
+
pre: NPM_APP_PRE_URL,
|
|
108
|
+
prod: NPM_APP_PROD_URL
|
|
109
|
+
}
|
|
110
|
+
const target = params[env] ? params[env] : targets
|
|
111
|
+
return {
|
|
112
|
+
['/' + pro + '/bm']: {
|
|
113
|
+
target: target,
|
|
114
|
+
pathRewrite: { ['^/' + pro + '/bm']: `/${pro}/bm` }
|
|
115
|
+
},
|
|
116
|
+
['/' + pro + '/pj']: {
|
|
117
|
+
target: target,
|
|
118
|
+
pathRewrite: { ['^/' + pro + '/pj']: `/${pro}/pj` }
|
|
119
|
+
},
|
|
120
|
+
['/' + pro + '/ua']: {
|
|
121
|
+
target: target,
|
|
122
|
+
pathRewrite: { ['^/' + pro + '/ua']: `/${pro}/ua` }
|
|
123
|
+
},
|
|
124
|
+
['/' + pro + '/gov']: {
|
|
125
|
+
target: target,
|
|
126
|
+
pathRewrite: { ['^/' + pro + '/gov']: `/${pro}/gov` }
|
|
127
|
+
},
|
|
128
|
+
['/' + pro + '/kw']: {
|
|
129
|
+
target: target,
|
|
130
|
+
pathRewrite: { ['^/' + pro + '/kw']: `/${pro}/kw` }
|
|
131
|
+
},
|
|
132
|
+
['/' + pro + '/pt']: {
|
|
133
|
+
target: target,
|
|
134
|
+
pathRewrite: { ['^/' + pro + '/pt']: `/${pro}/pt` }
|
|
135
|
+
},
|
|
136
|
+
['/' + pro + '/cj']: {
|
|
137
|
+
target: target,
|
|
138
|
+
pathRewrite: { ['^/' + pro + '/cj']: `/${pro}/cj` }
|
|
139
|
+
},
|
|
140
|
+
['/' + pro + '/api']: {
|
|
141
|
+
target: target,
|
|
142
|
+
pathRewrite: { ['^/' + pro + '/api']: `/${pro}/api` }
|
|
143
|
+
},
|
|
144
|
+
['/' + pro + '/login']: {
|
|
145
|
+
target: target,
|
|
146
|
+
pathRewrite: { ['^/' + pro + '/login']: `/${pro}/login` }
|
|
147
|
+
},
|
|
148
|
+
['/' + pro + '/tps']: {
|
|
149
|
+
target: target,
|
|
150
|
+
pathRewrite: { ['^/' + pro + '/tps']: `/${pro}/tps` }
|
|
151
|
+
},
|
|
152
|
+
['/' + pro + '/tk']: {
|
|
153
|
+
target: target,
|
|
154
|
+
pathRewrite: { ['^/' + pro + '/tk']: `/${pro}/tk` }
|
|
155
|
+
},
|
|
156
|
+
['/' + pro + '/ks']: {
|
|
157
|
+
target: target,
|
|
158
|
+
pathRewrite: { ['^/' + pro + '/ks']: `/${pro}/ks` }
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
module.exports = {
|
|
164
|
+
proxy,
|
|
165
|
+
externals,
|
|
166
|
+
setPackParams
|
|
167
|
+
}
|