mali-applet-ui 1.1.58 → 1.1.60
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.js +45 -19
- package/package.json +1 -1
package/env/index.js
CHANGED
|
@@ -11,10 +11,16 @@ const pack = require('../package.json')
|
|
|
11
11
|
|
|
12
12
|
const apiURL = 'http://192.168.10.217:3000'
|
|
13
13
|
|
|
14
|
+
function hasEmptyConf (key) {
|
|
15
|
+
return !key || key === 'default'
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
function getEnvCode (mode) {
|
|
15
19
|
const maps = {
|
|
16
20
|
dev: 'development',
|
|
17
21
|
test: 'testing',
|
|
22
|
+
sit: 'integrationtest',
|
|
23
|
+
uat: 'acceptancetest',
|
|
18
24
|
demo: 'demo',
|
|
19
25
|
pre: 'prerelease',
|
|
20
26
|
prod: 'production'
|
|
@@ -26,6 +32,8 @@ function getEnvName (mode) {
|
|
|
26
32
|
const maps = {
|
|
27
33
|
dev: '开发环境',
|
|
28
34
|
test: '测试环境',
|
|
35
|
+
sit: '集成测试环境',
|
|
36
|
+
uat: '验收测试环境',
|
|
29
37
|
demo: '演示环境',
|
|
30
38
|
pre: '预发布环境',
|
|
31
39
|
prod: '正式环境'
|
|
@@ -149,7 +157,7 @@ function initEnvScript (rootPath, confs) {
|
|
|
149
157
|
const envName = `.env.${customName || 'default'}.${subName || 'default'}.${platform || 'default'}.${getEnvCode(mode)}`
|
|
150
158
|
if (!fs.existsSync(path.resolve(rootPath, envName))) {
|
|
151
159
|
console.log(`${pack.name} 生成配置文件 ${envName}`)
|
|
152
|
-
fs.writeFileSync(path.resolve(rootPath, envName), `# ${[customName
|
|
160
|
+
fs.writeFileSync(path.resolve(rootPath, envName), `# ${[customName ? getCustomName(customName) : '', subName ? getSubModuleName(subName) : '', getEnvName(mode)].filter(v => v).map(v => v).join('-')}\n`)
|
|
153
161
|
}
|
|
154
162
|
})
|
|
155
163
|
})
|
|
@@ -338,8 +346,9 @@ function getTransporter () {
|
|
|
338
346
|
if (!currTransporter) {
|
|
339
347
|
currTransporter = new Promise((resolve, reject) => {
|
|
340
348
|
axios.get(`${apiURL}/emai/getSmtpOptions`).then(res => {
|
|
341
|
-
const
|
|
342
|
-
|
|
349
|
+
const smtpOptions = res.data
|
|
350
|
+
const transporter = nodemailer.createTransport(smtpTransport(smtpOptions))
|
|
351
|
+
resolve({ transporter, smtpOptions })
|
|
343
352
|
}).catch((e) => {
|
|
344
353
|
console.log('获取邮箱配置失败')
|
|
345
354
|
reject(e)
|
|
@@ -351,19 +360,24 @@ function getTransporter () {
|
|
|
351
360
|
|
|
352
361
|
function sendMail ({ receivedBy, subject, html }) {
|
|
353
362
|
return new Promise((resolve, reject) => {
|
|
354
|
-
getTransporter().then((transporter) => {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
363
|
+
getTransporter().then(({ transporter, smtpOptions }) => {
|
|
364
|
+
if (smtpOptions) {
|
|
365
|
+
transporter.sendMail({
|
|
366
|
+
from: smtpOptions.auth.user,
|
|
367
|
+
to: receivedBy,
|
|
368
|
+
subject,
|
|
369
|
+
html
|
|
370
|
+
}, function (error) {
|
|
371
|
+
if (error) {
|
|
372
|
+
reject(error)
|
|
373
|
+
} else {
|
|
374
|
+
resolve()
|
|
375
|
+
}
|
|
376
|
+
})
|
|
377
|
+
} else {
|
|
378
|
+
const e = {}
|
|
379
|
+
reject(e)
|
|
380
|
+
}
|
|
367
381
|
}).catch((e) => {
|
|
368
382
|
reject(e)
|
|
369
383
|
})
|
|
@@ -406,19 +420,31 @@ function sendQyWechatMsg (webhook, opts) {
|
|
|
406
420
|
})
|
|
407
421
|
}
|
|
408
422
|
|
|
423
|
+
const runSystemName = `${getPlatformName(process.env.VUE_APP_PLATFORM_NAME)}小程序`
|
|
424
|
+
|
|
409
425
|
function getBuildMsg (description, time) {
|
|
426
|
+
const title = [getCustomName(process.env.VUE_APP_CUSTOM_MODULE), hasEmptyConf(process.env.VUE_APP_SUB_MODULE) ? description : getSubModuleName(process.env.VUE_APP_SUB_MODULE)].filter(v => v).join('-')
|
|
410
427
|
return `
|
|
411
|
-
# <font color="info">${
|
|
428
|
+
# <font color="info">${title}</font> 开始构建
|
|
429
|
+
>> 平台:<font color="comment">${runSystemName}</font>
|
|
430
|
+
${process.env.GIT_BRANCH ? `>> Git分支:<font color="comment">${process.env.GIT_BRANCH}</font>` : ''}
|
|
431
|
+
${process.env.VUE_APP_MODE ? `>> 环境:<font color="info">${getEnvName(process.env.VUE_APP_MODE)}</font>` : ''}
|
|
412
432
|
>> 构建时间:<font color="comment">${XEUtils.toDateString(XEUtils.toStringDate(process.env.VUE_APP_PUBLISH_DATE, 'yyyyMMddHHmmss'), 'yyyy-MM-dd HH:mm:ss')}</font>
|
|
413
433
|
>> 预计用时:<font color="comment">${time || 15}分钟</font>
|
|
434
|
+
${process.env.BUILD_USER ? `>> 操作人:${process.env.BUILD_USER}` : ''}
|
|
414
435
|
<font color="comment">-自动化发版</font>
|
|
415
436
|
`
|
|
416
437
|
}
|
|
417
438
|
|
|
418
439
|
function getBuildSuccessMsg (description) {
|
|
440
|
+
const title = [getCustomName(process.env.VUE_APP_CUSTOM_MODULE), hasEmptyConf(process.env.VUE_APP_SUB_MODULE) ? description : getSubModuleName(process.env.VUE_APP_SUB_MODULE)].filter(v => v).join('-')
|
|
419
441
|
return `
|
|
420
|
-
# <font color="info">${
|
|
421
|
-
>>
|
|
442
|
+
# <font color="info">${title}</font> <font color="info">发版成功</font>
|
|
443
|
+
>> 平台:<font color="comment">${runSystemName}</font>
|
|
444
|
+
${process.env.GIT_BRANCH ? `>> Git分支:<font color="comment">${process.env.GIT_BRANCH}</font>` : ''}
|
|
445
|
+
${process.env.VUE_APP_MODE ? `>> 环境:<font color="info">${getEnvName(process.env.VUE_APP_MODE)}</font>` : ''}
|
|
446
|
+
${process.env.VUE_APP_PUBLISH_DATE ? `>> 部署时间:<font color="comment">${XEUtils.toDateString(XEUtils.toStringDate(process.env.VUE_APP_PUBLISH_DATE, 'yyyyMMddHHmmss'), 'yyyy-MM-dd HH:mm:ss')}</font>` : ''}
|
|
447
|
+
${process.env.BUILD_USER ? `>> 操作人:${process.env.BUILD_USER}` : ''}
|
|
422
448
|
<font color="comment">-自动化发版</font>`
|
|
423
449
|
}
|
|
424
450
|
|