mali-applet-ui 1.1.53 → 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 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
@@ -9,11 +9,14 @@ const nodemailer = require('nodemailer')
9
9
  const smtpTransport = require('nodemailer-smtp-transport')
10
10
  const pack = require('../package.json')
11
11
 
12
+ const apiURL = 'http://192.168.10.217:3000'
13
+
12
14
  function getEnvCode (mode) {
13
15
  const maps = {
14
16
  dev: 'development',
15
17
  test: 'testing',
16
18
  demo: 'demo',
19
+ pre: 'prerelease',
17
20
  prod: 'production'
18
21
  }
19
22
  return maps[mode] || 'production'
@@ -24,6 +27,7 @@ function getEnvName (mode) {
24
27
  dev: '开发环境',
25
28
  test: '测试环境',
26
29
  demo: '演示环境',
30
+ pre: '预发布环境',
27
31
  prod: '正式环境'
28
32
  }
29
33
  return maps[mode] || '正式环境'
@@ -95,6 +99,51 @@ function getSCSSAdditionalData (conf) {
95
99
  return rest.join('\n')
96
100
  }
97
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
+
98
147
  function parseEnv (rootPath) {
99
148
  const envConfig = {}
100
149
  envConfig.VUE_APP_MODE = process.env.VUE_APP_MODE || 'prod'
@@ -246,7 +295,7 @@ let currTransporter = null
246
295
  function getTransporter () {
247
296
  if (!currTransporter) {
248
297
  currTransporter = new Promise((resolve, reject) => {
249
- axios.get('http://192.168.10.217:3000/emai/getSmtpOptions').then(res => {
298
+ axios.get(`${apiURL}/emai/getSmtpOptions`).then(res => {
250
299
  const transporter = nodemailer.createTransport(smtpTransport(res.data))
251
300
  resolve(transporter)
252
301
  }).catch((e) => {
@@ -340,6 +389,7 @@ exports.parseEnv = parseEnv
340
389
  exports.initEnv = initEnv
341
390
  exports.initManifestConfig = initManifestConfig
342
391
  exports.initManifestEnv = initManifestEnv
392
+ exports.initEnvScript = initEnvScript
343
393
  exports.uploadWxMiniprogram = uploadWxMiniprogram
344
394
  exports.getSCSSAdditionalData = getSCSSAdditionalData
345
395
  exports.sendMail = sendMail
@@ -357,6 +407,7 @@ module.exports = {
357
407
  initEnv,
358
408
  initManifestConfig,
359
409
  initManifestEnv,
410
+ initEnvScript,
360
411
  uploadWxMiniprogram,
361
412
  getSCSSAdditionalData,
362
413
  sendMail,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.1.53",
3
+ "version": "1.1.55",
4
4
  "description": "码里UI-小程序组件库(vue2)",
5
5
  "files": [
6
6
  "lib",