yks-element 1.0.799 → 1.1.0
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/README.md +12 -0
- package/lib/bin/pack.js +125 -0
- package/lib/yks.js +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
package/lib/bin/pack.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 打包配置参数
|
|
3
|
+
* @String NPM_APP_CDN_URL 静态资源地址
|
|
4
|
+
* @String NPM_APP_DEV_URL 开发环境地址
|
|
5
|
+
* @String NPM_APP_TEST_URL 测试环境地址
|
|
6
|
+
* @String NPM_APP_PRE_URL 预发布环境地址
|
|
7
|
+
* @String NPM_APP_PROD_URL 线上环境地址
|
|
8
|
+
* @Array cdnConfig 排除打包文件集合
|
|
9
|
+
* @Object cdn 引入文件 cdn 链接
|
|
10
|
+
* @function setPackParams 设置打包参数
|
|
11
|
+
* @function proxy 代理
|
|
12
|
+
*/
|
|
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: 'kityformula',
|
|
23
|
+
library: 'kityformula',
|
|
24
|
+
js: [
|
|
25
|
+
`${NPM_APP_CDN_URL}/tinymce/kityformula-editor/kityformula/js/jquery-3.6.0.min.js`,
|
|
26
|
+
`${NPM_APP_CDN_URL}/tinymce/kityformula-editor/kityformula/js/kitygraph.all.js`,
|
|
27
|
+
`${NPM_APP_CDN_URL}/tinymce/kityformula-editor/kityformula/js/kity-formula-render.all.js`,
|
|
28
|
+
`${NPM_APP_CDN_URL}/tinymce/kityformula-editor/kityformula/js/kity-formula-parser.all.min.js`,
|
|
29
|
+
`${NPM_APP_CDN_URL}/tinymce/kityformula-editor/kityformula/js/kityformula-editor.all.min.js`
|
|
30
|
+
],
|
|
31
|
+
css: []
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
return cdnConfigs
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const cdn = () => {
|
|
38
|
+
const cdnConfig = getConfig()
|
|
39
|
+
const js = []
|
|
40
|
+
const css = []
|
|
41
|
+
cdnConfig.forEach((v) => {
|
|
42
|
+
js.push(...v.js)
|
|
43
|
+
css.push(...v.css)
|
|
44
|
+
})
|
|
45
|
+
return {
|
|
46
|
+
css,
|
|
47
|
+
js
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const setPackParams = (config) => {
|
|
52
|
+
config.plugin('html').tap((args) => {
|
|
53
|
+
let cdns = cdn()
|
|
54
|
+
args[0].cdn = cdns
|
|
55
|
+
return args
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const proxy = (pro, env) => {
|
|
60
|
+
if (!pro || !env) {
|
|
61
|
+
return new Error('pro or env is not difine !')
|
|
62
|
+
}
|
|
63
|
+
const params = {
|
|
64
|
+
dev: NPM_APP_DEV_URL,
|
|
65
|
+
test: NPM_APP_TEST_URL,
|
|
66
|
+
pre: NPM_APP_PRE_URL,
|
|
67
|
+
prod: NPM_APP_PROD_URL
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
['/' + pro + '/bm']: {
|
|
71
|
+
target: params[env],
|
|
72
|
+
pathRewrite: { ['^/' + pro + '/bm']: `/${pro}/bm` }
|
|
73
|
+
},
|
|
74
|
+
['/' + pro + '/pj']: {
|
|
75
|
+
target: params[env],
|
|
76
|
+
pathRewrite: { ['^/' + pro + '/pj']: `/${pro}/pj` }
|
|
77
|
+
},
|
|
78
|
+
['/' + pro + '/ua']: {
|
|
79
|
+
target: params[env],
|
|
80
|
+
pathRewrite: { ['^/' + pro + '/ua']: `/${pro}/ua` }
|
|
81
|
+
},
|
|
82
|
+
['/' + pro + '/gov']: {
|
|
83
|
+
target: params[env],
|
|
84
|
+
pathRewrite: { ['^/' + pro + '/gov']: `/${pro}/gov` }
|
|
85
|
+
},
|
|
86
|
+
['/' + pro + '/kw']: {
|
|
87
|
+
target: params[env],
|
|
88
|
+
pathRewrite: { ['^/' + pro + '/kw']: `/${pro}/kw` }
|
|
89
|
+
},
|
|
90
|
+
['/' + pro + '/pt']: {
|
|
91
|
+
target: params[env],
|
|
92
|
+
pathRewrite: { ['^/' + pro + '/pt']: `/${pro}/pt` }
|
|
93
|
+
},
|
|
94
|
+
['/' + pro + '/cj']: {
|
|
95
|
+
target: params[env],
|
|
96
|
+
pathRewrite: { ['^/' + pro + '/cj']: `/${pro}/cj` }
|
|
97
|
+
},
|
|
98
|
+
['/' + pro + '/api']: {
|
|
99
|
+
target: params[env],
|
|
100
|
+
pathRewrite: { ['^/' + pro + '/api']: `/${pro}/api` }
|
|
101
|
+
},
|
|
102
|
+
['/' + pro + '/login']: {
|
|
103
|
+
target: params[env],
|
|
104
|
+
pathRewrite: { ['^/' + pro + '/login']: `/${pro}/login` }
|
|
105
|
+
},
|
|
106
|
+
['/' + pro + '/tps']: {
|
|
107
|
+
target: params[env],
|
|
108
|
+
pathRewrite: { ['^/' + pro + '/tps']: `/${pro}/tps` }
|
|
109
|
+
},
|
|
110
|
+
['/' + pro + '/tk']: {
|
|
111
|
+
target: params[env],
|
|
112
|
+
pathRewrite: { ['^/' + pro + '/tk']: `/${pro}/tk` }
|
|
113
|
+
},
|
|
114
|
+
['/' + pro + '/ks']: {
|
|
115
|
+
target: params[env],
|
|
116
|
+
pathRewrite: { ['^/' + pro + '/ks']: `/${pro}/ks` }
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
module.exports = {
|
|
122
|
+
proxy,
|
|
123
|
+
setPackParams
|
|
124
|
+
}
|
|
125
|
+
|