@xfe-repo/mini-app 0.0.1
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/.eslintrc.js +13 -0
- package/README.md +3 -0
- package/bin/index.js +5 -0
- package/config/dev.ts +13 -0
- package/config/index.ts +105 -0
- package/config/prod.ts +9 -0
- package/deploy/.drone.yml +280 -0
- package/deploy/Dockerfile +14 -0
- package/deploy/env.sh +24 -0
- package/deploy/helm/Chart.yaml +8 -0
- package/deploy/helm/templates/deployment.yaml +58 -0
- package/deploy/helm/templates/svc.yaml +12 -0
- package/deploy/helm/templates/tpl.yaml +3 -0
- package/deploy/helm/templates/virtualService.yaml +39 -0
- package/deploy/helm/values.yaml +20 -0
- package/deploy/nginx.conf +41 -0
- package/deploy/static/9DwhwZ0Iwc.txt +1 -0
- package/deploy/static/website.html +21 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +256 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.js +84 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +69 -0
- package/package.json +64 -0
- package/scripts/preview.js +80 -0
- package/scripts/upload.js +31 -0
- package/tsconfig.json +10 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @type {import("eslint").Linter.Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
root: true,
|
|
4
|
+
extends: ["taro/react"],
|
|
5
|
+
rules: {
|
|
6
|
+
"react/jsx-uses-react": "off",
|
|
7
|
+
"react/react-in-jsx-scope": "off",
|
|
8
|
+
"import/no-commonjs": "off",
|
|
9
|
+
},
|
|
10
|
+
ignorePatterns: [
|
|
11
|
+
'*.js',
|
|
12
|
+
],
|
|
13
|
+
};
|
package/README.md
ADDED
package/bin/index.js
ADDED
package/config/dev.ts
ADDED
package/config/index.ts
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { defineConfig, type UserConfigExport } from '@tarojs/cli'
|
|
2
|
+
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
import devConfig from './dev'
|
|
5
|
+
import prodConfig from './prod'
|
|
6
|
+
|
|
7
|
+
// 获取APP_PROJECT_ROOT相对于当前文件的路径
|
|
8
|
+
const appProjectRootRelPath = path.relative(path.join(__dirname, '..'), process.env.APP_PROJECT_ROOT || '')
|
|
9
|
+
|
|
10
|
+
// 获取API_ENV环境变量 此处注意 需要stringify为带引号的字符串 这样在webpack中才能正确解析
|
|
11
|
+
const API_ENV = JSON.stringify(process.env.API_ENV || '')
|
|
12
|
+
|
|
13
|
+
export default defineConfig<'webpack5'>(async (merge) => {
|
|
14
|
+
const baseConfig: UserConfigExport<'webpack5'> = {
|
|
15
|
+
projectName: 'xfe-mini',
|
|
16
|
+
date: '2024-12-3',
|
|
17
|
+
designWidth: 750,
|
|
18
|
+
deviceRatio: {
|
|
19
|
+
640: 2.34 / 2,
|
|
20
|
+
750: 1,
|
|
21
|
+
375: 2,
|
|
22
|
+
828: 1.81 / 2
|
|
23
|
+
},
|
|
24
|
+
sourceRoot: path.join(appProjectRootRelPath, 'src'),
|
|
25
|
+
outputRoot: path.join(appProjectRootRelPath, 'dist'),
|
|
26
|
+
env: {
|
|
27
|
+
API_ENV,
|
|
28
|
+
},
|
|
29
|
+
alias: {
|
|
30
|
+
react: path.resolve('./node_modules/react')
|
|
31
|
+
},
|
|
32
|
+
plugins: [],
|
|
33
|
+
defineConstants: {},
|
|
34
|
+
copy: {
|
|
35
|
+
patterns: [],
|
|
36
|
+
options: {}
|
|
37
|
+
},
|
|
38
|
+
framework: 'react',
|
|
39
|
+
compiler: 'webpack5',
|
|
40
|
+
cache: {
|
|
41
|
+
enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
|
|
42
|
+
},
|
|
43
|
+
mini: {
|
|
44
|
+
postcss: {
|
|
45
|
+
pxtransform: {
|
|
46
|
+
enable: true,
|
|
47
|
+
config: {}
|
|
48
|
+
},
|
|
49
|
+
cssModules: {
|
|
50
|
+
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
|
|
51
|
+
config: {
|
|
52
|
+
namingPattern: 'module', // 转换模式,取值为 global/module
|
|
53
|
+
generateScopedName: '[name]__[local]___[hash:base64:5]'
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
webpackChain(chain) {
|
|
58
|
+
chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
h5: {
|
|
62
|
+
publicPath: '/',
|
|
63
|
+
staticDirectory: 'static',
|
|
64
|
+
output: {
|
|
65
|
+
filename: 'js/[name].[hash:8].js',
|
|
66
|
+
chunkFilename: 'js/[name].[chunkhash:8].js'
|
|
67
|
+
},
|
|
68
|
+
miniCssExtractPluginOption: {
|
|
69
|
+
ignoreOrder: true,
|
|
70
|
+
filename: 'css/[name].[hash].css',
|
|
71
|
+
chunkFilename: 'css/[name].[chunkhash].css'
|
|
72
|
+
},
|
|
73
|
+
postcss: {
|
|
74
|
+
autoprefixer: {
|
|
75
|
+
enable: true,
|
|
76
|
+
config: {}
|
|
77
|
+
},
|
|
78
|
+
cssModules: {
|
|
79
|
+
enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
|
|
80
|
+
config: {
|
|
81
|
+
namingPattern: 'module', // 转换模式,取值为 global/module
|
|
82
|
+
generateScopedName: '[name]__[local]___[hash:base64:5]'
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
webpackChain(chain) {
|
|
87
|
+
chain.resolve.plugin('tsconfig-paths').use(TsconfigPathsPlugin)
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
rn: {
|
|
91
|
+
appName: 'xfe-mini',
|
|
92
|
+
postcss: {
|
|
93
|
+
cssModules: {
|
|
94
|
+
enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (process.env.NODE_ENV === 'development') {
|
|
100
|
+
// 本地开发构建配置(不混淆压缩)
|
|
101
|
+
return merge({}, baseConfig, devConfig)
|
|
102
|
+
}
|
|
103
|
+
// 生产构建配置(默认开启压缩混淆等)
|
|
104
|
+
return merge({}, baseConfig, prodConfig)
|
|
105
|
+
})
|
package/config/prod.ts
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
---
|
|
2
|
+
# 通用 依赖安装部分
|
|
3
|
+
kind: pipeline
|
|
4
|
+
type: kubernetes
|
|
5
|
+
name: yarn
|
|
6
|
+
|
|
7
|
+
metadata:
|
|
8
|
+
namespace: cicd
|
|
9
|
+
|
|
10
|
+
trigger:
|
|
11
|
+
event:
|
|
12
|
+
- custom
|
|
13
|
+
- tag
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: yarn
|
|
17
|
+
pull: if-not-exists
|
|
18
|
+
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/node-mini:18.16.1
|
|
19
|
+
volumes:
|
|
20
|
+
- name: node-modules
|
|
21
|
+
path: /drone/src/node_modules
|
|
22
|
+
commands:
|
|
23
|
+
- yarn
|
|
24
|
+
|
|
25
|
+
volumes:
|
|
26
|
+
- name: node-modules
|
|
27
|
+
host:
|
|
28
|
+
path: /var/lib/node/${DRONE_REPO_NAME}-node-modules
|
|
29
|
+
|
|
30
|
+
image_pull_secrets:
|
|
31
|
+
- dockerconfigjson
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
# 小程序构建部分
|
|
35
|
+
kind: pipeline
|
|
36
|
+
type: kubernetes
|
|
37
|
+
name: deploy-mini
|
|
38
|
+
|
|
39
|
+
depends_on:
|
|
40
|
+
- yarn
|
|
41
|
+
|
|
42
|
+
metadata:
|
|
43
|
+
namespace: cicd
|
|
44
|
+
|
|
45
|
+
trigger:
|
|
46
|
+
event:
|
|
47
|
+
- custom
|
|
48
|
+
- tag
|
|
49
|
+
|
|
50
|
+
steps:
|
|
51
|
+
- name: yarn-build
|
|
52
|
+
pull: if-not-exists
|
|
53
|
+
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/node-mini:18.16.1
|
|
54
|
+
volumes:
|
|
55
|
+
- name: node-modules
|
|
56
|
+
path: /drone/src/node_modules
|
|
57
|
+
commands:
|
|
58
|
+
- GET_API_ENV=`bash deploy/env.sh` && export API_ENV=$GET_API_ENV
|
|
59
|
+
- yarn build
|
|
60
|
+
|
|
61
|
+
- name: preview
|
|
62
|
+
pull: if-not-exists
|
|
63
|
+
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/node-mini:18.16.1
|
|
64
|
+
volumes:
|
|
65
|
+
- name: node-modules
|
|
66
|
+
path: /drone/src/node_modules
|
|
67
|
+
environment:
|
|
68
|
+
|
|
69
|
+
commands:
|
|
70
|
+
- GET_API_ENV=`bash deploy/env.sh` && export API_ENV=$GET_API_ENV
|
|
71
|
+
- echo $API_ENV $DRONE_COMMIT_MESSAGE
|
|
72
|
+
- yarn preview -d "$API_ENV $DRONE_COMMIT_MESSAGE"
|
|
73
|
+
- echo '二维码将在2小时内过期 可在微信小程序助手中 找到此版本'
|
|
74
|
+
when:
|
|
75
|
+
ref:
|
|
76
|
+
exclude:
|
|
77
|
+
- refs/tags/release-*
|
|
78
|
+
|
|
79
|
+
- name: upload
|
|
80
|
+
pull: if-not-exists
|
|
81
|
+
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/node-mini:18.16.1
|
|
82
|
+
volumes:
|
|
83
|
+
- name: node-modules
|
|
84
|
+
path: /drone/src/node_modules
|
|
85
|
+
commands:
|
|
86
|
+
- GET_API_ENV=`bash deploy/env.sh` && export API_ENV=$GET_API_ENV
|
|
87
|
+
- echo $API_ENV $DRONE_COMMIT_MESSAGE
|
|
88
|
+
- yarn upload -d "$DRONE_COMMIT_MESSAGE" -v "$${DRONE_COMMIT_REF#refs/tags/}"
|
|
89
|
+
- echo '小程序已上传至微信后台 请注意及时提审'
|
|
90
|
+
- git fetch
|
|
91
|
+
- git checkout -b release $DRONE_COMMIT_REF
|
|
92
|
+
- git push origin release --force
|
|
93
|
+
- echo "release分支已强制同步到当前发布版本"
|
|
94
|
+
when:
|
|
95
|
+
ref:
|
|
96
|
+
include:
|
|
97
|
+
- refs/tags/release-*
|
|
98
|
+
|
|
99
|
+
volumes:
|
|
100
|
+
- name: node-modules
|
|
101
|
+
host:
|
|
102
|
+
path: /var/lib/node/${DRONE_REPO_NAME}-node-modules
|
|
103
|
+
|
|
104
|
+
image_pull_secrets:
|
|
105
|
+
- dockerconfigjson
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
# h5构建部分
|
|
109
|
+
kind: pipeline
|
|
110
|
+
type: kubernetes
|
|
111
|
+
name: deploy-h5
|
|
112
|
+
|
|
113
|
+
depends_on:
|
|
114
|
+
- yarn
|
|
115
|
+
# - deploy-mini
|
|
116
|
+
|
|
117
|
+
metadata:
|
|
118
|
+
namespace: cicd
|
|
119
|
+
|
|
120
|
+
trigger:
|
|
121
|
+
event:
|
|
122
|
+
- custom
|
|
123
|
+
- tag
|
|
124
|
+
|
|
125
|
+
steps:
|
|
126
|
+
- name: yarn-build
|
|
127
|
+
pull: if-not-exists
|
|
128
|
+
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/node-mini:18.16.1
|
|
129
|
+
volumes:
|
|
130
|
+
- name: node-modules
|
|
131
|
+
path: /drone/src/node_modules
|
|
132
|
+
commands:
|
|
133
|
+
- export GENERATE_SOURCEMAP=false
|
|
134
|
+
- yarn build:h5
|
|
135
|
+
|
|
136
|
+
- name: yarn-build-docs
|
|
137
|
+
pull: if-not-exists
|
|
138
|
+
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/node-mini:18.16.1
|
|
139
|
+
volumes:
|
|
140
|
+
- name: node-modules
|
|
141
|
+
path: /drone/src/node_modules
|
|
142
|
+
- name: node-modules-docs
|
|
143
|
+
path: /drone/src/dumi/node_modules
|
|
144
|
+
commands:
|
|
145
|
+
- cd ./dumi && yarn
|
|
146
|
+
- cd ../ && yarn docs:build
|
|
147
|
+
when:
|
|
148
|
+
ref:
|
|
149
|
+
include:
|
|
150
|
+
- refs/tags/stage-*
|
|
151
|
+
- refs/tags/release-*
|
|
152
|
+
|
|
153
|
+
- name: docker-build
|
|
154
|
+
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image/deploy-cli-docker
|
|
155
|
+
privileged: true
|
|
156
|
+
environment:
|
|
157
|
+
SSH_KEY:
|
|
158
|
+
from_secret: ssh-key
|
|
159
|
+
DOCKER_KEY:
|
|
160
|
+
from_secret: docker-key
|
|
161
|
+
DEPLOY_GO_CONFIG:
|
|
162
|
+
from_secret: deploy-go-config
|
|
163
|
+
commands:
|
|
164
|
+
- /usr/local/bin/dockerd-entrypoint.sh 2>&1 >> /dev/null &
|
|
165
|
+
- sleep 5
|
|
166
|
+
- sh /data/scripts/builderInit.sh
|
|
167
|
+
- appName="`echo ${DRONE_REPO//\//-}`"
|
|
168
|
+
- sed -i "s/<<APP_NAME>>/$appName/g" deploy/helm/values.yaml
|
|
169
|
+
- sed -i "s/<<CI_COMMIT_SHA>>/$CI_COMMIT_SHA/g" deploy/helm/values.yaml
|
|
170
|
+
- sed -i "s/<<TAG_CONTENT>>/$DRONE_TAG/g" deploy/helm/values.yaml
|
|
171
|
+
- docker build -f deploy/Dockerfile -t xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image/$$appName:$$CI_COMMIT_SHA . --no-cache
|
|
172
|
+
- docker push xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image/$$appName:$$CI_COMMIT_SHA
|
|
173
|
+
- docker rmi xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image/$$appName:$$CI_COMMIT_SHA
|
|
174
|
+
|
|
175
|
+
- name: deploy-to-test
|
|
176
|
+
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/deploy-helm:latest # dtzar/helm-kubectl
|
|
177
|
+
environment:
|
|
178
|
+
SAAS_K8S_CONFIG:
|
|
179
|
+
from_secret: saas-k8s-config
|
|
180
|
+
commands:
|
|
181
|
+
- echo "$SAAS_K8S_CONFIG" > saas_config
|
|
182
|
+
- cp deploy/helm/values.yaml deploy/helm/values.test.yaml
|
|
183
|
+
- sed -i "s/<<ENV_TYPE>>/test/g" deploy/helm/values.test.yaml
|
|
184
|
+
- sed -i "s/<<APP_PREFIX>>/-$HOST_PREFIX/g" deploy/helm/values.test.yaml
|
|
185
|
+
- sed -i "s/<<HOST_PREFIX>>/$HOST_PREFIX/g" deploy/helm/values.test.yaml
|
|
186
|
+
- helm template deploy/helm --values deploy/helm/values.test.yaml
|
|
187
|
+
- helm template deploy/helm --values deploy/helm/values.test.yaml | kubectl --kubeconfig=saas_config apply -f -
|
|
188
|
+
when:
|
|
189
|
+
event:
|
|
190
|
+
- custom
|
|
191
|
+
|
|
192
|
+
- name: deploy-to-stage
|
|
193
|
+
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/deploy-helm:latest # dtzar/helm-kubectl
|
|
194
|
+
environment:
|
|
195
|
+
SAAS_K8S_CONFIG:
|
|
196
|
+
from_secret: saas-k8s-config
|
|
197
|
+
commands:
|
|
198
|
+
- echo "$SAAS_K8S_CONFIG" > saas_config
|
|
199
|
+
- cp deploy/helm/values.yaml deploy/helm/values.stage.yaml
|
|
200
|
+
- sed -i "s/<<ENV_TYPE>>/stage/g" deploy/helm/values.stage.yaml
|
|
201
|
+
- sed -i "s/<<APP_PREFIX>>/-stage/g" deploy/helm/values.stage.yaml
|
|
202
|
+
- sed -i "s/<<HOST_PREFIX>>/stage/g" deploy/helm/values.stage.yaml
|
|
203
|
+
- helm template deploy/helm --values deploy/helm/values.stage.yaml
|
|
204
|
+
- helm template deploy/helm --values deploy/helm/values.stage.yaml | kubectl --kubeconfig=saas_config apply -f -
|
|
205
|
+
when:
|
|
206
|
+
ref:
|
|
207
|
+
include:
|
|
208
|
+
- refs/tags/stage-*
|
|
209
|
+
|
|
210
|
+
- name: deploy-to-stable
|
|
211
|
+
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/deploy-helm:latest # dtzar/helm-kubectl
|
|
212
|
+
environment:
|
|
213
|
+
SAAS_K8S_CONFIG:
|
|
214
|
+
from_secret: saas-k8s-config
|
|
215
|
+
commands:
|
|
216
|
+
- echo "$SAAS_K8S_CONFIG" > saas_config
|
|
217
|
+
- cp deploy/helm/values.yaml deploy/helm/values.test.yaml
|
|
218
|
+
- sed -i "s/<<ENV_TYPE>>/test/g" deploy/helm/values.test.yaml
|
|
219
|
+
- sed -i "s/<<APP_PREFIX>>/-stable/g" deploy/helm/values.test.yaml
|
|
220
|
+
- sed -i "s/<<HOST_PREFIX>>/*/g" deploy/helm/values.test.yaml
|
|
221
|
+
- helm template deploy/helm --values deploy/helm/values.test.yaml
|
|
222
|
+
- helm template deploy/helm --values deploy/helm/values.test.yaml | kubectl --kubeconfig=saas_config apply -f -
|
|
223
|
+
when:
|
|
224
|
+
ref:
|
|
225
|
+
include:
|
|
226
|
+
- refs/tags/release-*
|
|
227
|
+
|
|
228
|
+
- name: deploy-to-prod
|
|
229
|
+
image: xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/deploy-helm:latest # dtzar/helm-kubectl
|
|
230
|
+
environment:
|
|
231
|
+
SAAS_K8S_CONFIG:
|
|
232
|
+
from_secret: saas-k8s-config
|
|
233
|
+
commands:
|
|
234
|
+
- echo "$SAAS_K8S_CONFIG" > saas_config
|
|
235
|
+
- cp deploy/helm/values.yaml deploy/helm/values.prod.yaml
|
|
236
|
+
- sed -i "s/<<ENV_TYPE>>/prod/g" deploy/helm/values.prod.yaml
|
|
237
|
+
- sed -i "s/<<APP_PREFIX>>//g" deploy/helm/values.prod.yaml
|
|
238
|
+
- sed -i "s/<<HOST_PREFIX>>//g" deploy/helm/values.prod.yaml
|
|
239
|
+
- helm template deploy/helm --values deploy/helm/values.prod.yaml
|
|
240
|
+
- helm template deploy/helm --values deploy/helm/values.prod.yaml | kubectl --kubeconfig=saas_config apply -f -
|
|
241
|
+
when:
|
|
242
|
+
ref:
|
|
243
|
+
include:
|
|
244
|
+
- refs/tags/release-*
|
|
245
|
+
|
|
246
|
+
volumes:
|
|
247
|
+
- name: socks
|
|
248
|
+
host:
|
|
249
|
+
path: /var/run
|
|
250
|
+
- name: docker
|
|
251
|
+
host:
|
|
252
|
+
path: /var/lib/docker
|
|
253
|
+
- name: node-modules
|
|
254
|
+
host:
|
|
255
|
+
path: /var/lib/node/${DRONE_REPO_NAME}-node-modules
|
|
256
|
+
- name: node-modules-docs
|
|
257
|
+
host:
|
|
258
|
+
path: /var/lib/node/${DRONE_REPO_NAME}-node-modules-dumi-docs
|
|
259
|
+
|
|
260
|
+
image_pull_secrets:
|
|
261
|
+
- docker-key
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
kind: secret
|
|
265
|
+
name: saas-k8s-config
|
|
266
|
+
get:
|
|
267
|
+
path: saas-k8s-config
|
|
268
|
+
name: config
|
|
269
|
+
---
|
|
270
|
+
kind: secret
|
|
271
|
+
name: ssh-key
|
|
272
|
+
get:
|
|
273
|
+
path: deployer-ssh-key
|
|
274
|
+
name: id_rsa
|
|
275
|
+
---
|
|
276
|
+
kind: secret
|
|
277
|
+
name: docker-key
|
|
278
|
+
get:
|
|
279
|
+
path: docker-key
|
|
280
|
+
name: config
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
FROM xhj-prod-registry.cn-hangzhou.cr.aliyuncs.com/xhj-image-common/nginx-base
|
|
2
|
+
|
|
3
|
+
WORKDIR /code/www/deploy/webroot/app/current
|
|
4
|
+
|
|
5
|
+
COPY build/h5 ./
|
|
6
|
+
|
|
7
|
+
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
|
|
8
|
+
|
|
9
|
+
# 拷贝静态文件
|
|
10
|
+
COPY deploy/static ./
|
|
11
|
+
|
|
12
|
+
# 拷贝docs文档文件
|
|
13
|
+
# https://cloud.tencent.com/developer/ask/sof/108832342
|
|
14
|
+
COPY build/doc[s] ./docs
|
package/deploy/env.sh
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# 本脚本将 HOST_PREFIX 与 tag 转化为 API_ENV 简化配置
|
|
4
|
+
# test环境使用drone的custom事件注入HOST_PREFIX区分环境
|
|
5
|
+
# 其他环境使用git tag 前缀区分环境
|
|
6
|
+
|
|
7
|
+
if [[ $HOST_PREFIX =~ ^test.* ]]
|
|
8
|
+
then
|
|
9
|
+
# 匹配到hostPrefix 则认为test环境
|
|
10
|
+
API_ENV=$HOST_PREFIX
|
|
11
|
+
elif [[ $DRONE_COMMIT_REF =~ ^refs/tags/([^-]+).* ]]
|
|
12
|
+
then
|
|
13
|
+
# 匹配到tag 取出前缀 进行比较
|
|
14
|
+
TAG_PREV=${BASH_REMATCH[1]}
|
|
15
|
+
|
|
16
|
+
API_ENV=$([ "$TAG_PREV" == "release" ] && echo 'prod' || echo "$TAG_PREV")
|
|
17
|
+
else
|
|
18
|
+
# 兜底 生产环境
|
|
19
|
+
API_ENV=prod
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
export API_ENV=$API_ENV
|
|
23
|
+
|
|
24
|
+
echo $API_ENV
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: Deployment
|
|
3
|
+
metadata:
|
|
4
|
+
name: {{ $.Values.app }}
|
|
5
|
+
namespace: {{ include "tpl.namespace" . }}
|
|
6
|
+
annotations:
|
|
7
|
+
kubernetes.io/change-cause: {{ or $.Values.tagContent $.Values.commitSHA }}
|
|
8
|
+
spec:
|
|
9
|
+
strategy:
|
|
10
|
+
type: RollingUpdate
|
|
11
|
+
rollingUpdate:
|
|
12
|
+
maxSurge: 2
|
|
13
|
+
maxUnavailable: 50%
|
|
14
|
+
replicas: {{ if eq $.Values.envType "prod" }} 2 {{ else }} 1 {{ end }}
|
|
15
|
+
selector:
|
|
16
|
+
matchLabels:
|
|
17
|
+
app: {{ $.Values.app }}
|
|
18
|
+
template:
|
|
19
|
+
metadata:
|
|
20
|
+
labels:
|
|
21
|
+
app: {{ $.Values.app }}
|
|
22
|
+
spec:
|
|
23
|
+
imagePullSecrets:
|
|
24
|
+
- name: {{ $.Values.imagePullSecret }}
|
|
25
|
+
containers:
|
|
26
|
+
- name: server
|
|
27
|
+
imagePullPolicy: Always
|
|
28
|
+
image: "{{ $.Values.image }}"
|
|
29
|
+
resources:
|
|
30
|
+
requests:
|
|
31
|
+
cpu: "0.01"
|
|
32
|
+
memory: "100Mi"
|
|
33
|
+
{{if $.Values.hostPrefix}}
|
|
34
|
+
env:
|
|
35
|
+
- name: HOST_PREFIX
|
|
36
|
+
value: "{{ $.Values.hostPrefix }}"
|
|
37
|
+
{{end}}
|
|
38
|
+
envFrom:
|
|
39
|
+
- configMapRef:
|
|
40
|
+
name: "app-common-config"
|
|
41
|
+
volumeMounts:
|
|
42
|
+
- mountPath: /var/log/nginx
|
|
43
|
+
subPath: "xfe/{{ $.Values.app }}"
|
|
44
|
+
name: log
|
|
45
|
+
command:
|
|
46
|
+
- bash
|
|
47
|
+
- "-c"
|
|
48
|
+
- |
|
|
49
|
+
nginx
|
|
50
|
+
while :
|
|
51
|
+
do
|
|
52
|
+
sleep 10
|
|
53
|
+
done
|
|
54
|
+
volumes:
|
|
55
|
+
- name: log
|
|
56
|
+
hostPath:
|
|
57
|
+
path: /var/log
|
|
58
|
+
---
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
{{- define "tpl.namespace" -}}
|
|
2
|
+
{{ if eq $.Values.envType "dev" }} deployment-dev {{ else if eq $.Values.envType "test" }} deployment-test {{ else if eq $.Values.envType "stage" }} deployment-stage {{ else if eq $.Values.envType "beta" }} deployment-beta {{ else if eq $.Values.envType "prod" }} deployment-prod {{ else if eq $.Values.envType "apitest" }} ci-apitest {{ else }} deployment-test {{ end }}
|
|
3
|
+
{{- end -}}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
apiVersion: networking.istio.io/v1alpha3
|
|
2
|
+
kind: VirtualService
|
|
3
|
+
metadata:
|
|
4
|
+
name: {{ $.Values.app }}-vs
|
|
5
|
+
namespace: {{ include "tpl.namespace" . }}
|
|
6
|
+
spec:
|
|
7
|
+
hosts:
|
|
8
|
+
{{- $host := (get $.Values.hosts $.Values.envType) }}
|
|
9
|
+
{{- range $host }}
|
|
10
|
+
- "{{ . }}"
|
|
11
|
+
{{- end }}
|
|
12
|
+
gateways:
|
|
13
|
+
{{- range $.Values.gateways }}
|
|
14
|
+
- {{ . }}
|
|
15
|
+
{{- end }}
|
|
16
|
+
http:
|
|
17
|
+
{{ range $.Values.matchRedirect }}
|
|
18
|
+
- match:
|
|
19
|
+
- uri:
|
|
20
|
+
exact: {{ .from }}
|
|
21
|
+
redirect:
|
|
22
|
+
uri: {{ .to }}
|
|
23
|
+
{{- $host := (get $.Values.hosts $.Values.envType) }}
|
|
24
|
+
authority: "{{ index $host 0 }}"
|
|
25
|
+
{{- end }}
|
|
26
|
+
- match:
|
|
27
|
+
- uri:
|
|
28
|
+
prefix: /
|
|
29
|
+
route:
|
|
30
|
+
- destination:
|
|
31
|
+
host: {{ $.Values.app }}
|
|
32
|
+
port:
|
|
33
|
+
number: 80
|
|
34
|
+
corsPolicy:
|
|
35
|
+
allowOrigin:
|
|
36
|
+
- "*"
|
|
37
|
+
allowMethods:
|
|
38
|
+
- "*"
|
|
39
|
+
---
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
imagePullSecret: 'docker-image-cr-pull-vpc'
|
|
2
|
+
app: '<<APP_NAME>><<APP_PREFIX>>'
|
|
3
|
+
image: 'xhj-prod-registry-vpc.cn-hangzhou.cr.aliyuncs.com/xhj-image/<<APP_NAME>>:<<CI_COMMIT_SHA>>'
|
|
4
|
+
tagContent: '<<TAG_CONTENT>>'
|
|
5
|
+
commitSHA: '<<CI_COMMIT_SHA>>'
|
|
6
|
+
envType: '<<ENV_TYPE>>'
|
|
7
|
+
hostPrefix: '<<HOST_PREFIX>>'
|
|
8
|
+
hosts:
|
|
9
|
+
test:
|
|
10
|
+
- '<<HOST_PREFIX>>.m.t.eshetang.com'
|
|
11
|
+
stage:
|
|
12
|
+
- stage.m.t.eshetang.com
|
|
13
|
+
prod:
|
|
14
|
+
- m.eshetang.com
|
|
15
|
+
- m-o.eshetang.com
|
|
16
|
+
gateways:
|
|
17
|
+
- common-gateway-eshetang
|
|
18
|
+
matchRedirect:
|
|
19
|
+
- from: /psisdi
|
|
20
|
+
to: /pages/stock/inventory/stock/detail/index
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
server {
|
|
2
|
+
listen 80;
|
|
3
|
+
listen [::]:80;
|
|
4
|
+
|
|
5
|
+
server_name -;
|
|
6
|
+
root /code/www/deploy/webroot/app/current;
|
|
7
|
+
|
|
8
|
+
set $apiEnv test;
|
|
9
|
+
|
|
10
|
+
if ( $host ~* ^(?<hostPrefix>[^.]+)?\.?(?<subDomain>.*?)\.?(?<domain>[^.]+)\.(?<ltd>[a-zA-Z]+)$ ) {
|
|
11
|
+
set $apiEnv $hostPrefix;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if ( $hostPrefix !~* (test|beta|stage) ) {
|
|
15
|
+
set $apiEnv prod;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
set $file /index.html;
|
|
19
|
+
|
|
20
|
+
location ^~ /docs {
|
|
21
|
+
alias /code/www/deploy/webroot/app/current/docs;
|
|
22
|
+
|
|
23
|
+
try_files $uri $uri/ $file;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
location ~* /static {}
|
|
27
|
+
|
|
28
|
+
location ~* .(png|jpeg|jpg|ico|webp|gif|js|css)$ {}
|
|
29
|
+
|
|
30
|
+
# 屏蔽掉map文件
|
|
31
|
+
location ~ .*\.map {
|
|
32
|
+
return 404;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
location / {
|
|
36
|
+
try_files $uri $file;
|
|
37
|
+
|
|
38
|
+
add_header Cache-Control no-cache;
|
|
39
|
+
add_header Set-Cookie "apiEnv=${apiEnv}; Max-Age=2626560; Path=/;";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a20aacdde689e014f54b1812a0a5a320
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang='zh'>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset='UTF-8'>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta name="viewport"
|
|
7
|
+
content="width=device-width, initial-scale=1, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
|
|
8
|
+
<meta name="apple-touch-fullscreen" content="yes">
|
|
9
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
10
|
+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
11
|
+
<meta name="format-detection" content="telephone=no">
|
|
12
|
+
<meta name="x5-fullscreen" content="true">
|
|
13
|
+
<meta name="full-screen" content="yes">
|
|
14
|
+
<meta name="theme-color" content="#000000">
|
|
15
|
+
<link rel="shortcut icon" href="./favicon.ico">
|
|
16
|
+
<title>易奢堂-小程序</title>
|
|
17
|
+
</head>
|
|
18
|
+
<body>
|
|
19
|
+
易奢堂-小程序
|
|
20
|
+
</body>
|
|
21
|
+
</html>
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function _array_like_to_array(arr, len) {
|
|
3
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
4
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5
|
+
return arr2;
|
|
6
|
+
}
|
|
7
|
+
function _array_with_holes(arr) {
|
|
8
|
+
if (Array.isArray(arr)) return arr;
|
|
9
|
+
}
|
|
10
|
+
function _define_property(obj, key, value) {
|
|
11
|
+
if (key in obj) {
|
|
12
|
+
Object.defineProperty(obj, key, {
|
|
13
|
+
value: value,
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true
|
|
17
|
+
});
|
|
18
|
+
} else {
|
|
19
|
+
obj[key] = value;
|
|
20
|
+
}
|
|
21
|
+
return obj;
|
|
22
|
+
}
|
|
23
|
+
function _iterable_to_array_limit(arr, i) {
|
|
24
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
25
|
+
if (_i == null) return;
|
|
26
|
+
var _arr = [];
|
|
27
|
+
var _n = true;
|
|
28
|
+
var _d = false;
|
|
29
|
+
var _s, _e;
|
|
30
|
+
try {
|
|
31
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
32
|
+
_arr.push(_s.value);
|
|
33
|
+
if (i && _arr.length === i) break;
|
|
34
|
+
}
|
|
35
|
+
} catch (err) {
|
|
36
|
+
_d = true;
|
|
37
|
+
_e = err;
|
|
38
|
+
} finally{
|
|
39
|
+
try {
|
|
40
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
41
|
+
} finally{
|
|
42
|
+
if (_d) throw _e;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return _arr;
|
|
46
|
+
}
|
|
47
|
+
function _non_iterable_rest() {
|
|
48
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
49
|
+
}
|
|
50
|
+
function _object_spread(target) {
|
|
51
|
+
for(var i = 1; i < arguments.length; i++){
|
|
52
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
53
|
+
var ownKeys = Object.keys(source);
|
|
54
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
55
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
56
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
ownKeys.forEach(function(key) {
|
|
60
|
+
_define_property(target, key, source[key]);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return target;
|
|
64
|
+
}
|
|
65
|
+
function ownKeys(object, enumerableOnly) {
|
|
66
|
+
var keys = Object.keys(object);
|
|
67
|
+
if (Object.getOwnPropertySymbols) {
|
|
68
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
69
|
+
if (enumerableOnly) {
|
|
70
|
+
symbols = symbols.filter(function(sym) {
|
|
71
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
keys.push.apply(keys, symbols);
|
|
75
|
+
}
|
|
76
|
+
return keys;
|
|
77
|
+
}
|
|
78
|
+
function _object_spread_props(target, source) {
|
|
79
|
+
source = source != null ? source : {};
|
|
80
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
81
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
82
|
+
} else {
|
|
83
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
84
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return target;
|
|
88
|
+
}
|
|
89
|
+
function _object_without_properties(source, excluded) {
|
|
90
|
+
if (source == null) return {};
|
|
91
|
+
var target = _object_without_properties_loose(source, excluded);
|
|
92
|
+
var key, i;
|
|
93
|
+
if (Object.getOwnPropertySymbols) {
|
|
94
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
95
|
+
for(i = 0; i < sourceSymbolKeys.length; i++){
|
|
96
|
+
key = sourceSymbolKeys[i];
|
|
97
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
98
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
99
|
+
target[key] = source[key];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return target;
|
|
103
|
+
}
|
|
104
|
+
function _object_without_properties_loose(source, excluded) {
|
|
105
|
+
if (source == null) return {};
|
|
106
|
+
var target = {};
|
|
107
|
+
var sourceKeys = Object.keys(source);
|
|
108
|
+
var key, i;
|
|
109
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
110
|
+
key = sourceKeys[i];
|
|
111
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
112
|
+
target[key] = source[key];
|
|
113
|
+
}
|
|
114
|
+
return target;
|
|
115
|
+
}
|
|
116
|
+
function _sliced_to_array(arr, i) {
|
|
117
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
118
|
+
}
|
|
119
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
120
|
+
if (!o) return;
|
|
121
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
122
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
123
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
124
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
125
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
126
|
+
}
|
|
127
|
+
var __create = Object.create;
|
|
128
|
+
var __defProp = Object.defineProperty;
|
|
129
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
130
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
131
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
132
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
133
|
+
var __esm = function(fn, res) {
|
|
134
|
+
return function __init() {
|
|
135
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
var __copyProps = function(to, from, except, desc) {
|
|
139
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
140
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
141
|
+
try {
|
|
142
|
+
var _loop = function() {
|
|
143
|
+
var key = _step.value;
|
|
144
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
145
|
+
get: function() {
|
|
146
|
+
return from[key];
|
|
147
|
+
},
|
|
148
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
152
|
+
} catch (err) {
|
|
153
|
+
_didIteratorError = true;
|
|
154
|
+
_iteratorError = err;
|
|
155
|
+
} finally{
|
|
156
|
+
try {
|
|
157
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
158
|
+
_iterator.return();
|
|
159
|
+
}
|
|
160
|
+
} finally{
|
|
161
|
+
if (_didIteratorError) {
|
|
162
|
+
throw _iteratorError;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return to;
|
|
168
|
+
};
|
|
169
|
+
var __toESM = function(mod, isNodeMode, target) {
|
|
170
|
+
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
171
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
172
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
173
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
174
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
175
|
+
value: mod,
|
|
176
|
+
enumerable: true
|
|
177
|
+
}) : target, mod);
|
|
178
|
+
};
|
|
179
|
+
// src/config.ts
|
|
180
|
+
var config_exports = {};
|
|
181
|
+
var import_path, import_fs, import_yaml, configDeploy;
|
|
182
|
+
var init_config = __esm({
|
|
183
|
+
"src/config.ts": function() {
|
|
184
|
+
"use strict";
|
|
185
|
+
import_path = __toESM(require("path"));
|
|
186
|
+
import_fs = __toESM(require("fs"));
|
|
187
|
+
import_yaml = __toESM(require("yaml"));
|
|
188
|
+
configDeploy = function() {
|
|
189
|
+
var xfeConfig = JSON.parse(import_fs.default.readFileSync("./xfe.json", "utf8"));
|
|
190
|
+
if (!(xfeConfig === null || xfeConfig === void 0 ? void 0 : xfeConfig.deploy)) return;
|
|
191
|
+
var droneConfigFilePath = import_path.default.resolve(__dirname, "../deploy/.drone.yml");
|
|
192
|
+
import_fs.default.cpSync(droneConfigFilePath, xfeConfig.deploy.droneConfigPath || "./.drone.yml");
|
|
193
|
+
var valuesYamlFilePath = import_path.default.resolve(__dirname, "../deploy/helm/values.yaml");
|
|
194
|
+
var valuesYamlFile = import_fs.default.readFileSync(valuesYamlFilePath, "utf8");
|
|
195
|
+
var valuesYaml = import_yaml.default.parse(valuesYamlFile);
|
|
196
|
+
if (!valuesYaml.virtualService) valuesYaml.virtualService = {};
|
|
197
|
+
if (!valuesYaml.virtualService.hosts) valuesYaml.virtualService.hosts = {
|
|
198
|
+
test: [],
|
|
199
|
+
stage: [],
|
|
200
|
+
prod: []
|
|
201
|
+
};
|
|
202
|
+
var _xfeConfig_deploy = xfeConfig.deploy, _xfeConfig_deploy_virtualServiceEnabled = _xfeConfig_deploy.virtualServiceEnabled, virtualServiceEnabled = _xfeConfig_deploy_virtualServiceEnabled === void 0 ? true : _xfeConfig_deploy_virtualServiceEnabled, _xfeConfig_deploy_hostsProd = _xfeConfig_deploy.hostsProd, hostsProd = _xfeConfig_deploy_hostsProd === void 0 ? [] : _xfeConfig_deploy_hostsProd, _xfeConfig_deploy_hostsStage = _xfeConfig_deploy.hostsStage, hostsStage = _xfeConfig_deploy_hostsStage === void 0 ? [] : _xfeConfig_deploy_hostsStage, _xfeConfig_deploy_hostsTest = _xfeConfig_deploy.hostsTest, hostsTest = _xfeConfig_deploy_hostsTest === void 0 ? [] : _xfeConfig_deploy_hostsTest, _xfeConfig_deploy_gateways = _xfeConfig_deploy.gateways, gateways = _xfeConfig_deploy_gateways === void 0 ? [
|
|
203
|
+
"common-gateway-eshetang"
|
|
204
|
+
] : _xfeConfig_deploy_gateways;
|
|
205
|
+
var _xfeConfig_deploy1 = xfeConfig.deploy, _xfeConfig_deploy_targetK8s = _xfeConfig_deploy1.targetK8s, targetK8s = _xfeConfig_deploy_targetK8s === void 0 ? "saas" : _xfeConfig_deploy_targetK8s, _xfeConfig_deploy_targetNamespace = _xfeConfig_deploy1.targetNamespace, targetNamespace = _xfeConfig_deploy_targetNamespace === void 0 ? "" : _xfeConfig_deploy_targetNamespace;
|
|
206
|
+
valuesYaml.virtualService.enabled = virtualServiceEnabled;
|
|
207
|
+
valuesYaml.virtualService.gateways = gateways;
|
|
208
|
+
valuesYaml.virtualService.hosts.prod = hostsProd;
|
|
209
|
+
valuesYaml.virtualService.hosts.stage = hostsStage;
|
|
210
|
+
valuesYaml.virtualService.hosts.test = hostsTest;
|
|
211
|
+
valuesYaml.targetK8s = targetK8s;
|
|
212
|
+
valuesYaml.namespace = targetNamespace;
|
|
213
|
+
var valuesYamlStr = import_yaml.default.stringify(valuesYaml, {
|
|
214
|
+
defaultStringType: "QUOTE_SINGLE",
|
|
215
|
+
defaultKeyType: "PLAIN"
|
|
216
|
+
});
|
|
217
|
+
import_fs.default.writeFileSync(valuesYamlFilePath, valuesYamlStr, "utf8");
|
|
218
|
+
};
|
|
219
|
+
configDeploy();
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
// src/cli.ts
|
|
223
|
+
var import_minimist = __toESM(require("minimist"));
|
|
224
|
+
var import_path2 = __toESM(require("path"));
|
|
225
|
+
var import_child_process = require("child_process");
|
|
226
|
+
var argv = (0, import_minimist.default)(process.argv.slice(2));
|
|
227
|
+
var commands = argv._, args = _object_without_properties(argv, [
|
|
228
|
+
"_"
|
|
229
|
+
]);
|
|
230
|
+
var _commands = _sliced_to_array(commands, 1), command = _commands[0];
|
|
231
|
+
var appPackageRoot = import_path2.default.resolve(__dirname, "../");
|
|
232
|
+
var appProjectRoot = process.cwd();
|
|
233
|
+
var env = _object_spread_props(_object_spread({}, process.env), {
|
|
234
|
+
APP_PROJECT_ROOT: appProjectRoot
|
|
235
|
+
});
|
|
236
|
+
var argsString = Object.entries(args).map(function(param) {
|
|
237
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
238
|
+
return "--".concat(key, "=").concat(value);
|
|
239
|
+
}).join(" ");
|
|
240
|
+
if (command === "dev") {
|
|
241
|
+
(0, import_child_process.execSync)("taro build --watch ".concat(argsString), {
|
|
242
|
+
stdio: "inherit",
|
|
243
|
+
cwd: appPackageRoot,
|
|
244
|
+
env: env
|
|
245
|
+
});
|
|
246
|
+
} else if (command === "build") {
|
|
247
|
+
(0, import_child_process.execSync)("taro build ".concat(argsString), {
|
|
248
|
+
stdio: "inherit",
|
|
249
|
+
cwd: appPackageRoot,
|
|
250
|
+
env: env
|
|
251
|
+
});
|
|
252
|
+
} else if (command === "config") {
|
|
253
|
+
Promise.resolve().then(function() {
|
|
254
|
+
return init_config();
|
|
255
|
+
});
|
|
256
|
+
}
|
package/dist/config.d.ts
ADDED
package/dist/config.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = function(to, from, except, desc) {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
11
|
+
try {
|
|
12
|
+
var _loop = function() {
|
|
13
|
+
var key = _step.value;
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
15
|
+
get: function() {
|
|
16
|
+
return from[key];
|
|
17
|
+
},
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
22
|
+
} catch (err) {
|
|
23
|
+
_didIteratorError = true;
|
|
24
|
+
_iteratorError = err;
|
|
25
|
+
} finally{
|
|
26
|
+
try {
|
|
27
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
28
|
+
_iterator.return();
|
|
29
|
+
}
|
|
30
|
+
} finally{
|
|
31
|
+
if (_didIteratorError) {
|
|
32
|
+
throw _iteratorError;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return to;
|
|
38
|
+
};
|
|
39
|
+
var __toESM = function(mod, isNodeMode, target) {
|
|
40
|
+
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
41
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
42
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
43
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
44
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
45
|
+
value: mod,
|
|
46
|
+
enumerable: true
|
|
47
|
+
}) : target, mod);
|
|
48
|
+
};
|
|
49
|
+
// src/config.ts
|
|
50
|
+
var import_path = __toESM(require("path"));
|
|
51
|
+
var import_fs = __toESM(require("fs"));
|
|
52
|
+
var import_yaml = __toESM(require("yaml"));
|
|
53
|
+
var configDeploy = function() {
|
|
54
|
+
var xfeConfig = JSON.parse(import_fs.default.readFileSync("./xfe.json", "utf8"));
|
|
55
|
+
if (!(xfeConfig === null || xfeConfig === void 0 ? void 0 : xfeConfig.deploy)) return;
|
|
56
|
+
var droneConfigFilePath = import_path.default.resolve(__dirname, "../deploy/.drone.yml");
|
|
57
|
+
import_fs.default.cpSync(droneConfigFilePath, xfeConfig.deploy.droneConfigPath || "./.drone.yml");
|
|
58
|
+
var valuesYamlFilePath = import_path.default.resolve(__dirname, "../deploy/helm/values.yaml");
|
|
59
|
+
var valuesYamlFile = import_fs.default.readFileSync(valuesYamlFilePath, "utf8");
|
|
60
|
+
var valuesYaml = import_yaml.default.parse(valuesYamlFile);
|
|
61
|
+
if (!valuesYaml.virtualService) valuesYaml.virtualService = {};
|
|
62
|
+
if (!valuesYaml.virtualService.hosts) valuesYaml.virtualService.hosts = {
|
|
63
|
+
test: [],
|
|
64
|
+
stage: [],
|
|
65
|
+
prod: []
|
|
66
|
+
};
|
|
67
|
+
var _xfeConfig_deploy = xfeConfig.deploy, _xfeConfig_deploy_virtualServiceEnabled = _xfeConfig_deploy.virtualServiceEnabled, virtualServiceEnabled = _xfeConfig_deploy_virtualServiceEnabled === void 0 ? true : _xfeConfig_deploy_virtualServiceEnabled, _xfeConfig_deploy_hostsProd = _xfeConfig_deploy.hostsProd, hostsProd = _xfeConfig_deploy_hostsProd === void 0 ? [] : _xfeConfig_deploy_hostsProd, _xfeConfig_deploy_hostsStage = _xfeConfig_deploy.hostsStage, hostsStage = _xfeConfig_deploy_hostsStage === void 0 ? [] : _xfeConfig_deploy_hostsStage, _xfeConfig_deploy_hostsTest = _xfeConfig_deploy.hostsTest, hostsTest = _xfeConfig_deploy_hostsTest === void 0 ? [] : _xfeConfig_deploy_hostsTest, _xfeConfig_deploy_gateways = _xfeConfig_deploy.gateways, gateways = _xfeConfig_deploy_gateways === void 0 ? [
|
|
68
|
+
"common-gateway-eshetang"
|
|
69
|
+
] : _xfeConfig_deploy_gateways;
|
|
70
|
+
var _xfeConfig_deploy1 = xfeConfig.deploy, _xfeConfig_deploy_targetK8s = _xfeConfig_deploy1.targetK8s, targetK8s = _xfeConfig_deploy_targetK8s === void 0 ? "saas" : _xfeConfig_deploy_targetK8s, _xfeConfig_deploy_targetNamespace = _xfeConfig_deploy1.targetNamespace, targetNamespace = _xfeConfig_deploy_targetNamespace === void 0 ? "" : _xfeConfig_deploy_targetNamespace;
|
|
71
|
+
valuesYaml.virtualService.enabled = virtualServiceEnabled;
|
|
72
|
+
valuesYaml.virtualService.gateways = gateways;
|
|
73
|
+
valuesYaml.virtualService.hosts.prod = hostsProd;
|
|
74
|
+
valuesYaml.virtualService.hosts.stage = hostsStage;
|
|
75
|
+
valuesYaml.virtualService.hosts.test = hostsTest;
|
|
76
|
+
valuesYaml.targetK8s = targetK8s;
|
|
77
|
+
valuesYaml.namespace = targetNamespace;
|
|
78
|
+
var valuesYamlStr = import_yaml.default.stringify(valuesYaml, {
|
|
79
|
+
defaultStringType: "QUOTE_SINGLE",
|
|
80
|
+
defaultKeyType: "PLAIN"
|
|
81
|
+
});
|
|
82
|
+
import_fs.default.writeFileSync(valuesYamlFilePath, valuesYamlStr, "utf8");
|
|
83
|
+
};
|
|
84
|
+
configDeploy();
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = function(target, all) {
|
|
9
|
+
for(var name in all)__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = function(to, from, except, desc) {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
17
|
+
try {
|
|
18
|
+
var _loop = function() {
|
|
19
|
+
var key = _step.value;
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
21
|
+
get: function() {
|
|
22
|
+
return from[key];
|
|
23
|
+
},
|
|
24
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
for(var _iterator = __getOwnPropNames(from)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)_loop();
|
|
28
|
+
} catch (err) {
|
|
29
|
+
_didIteratorError = true;
|
|
30
|
+
_iteratorError = err;
|
|
31
|
+
} finally{
|
|
32
|
+
try {
|
|
33
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
34
|
+
_iterator.return();
|
|
35
|
+
}
|
|
36
|
+
} finally{
|
|
37
|
+
if (_didIteratorError) {
|
|
38
|
+
throw _iteratorError;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return to;
|
|
44
|
+
};
|
|
45
|
+
var __toESM = function(mod, isNodeMode, target) {
|
|
46
|
+
return target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(// If the importer is in node compatibility mode or this is not an ESM
|
|
47
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
48
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
49
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
50
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
51
|
+
value: mod,
|
|
52
|
+
enumerable: true
|
|
53
|
+
}) : target, mod);
|
|
54
|
+
};
|
|
55
|
+
var __toCommonJS = function(mod) {
|
|
56
|
+
return __copyProps(__defProp({}, "__esModule", {
|
|
57
|
+
value: true
|
|
58
|
+
}), mod);
|
|
59
|
+
};
|
|
60
|
+
// src/index.ts
|
|
61
|
+
var src_exports = {};
|
|
62
|
+
__export(src_exports, {
|
|
63
|
+
default: function() {
|
|
64
|
+
return src_default;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
module.exports = __toCommonJS(src_exports);
|
|
68
|
+
var import_taro = __toESM(require("@tarojs/taro"));
|
|
69
|
+
var src_default = import_taro.default;
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xfe-repo/mini-app",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"module": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"bin": {
|
|
7
|
+
"xfe-mini": "./bin/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"bin",
|
|
12
|
+
"config",
|
|
13
|
+
"deploy",
|
|
14
|
+
"scripts",
|
|
15
|
+
"tsconfig.json",
|
|
16
|
+
".eslintrc.js"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@babel/core": "^7.24.4",
|
|
20
|
+
"@babel/plugin-proposal-class-properties": "7.14.5",
|
|
21
|
+
"@babel/preset-react": "^7.24.1",
|
|
22
|
+
"@babel/runtime": "^7.21.5",
|
|
23
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
|
|
24
|
+
"@tarojs/cli": "4.0.8",
|
|
25
|
+
"@tarojs/components": "4.0.8",
|
|
26
|
+
"@tarojs/helper": "4.0.8",
|
|
27
|
+
"@tarojs/plugin-framework-react": "4.0.8",
|
|
28
|
+
"@tarojs/plugin-platform-h5": "4.0.8",
|
|
29
|
+
"@tarojs/plugin-platform-weapp": "4.0.8",
|
|
30
|
+
"@tarojs/react": "4.0.8",
|
|
31
|
+
"@tarojs/runtime": "4.0.8",
|
|
32
|
+
"@tarojs/shared": "4.0.8",
|
|
33
|
+
"@tarojs/taro": "4.0.8",
|
|
34
|
+
"@tarojs/taro-loader": "4.0.8",
|
|
35
|
+
"@tarojs/webpack5-runner": "4.0.8",
|
|
36
|
+
"@types/minimist": "^1.2.5",
|
|
37
|
+
"@types/node": "^18",
|
|
38
|
+
"@types/react": "^18.2.0",
|
|
39
|
+
"@types/webpack-env": "^1.13.6",
|
|
40
|
+
"babel-preset-taro": "4.0.8",
|
|
41
|
+
"eslint": "^8.57.0",
|
|
42
|
+
"eslint-config-taro": "4.0.8",
|
|
43
|
+
"eslint-plugin-react": "^7.34.1",
|
|
44
|
+
"eslint-plugin-react-hooks": "^4.4.0",
|
|
45
|
+
"fs-extra": "^11.2.0",
|
|
46
|
+
"less": "^4.2.0",
|
|
47
|
+
"minimist": "^1.2.8",
|
|
48
|
+
"postcss": "^8.4.38",
|
|
49
|
+
"react": "18.2.0",
|
|
50
|
+
"react-dom": "18.2.0",
|
|
51
|
+
"react-refresh": "^0.14.0",
|
|
52
|
+
"stylelint": "^16.4.0",
|
|
53
|
+
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
54
|
+
"typescript": "^5.4.5",
|
|
55
|
+
"webpack": "5.91.0",
|
|
56
|
+
"yaml": "^2.3.4"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsup",
|
|
60
|
+
"dev": "tsup --watch",
|
|
61
|
+
"lint": "eslint \"src/**/*.ts*\"",
|
|
62
|
+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// TODO: 待转换为TS 或 迁移到专用版本发布工具
|
|
2
|
+
|
|
3
|
+
const fs = require('fs')
|
|
4
|
+
const miniCI = require('miniprogram-ci')
|
|
5
|
+
const minimist = require('minimist')
|
|
6
|
+
|
|
7
|
+
const rwaPrivateKey = fs.readFileSync('scripts/private.key')
|
|
8
|
+
|
|
9
|
+
const rawProjectConfig = fs.readFileSync('project.config.json')
|
|
10
|
+
const projectConfig = JSON.parse(rawProjectConfig)
|
|
11
|
+
|
|
12
|
+
// 小程序项目实例
|
|
13
|
+
const project = new miniCI.Project({
|
|
14
|
+
appid: projectConfig.appid,
|
|
15
|
+
projectPath: projectConfig.miniprogramRoot,
|
|
16
|
+
privateKey: rwaPrivateKey,
|
|
17
|
+
type: 'miniProgram',
|
|
18
|
+
ignores: ['node_modules/**/*'],
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
// 小程序预览
|
|
22
|
+
async function preview(path = '', desc = '', scene = 1011, progress = false) {
|
|
23
|
+
const [pagePath, searchQuery] = path.split('?')
|
|
24
|
+
|
|
25
|
+
const robot = choiceRobot()
|
|
26
|
+
|
|
27
|
+
const onProgressUpdate = progress ? console.log : () => null
|
|
28
|
+
|
|
29
|
+
await miniCI.preview({
|
|
30
|
+
project,
|
|
31
|
+
qrcodeFormat: 'terminal',
|
|
32
|
+
qrcodeOutputDest: 'build/preview.qrcode.jpg',
|
|
33
|
+
pagePath,
|
|
34
|
+
searchQuery,
|
|
35
|
+
desc,
|
|
36
|
+
robot,
|
|
37
|
+
scene,
|
|
38
|
+
onProgressUpdate,
|
|
39
|
+
setting: { es6: true },
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 选择机器人方法 prod beta 1, stage 2, test 3 - 30
|
|
44
|
+
const choiceRobot = () => {
|
|
45
|
+
const { API_ENV = '' } = process.env
|
|
46
|
+
|
|
47
|
+
const { groups } = API_ENV.match(/^(?<env>prod|beta|stage|test)(?<sn>.*)/) || {}
|
|
48
|
+
|
|
49
|
+
let { env = 'other', sn = 2 } = groups || {}
|
|
50
|
+
let robot
|
|
51
|
+
|
|
52
|
+
switch (env) {
|
|
53
|
+
case 'prod':
|
|
54
|
+
case 'beta':
|
|
55
|
+
robot = 1
|
|
56
|
+
break
|
|
57
|
+
case 'stage':
|
|
58
|
+
robot = 2
|
|
59
|
+
break
|
|
60
|
+
case 'test':
|
|
61
|
+
robot = sn % 29 >= 3 ? sn % 29 : 3
|
|
62
|
+
break
|
|
63
|
+
case 'other':
|
|
64
|
+
robot = 30
|
|
65
|
+
break
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
console.log(`将使用CI${robot}机器人`)
|
|
69
|
+
|
|
70
|
+
return robot
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// -p --path 预览路径; --d --desc 版本描述; -s --scene 场景值; -P --progress 显示进程;
|
|
74
|
+
const argv = minimist(process.argv.slice(2))
|
|
75
|
+
|
|
76
|
+
const { p, path, d, desc, s, scene, P, progress } = argv
|
|
77
|
+
|
|
78
|
+
void preview(p || path, d || desc, s || scene, P || progress)
|
|
79
|
+
|
|
80
|
+
module.exports = { project, choiceRobot }
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// TODO: 待转换为TS 或 迁移到专用版本发布工具
|
|
2
|
+
|
|
3
|
+
const miniCI = require('miniprogram-ci')
|
|
4
|
+
const minimist = require('minimist')
|
|
5
|
+
|
|
6
|
+
const { project, choiceRobot } = require('./preview')
|
|
7
|
+
|
|
8
|
+
// 小程序上传
|
|
9
|
+
async function upload(version, desc = '', progress = false) {
|
|
10
|
+
if (!version) throw new Error('请传递版本号! -v 或者 --version')
|
|
11
|
+
|
|
12
|
+
const robot = choiceRobot()
|
|
13
|
+
|
|
14
|
+
const onProgressUpdate = progress ? console.log : () => null
|
|
15
|
+
|
|
16
|
+
await miniCI.upload({
|
|
17
|
+
project,
|
|
18
|
+
version,
|
|
19
|
+
robot,
|
|
20
|
+
desc,
|
|
21
|
+
onProgressUpdate,
|
|
22
|
+
setting: { es6: true },
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// 参数 -v --version 当前版本 必传; -d --desc 版本描述; -P --progress 显示进程;
|
|
27
|
+
const argv = minimist(process.argv.slice(2))
|
|
28
|
+
|
|
29
|
+
const { v, version, d, desc, P, progress } = argv
|
|
30
|
+
|
|
31
|
+
void upload(v || version, d || desc, P || progress)
|
package/tsconfig.json
ADDED