mali-applet-ui 1.1.55 → 1.1.56

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,7 +7,7 @@ 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: {
10
+ export function initEnvScript(dirPath: string, confs: {
11
11
  customName: string
12
12
  subName: string
13
13
  platform: '' | 'mp-weixin' | 'mp-qiwei' | 'mp-dingtalk' | 'h5-dingtalk' | 'h5-qiwei' | 'dingtalk'
package/env/index.js CHANGED
@@ -110,7 +110,7 @@ function getPlatformRunName (platform) {
110
110
  return platform.replace('-', '')
111
111
  }
112
112
 
113
- function initEnvScript (rootPath, config) {
113
+ function initEnvScript (rootPath, confs) {
114
114
  const pack = JSON.parse(fs.readFileSync(path.resolve(rootPath, 'package.json')))
115
115
  const scripts = {
116
116
  update: 'npm install --legacy-peer-deps',
@@ -121,27 +121,56 @@ function initEnvScript (rootPath, config) {
121
121
  uni_h5dingtalk_build: 'npm run run_before && vue-cli-service uni-build && gulp build_h5_zip',
122
122
  uni_h5qiwei_build: 'npm run run_before && vue-cli-service uni-build && gulp build_h5_zip',
123
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',
124
+ uni_mpweixin_upload: 'npm run run_before && node script/run-build && vue-cli-service uni-build && node script/run-deploy',
125
125
  uni_mpdingtalk_build: 'npm run run_before && uniapp-cli custom mp-dingtalk',
126
126
  run_before: 'node script/run-before',
127
127
  clear: 'gulp clear_temp'
128
128
  }
129
- config.forEach(({ customName, subName, platform, modes }) => {
129
+
130
+ console.log('\n正在检查配置')
131
+ confs.forEach(({ customName, subName, platform, modes }) => {
130
132
  const names = [customName, subName, platform].filter(v => v)
131
133
  const envs = [
132
134
  customName ? `VUE_APP_CUSTOM_MODULE=${customName}` : '',
133
135
  subName ? `VUE_APP_SUB_MODULE=${subName}` : '',
134
136
  platform ? `VUE_APP_PLATFORM_NAME=${platform}` : ''
135
137
  ].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`
138
+ scripts[`serve${names.length ? `:${names.join(':')}` : ''}`] = `cross-env ${envs.join(' ')} NODE_ENV=development UNI_PLATFORM=${getUniPlatform(platform)} UNI_OUTPUT_DIR=dist/dev/${[customName || 'default', subName || 'default', platform || 'default', 'dev'].join('_')} VUE_APP_MODE=dev npm run uni_${getPlatformRunName(platform)}_serve`
137
139
  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
+ scripts[`build:${names.concat([mode]).join(':')}`] = `cross-env ${envs.join(' ')} NODE_ENV=production UNI_PLATFORM=${getUniPlatform(platform)} UNI_OUTPUT_DIR=dist/build/${[customName || 'default', subName || 'default', platform || 'default', mode].join('_')} VUE_APP_MODE=${mode} npm run uni_${getPlatformRunName(platform)}_build`
141
+ scripts[`deploy:${names.concat([mode]).join(':')}`] = `cross-env ${envs.join(' ')} NODE_ENV=production UNI_PLATFORM=${getUniPlatform(platform)} UNI_OUTPUT_DIR=dist/build/${[customName || 'default', subName || 'default', platform || 'default', mode].join('_')} VUE_APP_MODE=${mode} npm run uni_${getPlatformRunName(platform)}_upload`
142
+
143
+ // 生成配置文件
144
+ const envName = `.env.${customName || 'default'}.${subName || 'default'}.${platform || 'default'}.${getEnvCode(mode)}`
145
+ if (!fs.existsSync(path.resolve(rootPath, envName))) {
146
+ console.log(`${pack.name} 生成配置文件 ${envName}`)
147
+ fs.writeFileSync(path.resolve(rootPath, envName), `# ${[customName || '', getEnvName(mode)].map(v => v).join('-')}\n`)
148
+ }
140
149
  })
141
150
  })
151
+ console.log('生成运行脚本完成')
142
152
 
143
153
  pack.scripts = scripts
144
154
  fs.writeFileSync(path.resolve(rootPath, 'package.json'), `${JSON.stringify(pack, null, 2)}\n`)
155
+
156
+ // 生成脚本文件
157
+ if (!fs.existsSync(path.resolve(rootPath, 'script/run-before.js'))) {
158
+ console.log(`${pack.name} 生成脚本文件 script/run-before.js`)
159
+ fs.writeFileSync(path.resolve(rootPath, 'script/run-before.js'), fs.readFileSync(path.resolve(__dirname, 'script/run-before.txt'), { encoding: 'utf8' }))
160
+ }
161
+ if (!fs.existsSync(path.resolve(rootPath, 'script/run-build.js'))) {
162
+ console.log(`${pack.name} 生成脚本文件 script/run-build.js`)
163
+ fs.writeFileSync(path.resolve(rootPath, 'script/run-build.js'), fs.readFileSync(path.resolve(__dirname, 'script/run-build.txt'), { encoding: 'utf8' }))
164
+ }
165
+ if (!fs.existsSync(path.resolve(rootPath, 'script/run-upload.js'))) {
166
+ console.log(`${pack.name} 生成脚本文件 script/run-upload.js`)
167
+ fs.writeFileSync(path.resolve(rootPath, 'script/run-upload.js'), fs.readFileSync(path.resolve(__dirname, 'script/run-upload.txt'), { encoding: 'utf8' }))
168
+ }
169
+ if (!fs.existsSync(path.resolve(rootPath, 'script/run-init.js'))) {
170
+ console.log(`${pack.name} 生成脚本文件 script/run-init.js`)
171
+ fs.writeFileSync(path.resolve(rootPath, 'script/run-init.js'), fs.readFileSync(path.resolve(__dirname, 'script/run-init.txt'), { encoding: 'utf8' }))
172
+ }
173
+ console.log('初始化完成\n')
145
174
  }
146
175
 
147
176
  function parseEnv (rootPath) {
@@ -163,6 +192,14 @@ function parseEnv (rootPath) {
163
192
  const envEnv = parseEnvFile(rootPath, envName)
164
193
  const localEnv = parseEnvFile(rootPath, `${envName}.local`)
165
194
 
195
+ console.log('\n读取配置文件:')
196
+ const endFiles = ['.env', cName, csName, cspName, envName, `${envName}.local`]
197
+ endFiles.forEach(fileName => {
198
+ if (fs.existsSync(path.resolve(rootPath, fileName))) {
199
+ console.log(`${fileName}`)
200
+ }
201
+ })
202
+
166
203
  return Object.assign({}, globalDev, cEnv, csEnv, cspEnv, envEnv, localEnv, envConfig)
167
204
  }
168
205
 
@@ -0,0 +1,7 @@
1
+ const path = require('path')
2
+ const fs = require('fs')
3
+ const { initManifestConfig } = require('mali-applet-ui/env')
4
+
5
+ initManifestConfig(path.resolve(__dirname, '../'), require('../conf/manifest.js'))
6
+
7
+ fs.writeFileSync(path.resolve(__dirname, '../src/pages.json'), JSON.stringify(require('../pages'), null, 2))
@@ -0,0 +1,9 @@
1
+ // const path = require('path')
2
+ // const pack = require('../package.json')
3
+ // const { initEnv, sendQyWechatMsg, getBuildMsg } = require('mali-applet-ui/env')
4
+
5
+ // initEnv(path.resolve(__dirname, '../'))
6
+
7
+ // sendQyWechatMsg(process.env.VUE_APP_QY_WECHAT_WEBHOOK, {
8
+ // content: getBuildMsg(pack.description)
9
+ // })
@@ -0,0 +1,4 @@
1
+ const path = require('path')
2
+ const { initManifestEnv } = require('mali-applet-ui/env')
3
+
4
+ initManifestEnv(path.resolve(__dirname, '../'), require('../conf/manifest.js'))
@@ -0,0 +1,25 @@
1
+ const path = require('path')
2
+ const fs = require('fs')
3
+ const md5 = require('md5')
4
+ const pack = require('../package.json')
5
+ const { initEnv, uploadWxMiniprogram, sendQyWechatMsg, getBuildSuccessMsg } = require('mali-applet-ui/env')
6
+
7
+ initEnv(path.resolve(__dirname, '../'))
8
+
9
+ // 上传包
10
+ uploadWxMiniprogram(path.resolve(__dirname, '../'), pack.version).then(() => {
11
+ if (process.env.VUE_APP_QY_WECHAT_WEBHOOK) {
12
+ sendQyWechatMsg(process.env.VUE_APP_QY_WECHAT_WEBHOOK, {
13
+ content: getBuildSuccessMsg(pack.description)
14
+ })
15
+
16
+ const qrImg = path.resolve(__dirname, `../conf/trialQr/${process.env.VUE_APP_MP_APPID}.png`)
17
+ if (fs.existsSync(qrImg)) {
18
+ sendQyWechatMsg(process.env.VUE_APP_QY_WECHAT_WEBHOOK, {
19
+ msgType: 'image',
20
+ base64: fs.readFileSync(qrImg).toString('base64'),
21
+ md5: md5(fs.readFileSync(qrImg))
22
+ })
23
+ }
24
+ }
25
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.1.55",
3
+ "version": "1.1.56",
4
4
  "description": "码里UI-小程序组件库(vue2)",
5
5
  "files": [
6
6
  "lib",