mali-applet-ui 1.1.54 → 1.1.55
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/env/index.d.ts +6 -0
- package/env/index.js +47 -0
- package/package.json +1 -1
package/env/index.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ export function parseEnv(dirPath: string): Record<string, string>
|
|
|
7
7
|
export function initEnv(dirPath: string, defaultEnv: Record<string, string>): Record<string, string>
|
|
8
8
|
export function initManifestConfig(dirPath: string, manifestJson: any): void
|
|
9
9
|
export function initManifestEnv(dirPath: string, manifestJson: any): Record<string, string>
|
|
10
|
+
export function initEnvScript(dirPath: string, config: {
|
|
11
|
+
customName: string
|
|
12
|
+
subName: string
|
|
13
|
+
platform: '' | 'mp-weixin' | 'mp-qiwei' | 'mp-dingtalk' | 'h5-dingtalk' | 'h5-qiwei' | 'dingtalk'
|
|
14
|
+
modes: ('dev' | 'test' | 'demo' | 'pre' | 'prod')[]
|
|
15
|
+
}[]): any
|
|
10
16
|
export function uploadWxMiniprogram(version: string): void
|
|
11
17
|
export function getSCSSAdditionalData(envConfig?: an): string
|
|
12
18
|
|
package/env/index.js
CHANGED
|
@@ -99,6 +99,51 @@ function getSCSSAdditionalData (conf) {
|
|
|
99
99
|
return rest.join('\n')
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
function getUniPlatform (platform) {
|
|
103
|
+
if (['h5-dingtalk', 'h5-qiwei'].includes(platform)) {
|
|
104
|
+
return 'h5'
|
|
105
|
+
}
|
|
106
|
+
return 'mp-weixin'
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function getPlatformRunName (platform) {
|
|
110
|
+
return platform.replace('-', '')
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function initEnvScript (rootPath, config) {
|
|
114
|
+
const pack = JSON.parse(fs.readFileSync(path.resolve(rootPath, 'package.json')))
|
|
115
|
+
const scripts = {
|
|
116
|
+
update: 'npm install --legacy-peer-deps',
|
|
117
|
+
'eslint-fix': 'eslint --fix --ext .vue,.js src',
|
|
118
|
+
uni_h5dingtalk_serve: 'npm run run_before && vue-cli-service uni-serve',
|
|
119
|
+
uni_h5qiwei_serve: 'npm run run_before && vue-cli-service uni-serve',
|
|
120
|
+
uni_mpweixin_build: 'npm run run_before && vue-cli-service uni-build',
|
|
121
|
+
uni_h5dingtalk_build: 'npm run run_before && vue-cli-service uni-build && gulp build_h5_zip',
|
|
122
|
+
uni_h5qiwei_build: 'npm run run_before && vue-cli-service uni-build && gulp build_h5_zip',
|
|
123
|
+
uni_mpweixin_serve: 'npm run run_before && vue-cli-service uni-build --watch',
|
|
124
|
+
uni_mpweixin_upload: 'npm run run_before && node script/run-build && vue-cli-service uni-build && node script/run-upload',
|
|
125
|
+
uni_mpdingtalk_build: 'npm run run_before && uniapp-cli custom mp-dingtalk',
|
|
126
|
+
run_before: 'node script/run-before',
|
|
127
|
+
clear: 'gulp clear_temp'
|
|
128
|
+
}
|
|
129
|
+
config.forEach(({ customName, subName, platform, modes }) => {
|
|
130
|
+
const names = [customName, subName, platform].filter(v => v)
|
|
131
|
+
const envs = [
|
|
132
|
+
customName ? `VUE_APP_CUSTOM_MODULE=${customName}` : '',
|
|
133
|
+
subName ? `VUE_APP_SUB_MODULE=${subName}` : '',
|
|
134
|
+
platform ? `VUE_APP_PLATFORM_NAME=${platform}` : ''
|
|
135
|
+
].filter(v => v)
|
|
136
|
+
scripts[`serve${names.length ? `:${names.join(':')}` : ''}`] = `cross-env ${envs.join(' ')} NODE_ENV=development UNI_PLATFORM=${getUniPlatform(platform)} UNI_OUTPUT_DIR=dist/dev/mp${customName ? `-${customName}` : ''}-weixin-dev VUE_APP_MODE=dev npm run uni_${getPlatformRunName(platform)}_serve`
|
|
137
|
+
modes.forEach(mode => {
|
|
138
|
+
scripts[`build:${names.concat([mode]).join(':')}`] = `cross-env ${envs.join(' ')} NODE_ENV=production UNI_PLATFORM=${getUniPlatform(platform)} UNI_OUTPUT_DIR=dist/build/mp${customName ? `-${customName}` : ''}-weixin-${mode} VUE_APP_MODE=${mode} npm run uni_${getPlatformRunName(platform)}_build`
|
|
139
|
+
scripts[`deploy:${names.concat([mode]).join(':')}`] = `cross-env ${envs.join(' ')} NODE_ENV=production UNI_PLATFORM=${getUniPlatform(platform)} UNI_OUTPUT_DIR=dist/build/mp${customName ? `-${customName}` : ''}-weixin-${mode} VUE_APP_MODE=${mode} npm run uni_${getPlatformRunName(platform)}_upload`
|
|
140
|
+
})
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
pack.scripts = scripts
|
|
144
|
+
fs.writeFileSync(path.resolve(rootPath, 'package.json'), `${JSON.stringify(pack, null, 2)}\n`)
|
|
145
|
+
}
|
|
146
|
+
|
|
102
147
|
function parseEnv (rootPath) {
|
|
103
148
|
const envConfig = {}
|
|
104
149
|
envConfig.VUE_APP_MODE = process.env.VUE_APP_MODE || 'prod'
|
|
@@ -344,6 +389,7 @@ exports.parseEnv = parseEnv
|
|
|
344
389
|
exports.initEnv = initEnv
|
|
345
390
|
exports.initManifestConfig = initManifestConfig
|
|
346
391
|
exports.initManifestEnv = initManifestEnv
|
|
392
|
+
exports.initEnvScript = initEnvScript
|
|
347
393
|
exports.uploadWxMiniprogram = uploadWxMiniprogram
|
|
348
394
|
exports.getSCSSAdditionalData = getSCSSAdditionalData
|
|
349
395
|
exports.sendMail = sendMail
|
|
@@ -361,6 +407,7 @@ module.exports = {
|
|
|
361
407
|
initEnv,
|
|
362
408
|
initManifestConfig,
|
|
363
409
|
initManifestEnv,
|
|
410
|
+
initEnvScript,
|
|
364
411
|
uploadWxMiniprogram,
|
|
365
412
|
getSCSSAdditionalData,
|
|
366
413
|
sendMail,
|