mali-applet-ui 1.1.57 → 1.1.59

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.
Files changed (2) hide show
  1. package/env/index.js +54 -23
  2. 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: '正式环境'
@@ -115,14 +123,19 @@ function initEnvScript (rootPath, confs) {
115
123
  const scripts = {
116
124
  update: 'npm install --legacy-peer-deps',
117
125
  'eslint-fix': 'eslint --fix --ext .vue,.js src',
118
- uni_h5dingtalk_serve: 'npm run run_before && vue-cli-service uni-serve',
119
126
  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
127
  uni_h5qiwei_build: 'npm run run_before && vue-cli-service uni-build && gulp build_h5_zip',
128
+ uni_h5qiwei_upload: 'npm run uni_h5qiwei_build',
129
+ uni_h5dingtalk_serve: 'npm run run_before && vue-cli-service uni-serve',
130
+ uni_h5dingtalk_build: 'npm run run_before && vue-cli-service uni-build && gulp build_h5_zip',
131
+ uni_h5dingtalk_upload: 'npm run uni_h5dingtalk_build',
123
132
  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-deploy',
133
+ uni_mpweixin_upload: 'npm run run_before && node script/run-build && vue-cli-service uni-build && node script/run-upload',
134
+ uni_mpweixin_build: 'npm run run_before && vue-cli-service uni-build',
125
135
  uni_mpdingtalk_build: 'npm run run_before && uniapp-cli custom mp-dingtalk',
136
+ uni_mpqiwei_serve: 'npm run run_before && vue-cli-service uni-build --watch',
137
+ uni_mpqiwei_upload: 'npm run run_before && node script/run-build && vue-cli-service uni-build && node script/run-upload',
138
+ uni_mpqiwei_build: 'npm run run_before && vue-cli-service uni-build',
126
139
  run_before: 'node script/run-before',
127
140
  clear: 'gulp clear_temp'
128
141
  }
@@ -144,7 +157,7 @@ function initEnvScript (rootPath, confs) {
144
157
  const envName = `.env.${customName || 'default'}.${subName || 'default'}.${platform || 'default'}.${getEnvCode(mode)}`
145
158
  if (!fs.existsSync(path.resolve(rootPath, envName))) {
146
159
  console.log(`${pack.name} 生成配置文件 ${envName}`)
147
- fs.writeFileSync(path.resolve(rootPath, envName), `# ${[customName || '', getEnvName(mode)].map(v => v).join('-')}\n`)
160
+ fs.writeFileSync(path.resolve(rootPath, envName), `# ${[customName ? getCustomName(customName) : '', subName ? getSubModuleName(subName) : '', getEnvName(mode)].filter(v => v).map(v => v).join('-')}\n`)
148
161
  }
149
162
  })
150
163
  })
@@ -333,8 +346,9 @@ function getTransporter () {
333
346
  if (!currTransporter) {
334
347
  currTransporter = new Promise((resolve, reject) => {
335
348
  axios.get(`${apiURL}/emai/getSmtpOptions`).then(res => {
336
- const transporter = nodemailer.createTransport(smtpTransport(res.data))
337
- resolve(transporter)
349
+ const smtpOptions = res.data
350
+ const transporter = nodemailer.createTransport(smtpTransport(smtpOptions))
351
+ resolve({ transporter, smtpOptions })
338
352
  }).catch((e) => {
339
353
  console.log('获取邮箱配置失败')
340
354
  reject(e)
@@ -346,19 +360,24 @@ function getTransporter () {
346
360
 
347
361
  function sendMail ({ receivedBy, subject, html }) {
348
362
  return new Promise((resolve, reject) => {
349
- getTransporter().then((transporter) => {
350
- transporter.sendMail({
351
- from: 'xuliangzhan@ddscan.cn',
352
- to: receivedBy,
353
- subject,
354
- html
355
- }, function (error) {
356
- if (error) {
357
- reject(error)
358
- } else {
359
- resolve()
360
- }
361
- })
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
+ }
362
381
  }).catch((e) => {
363
382
  reject(e)
364
383
  })
@@ -401,19 +420,31 @@ function sendQyWechatMsg (webhook, opts) {
401
420
  })
402
421
  }
403
422
 
423
+ const runSystemName = `${getPlatformName(process.env.VUE_APP_PLATFORM_NAME)}小程序`
424
+
404
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('-')
405
427
  return `
406
- # <font color="info">${[getCustomName(process.env.VUE_APP_CUSTOM_MODULE), description, `(${getPlatformName(process.env.VUE_APP_PLATFORM_NAME)}小程序)`].join('')}</font> 【${getEnvName(process.env.VUE_APP_MODE)}】 开始构建
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>` : ''}
407
432
  >> 构建时间:<font color="comment">${XEUtils.toDateString(XEUtils.toStringDate(process.env.VUE_APP_PUBLISH_DATE, 'yyyyMMddHHmmss'), 'yyyy-MM-dd HH:mm:ss')}</font>
408
433
  >> 预计用时:<font color="comment">${time || 15}分钟</font>
434
+ ${process.env.BUILD_USER ? `>> 操作人:${process.env.BUILD_USER}` : ''}
409
435
  <font color="comment">-自动化发版</font>
410
436
  `
411
437
  }
412
438
 
413
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('-')
414
441
  return `
415
- # <font color="info">${[getCustomName(process.env.VUE_APP_CUSTOM_MODULE), description, `(${getPlatformName(process.env.VUE_APP_PLATFORM_NAME)}小程序)`].join('')}</font> 【${getEnvName(process.env.VUE_APP_MODE)}】 <font color="info">体验版更新成功</font>
416
- >> 构建时间:<font color="comment">${XEUtils.toDateString(XEUtils.toStringDate(process.env.VUE_APP_PUBLISH_DATE, 'yyyyMMddHHmmss'), 'yyyy-MM-dd HH:mm:ss')}</font>
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}` : ''}
417
448
  <font color="comment">-自动化发版</font>`
418
449
  }
419
450
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.1.57",
3
+ "version": "1.1.59",
4
4
  "description": "码里UI-小程序组件库(vue2)",
5
5
  "files": [
6
6
  "lib",