@cloudbase/cli 2.2.12 → 2.2.14
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/bin/cloudbase.js +1 -1
- package/bin/tcb.js +158 -270
- package/lib/commands/lowcode/comps.js +1 -3
- package/lib/commands/lowcode/utils.js +2 -1
- package/lib/utils/net/cloud-api-request.js +9 -9
- package/package.json +5 -5
- package/types/decorators/params/common.d.ts +1 -1
- package/types/types.d.ts +2 -2
- package/types/utils/config.d.ts +1 -1
- package/types/utils/fs/index.d.ts +1 -1
- package/types/utils/net/http-request.d.ts +3 -3
- package/types/utils/output/loading.d.ts +1 -1
- package/types/utils/parallel.d.ts +1 -1
- package/types/utils/validator.d.ts +1 -1
- package/.history/.gitignore_20220624162613 +0 -84
- package/.history/.gitignore_20220627114054 +0 -86
- package/.history/package_20230331190630.json +0 -89
- package/.history/package_20230331190744.json +0 -89
- package/.history/src/commands/lowcode/app_20220728111717.ts +0 -52
- package/.history/src/commands/lowcode/app_20220728112031.ts +0 -34
- package/.history/src/commands/lowcode/app_20220729172854.ts +0 -34
- package/.history/src/index_20220624162613.ts +0 -13
- package/.history/src/index_20220627113609.ts +0 -15
- package/.history/src/index_20220627114102.ts +0 -13
package/bin/cloudbase.js
CHANGED
package/bin/tcb.js
CHANGED
|
@@ -9,315 +9,205 @@ const logSymbols = require('log-symbols')
|
|
|
9
9
|
const didYouMean = require('didyoumean')
|
|
10
10
|
const updateNotifier = require('update-notifier')
|
|
11
11
|
const frameworkPkg = require('@cloudbase/framework-core/package.json')
|
|
12
|
-
const { CloudApiService } = require('@cloudbase/cloud-api')
|
|
13
|
-
const { getCredentialWithoutCheck } = require('@cloudbase/toolbox')
|
|
14
|
-
const { Confirm } = require('enquirer')
|
|
15
|
-
const execa = require('execa')
|
|
16
12
|
|
|
17
13
|
const pkg = require('../package.json')
|
|
18
14
|
const store = require('../lib/utils/store')
|
|
19
15
|
const { ALL_COMMANDS } = require('../lib/constant')
|
|
20
16
|
const { getProxy } = require('../lib/utils/net')
|
|
21
17
|
const { getCloudBaseConfig, getPrivateSettings } = require('../lib/utils/config')
|
|
22
|
-
const {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const regionSupported = ['ap-shanghai', 'ap-beijing', 'ap-guangzhou']
|
|
26
|
-
const regionSupportedMap = {
|
|
27
|
-
'ap-shanghai': '上海',
|
|
28
|
-
'ap-beijing': '北京',
|
|
29
|
-
'ap-guangzhou': '广州',
|
|
30
|
-
'sh': '上海',
|
|
31
|
-
'bj': '北京',
|
|
32
|
-
'gz': '广州'
|
|
33
|
-
}
|
|
18
|
+
const {registerCommands} = require('../lib')
|
|
34
19
|
|
|
35
20
|
async function main() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
let processArgv = process.argv
|
|
22
|
+
const isBeta = pkg.version.indexOf('-') > -1
|
|
23
|
+
process.CLI_VERSION = pkg.version
|
|
39
24
|
|
|
40
|
-
|
|
25
|
+
const [major, minor] = process.versions.node.split('.').slice(0, 2)
|
|
41
26
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
)
|
|
27
|
+
// Node 版本检验提示
|
|
28
|
+
if (Number(major) < 8 || (Number(major) === 8 && Number(minor) < 6)) {
|
|
29
|
+
console.log(
|
|
30
|
+
chalk.bold.red(
|
|
31
|
+
'您的 Node 版本较低,CloudBase CLI 可能无法正常运行,请升级 Node 到 v8.6.0 以上!\n'
|
|
48
32
|
)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// Sentry 错误上报
|
|
52
|
-
Sentry.init({
|
|
53
|
-
release: pkg.version,
|
|
54
|
-
dsn: 'https://fff0077d06624655ad70d1ee25df419e@report.url.cn/sentry/1782',
|
|
55
|
-
httpsProxy: getProxy() || '',
|
|
56
|
-
serverName: os.hostname(),
|
|
57
|
-
integrations: [
|
|
58
|
-
new Sentry.Integrations.OnUnhandledRejection({
|
|
59
|
-
mode: 'none'
|
|
60
|
-
})
|
|
61
|
-
]
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
// 输出版本信息
|
|
65
|
-
console.log(chalk.gray(`CloudBase CLI ${pkg.version}`))
|
|
66
|
-
console.log(chalk.gray(`CloudBase Framework ${frameworkPkg.version}`))
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const yargsParsedResult = yargsParser(process.argv.slice(2));
|
|
70
|
-
const config = await getCloudBaseConfig(yargsParsedResult.configFile);
|
|
71
|
-
const privateSettings = getPrivateSettings(config);
|
|
72
|
-
if (privateSettings) {
|
|
73
|
-
console.log(chalk.gray(`检测到私有化配置`))
|
|
74
|
-
if (privateSettings.endpoints && privateSettings.endpoints.cliApi) {
|
|
75
|
-
// 初始化 lowcode 服务cliapi入口
|
|
76
|
-
process.env.CLOUDBASE_LOWCODE_CLOUDAPI_URL = privateSettings.endpoints.cliApi;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
// 注册命令
|
|
81
|
-
await registerCommands()
|
|
33
|
+
)
|
|
34
|
+
}
|
|
82
35
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
36
|
+
// Sentry 错误上报
|
|
37
|
+
Sentry.init({
|
|
38
|
+
release: pkg.version,
|
|
39
|
+
dsn: 'https://fff0077d06624655ad70d1ee25df419e@report.url.cn/sentry/1782',
|
|
40
|
+
httpsProxy: getProxy() || '',
|
|
41
|
+
serverName: os.hostname(),
|
|
42
|
+
integrations: [
|
|
43
|
+
new Sentry.Integrations.OnUnhandledRejection({
|
|
44
|
+
mode: 'none'
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
})
|
|
95
48
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
program.option('--mode <mode>', '指定加载 env 文件的环境')
|
|
100
|
-
program.option('--config-file <path>', '设置配置文件,默认为 cloudbaserc.json')
|
|
101
|
-
program.option('-r, --region <region>', '指定环境地域')
|
|
49
|
+
// 输出版本信息
|
|
50
|
+
console.log(chalk.gray(`CloudBase CLI ${pkg.version}`))
|
|
51
|
+
console.log(chalk.gray(`CloudBase Framework ${frameworkPkg.version}`))
|
|
102
52
|
|
|
103
|
-
if (!privateSettings) {
|
|
104
|
-
// HACK: 隐藏自动生成的 help 信息
|
|
105
|
-
program.helpOption(false)
|
|
106
|
-
}
|
|
107
|
-
const isCommandEmpty = yargsParsedResult._.length === 0;
|
|
108
53
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
54
|
+
const yargsParsedResult = yargsParser(process.argv.slice(2));
|
|
55
|
+
const config = await getCloudBaseConfig(yargsParsedResult.configFile);
|
|
56
|
+
const privateSettings = getPrivateSettings(config);
|
|
57
|
+
if (privateSettings) {
|
|
58
|
+
console.log(chalk.gray(`检测到私有化配置`))
|
|
59
|
+
if(privateSettings.endpoints && privateSettings.endpoints.cliApi){
|
|
60
|
+
// 初始化 lowcode 服务cliapi入口
|
|
61
|
+
process.env.CLOUDBASE_LOWCODE_CLOUDAPI_URL = privateSettings.endpoints.cliApi;
|
|
116
62
|
}
|
|
117
63
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (!Array.isArray(args) || !args.length) {
|
|
122
|
-
return
|
|
123
|
-
}
|
|
124
|
-
const cmd = args.join(' ')
|
|
125
|
-
console.log(chalk.bold.red('Error: ') + `${cmd} 不是有效的命令`)
|
|
126
|
-
didYouMean.threshold = 0.5
|
|
127
|
-
didYouMean.caseSensitive = false
|
|
128
|
-
const suggest = didYouMean(cmd, ALL_COMMANDS)
|
|
129
|
-
if (suggest) {
|
|
130
|
-
console.log(chalk.bold(`\n您是不是想使用命令:tcb ${suggest}\n`))
|
|
131
|
-
}
|
|
132
|
-
console.log(`💡使用 ${chalk.bold('tcb -h')} 查看所有命令`)
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
// 没有使用命令
|
|
136
|
-
if (isCommandEmpty) {
|
|
137
|
-
if (privateSettings) {
|
|
138
|
-
program.outputHelp()
|
|
139
|
-
} else {
|
|
140
|
-
if (['-h', '--help'].includes(processArgv[2])) {
|
|
141
|
-
// 需要隐藏的选项
|
|
142
|
-
const hideArgs = ['-h', '--help']
|
|
143
|
-
hideArgs.forEach((arg) => {
|
|
144
|
-
const index = processArgv.indexOf(arg)
|
|
145
|
-
if (index > -1) {
|
|
146
|
-
processArgv.splice(index, 1)
|
|
147
|
-
}
|
|
148
|
-
})
|
|
149
|
-
const { outputHelpInfo } = require('../lib/help')
|
|
150
|
-
outputHelpInfo()
|
|
151
|
-
} else if (!['-v', '--version'].includes(processArgv[2])) {
|
|
152
|
-
// HACK: framework 智能命令
|
|
153
|
-
const { smartDeploy } = require('../lib')
|
|
154
|
-
smartDeploy()
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
64
|
+
}
|
|
65
|
+
// 注册命令
|
|
66
|
+
await registerCommands()
|
|
158
67
|
|
|
68
|
+
// 设置 Sentry 上报的用户 uin
|
|
69
|
+
Sentry.configureScope((scope) => {
|
|
159
70
|
try {
|
|
160
|
-
|
|
71
|
+
const credential = store.authStore.get('credential') || {}
|
|
72
|
+
scope.setUser({
|
|
73
|
+
uin: credential.uin || '',
|
|
74
|
+
ip: address.ip() || ''
|
|
75
|
+
})
|
|
161
76
|
} catch (e) {
|
|
162
|
-
|
|
163
|
-
console.log(errMsg)
|
|
77
|
+
Sentry.captureException(e)
|
|
164
78
|
}
|
|
79
|
+
})
|
|
165
80
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
// 忽略自定义错误的错误栈
|
|
173
|
-
if (err && err.stack && !stackIngoreErrors.includes(err.name)) {
|
|
174
|
-
console.log(err.stack)
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// 3 空格,兼容中文字符编码长度问题
|
|
178
|
-
if (err && err.message) {
|
|
179
|
-
let errMsg = logSymbols.error + ' ' + err.message
|
|
180
|
-
errMsg += err.requestId ? `\n${err.requestId}` : ''
|
|
181
|
-
console.log(errMsg)
|
|
182
|
-
|
|
183
|
-
// 多地域错误提示
|
|
184
|
-
if (errMsg.includes('Environment') && errMsg.includes('not found')) {
|
|
185
|
-
// 检查是否已经指定了 -r 或 --region 参数,如未指定则尝试获取地域信息
|
|
186
|
-
const regionSpecified = processArgv.indexOf('-r') !== -1 || processArgv.indexOf('--region') !== -1
|
|
187
|
-
const region = yargsParsedResult.r || yargsParsedResult.region
|
|
188
|
-
const multiRegionErrMsg = `\n此环境可能不属于当前账号,或为非${regionSupportedMap[region] || '上海'}地域环境,如需切换地域请追加参数(例:-r gz),请检查环境归属,参考多地域使用方法:https://docs.cloudbase.net/cli-v1/region.html`
|
|
189
|
-
if (!regionSpecified) {
|
|
81
|
+
// 设置 options 选项
|
|
82
|
+
program.storeOptionsAsProperties(false)
|
|
83
|
+
program.option('--verbose', '打印出内部运行信息')
|
|
84
|
+
program.option('--mode <mode>', '指定加载 env 文件的环境')
|
|
85
|
+
program.option('--config-file <path>', '设置配置文件,默认为 cloudbaserc.json')
|
|
86
|
+
program.option('-r, --region <region>', '指定环境地域')
|
|
190
87
|
|
|
191
|
-
|
|
192
|
-
|
|
88
|
+
if(!privateSettings) {
|
|
89
|
+
// HACK: 隐藏自动生成的 help 信息
|
|
90
|
+
program.helpOption(false)
|
|
91
|
+
}
|
|
92
|
+
const isCommandEmpty = yargsParsedResult._.length === 0;
|
|
93
|
+
|
|
94
|
+
// -v 时输出的版本信息,设置时避免影响其他命令使用 -v
|
|
95
|
+
if (isCommandEmpty) {
|
|
96
|
+
program.version(
|
|
97
|
+
`\nCLI: ${pkg.version}\nFramework: ${frameworkPkg.version}`,
|
|
98
|
+
'-v, --version',
|
|
99
|
+
'输出当前 CloudBase CLI 版本'
|
|
100
|
+
)
|
|
101
|
+
}
|
|
193
102
|
|
|
194
|
-
|
|
195
|
-
|
|
103
|
+
// 处理无效命令
|
|
104
|
+
program.action(() => {
|
|
105
|
+
const args = program.args
|
|
106
|
+
if (!Array.isArray(args) || !args.length) {
|
|
107
|
+
return
|
|
108
|
+
}
|
|
109
|
+
const cmd = args.join(' ')
|
|
110
|
+
console.log(chalk.bold.red('Error: ') + `${cmd} 不是有效的命令`)
|
|
111
|
+
didYouMean.threshold = 0.5
|
|
112
|
+
didYouMean.caseSensitive = false
|
|
113
|
+
const suggest = didYouMean(cmd, ALL_COMMANDS)
|
|
114
|
+
if (suggest) {
|
|
115
|
+
console.log(chalk.bold(`\n您是不是想使用命令:tcb ${suggest}\n`))
|
|
116
|
+
}
|
|
117
|
+
console.log(`💡使用 ${chalk.bold('tcb -h')} 查看所有命令`)
|
|
118
|
+
})
|
|
196
119
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (regionArgIndex !== -1) {
|
|
210
|
-
processArgv[regionArgIndex + 1] = predictRegion
|
|
211
|
-
} else {
|
|
212
|
-
processArgv.push('-r', predictRegion)
|
|
213
|
-
}
|
|
214
|
-
// 重新执行命令
|
|
215
|
-
const newArgvStr = processArgv.slice(2).join(' ')
|
|
216
|
-
console.log(`\n${chalk.yellow.bold('正在重新执行命令:')} tcb ${newArgvStr}\n`)
|
|
217
|
-
await execa('tcb', processArgv.slice(2), {
|
|
218
|
-
stdio: 'inherit'
|
|
219
|
-
})
|
|
220
|
-
process.emit('tcbExit')
|
|
221
|
-
process.exit(0)
|
|
222
|
-
} else {
|
|
223
|
-
console.log(chalk.yellow.bold(multiRegionErrMsg))
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
} else {
|
|
227
|
-
console.log(chalk.yellow.bold(multiRegionErrMsg))
|
|
120
|
+
// 没有使用命令
|
|
121
|
+
if (isCommandEmpty) {
|
|
122
|
+
if(privateSettings) {
|
|
123
|
+
program.outputHelp()
|
|
124
|
+
} else {
|
|
125
|
+
if (['-h', '--help'].includes(processArgv[2])) {
|
|
126
|
+
// 需要隐藏的选项
|
|
127
|
+
const hideArgs = ['-h', '--help']
|
|
128
|
+
hideArgs.forEach((arg) => {
|
|
129
|
+
const index = processArgv.indexOf(arg)
|
|
130
|
+
if (index > -1) {
|
|
131
|
+
processArgv.splice(index, 1)
|
|
228
132
|
}
|
|
229
|
-
}
|
|
133
|
+
})
|
|
134
|
+
const { outputHelpInfo } = require('../lib/help')
|
|
135
|
+
outputHelpInfo()
|
|
136
|
+
} else if (!['-v', '--version'].includes(processArgv[2])) {
|
|
137
|
+
// HACK: framework 智能命令
|
|
138
|
+
const { smartDeploy } = require('../lib')
|
|
139
|
+
smartDeploy()
|
|
230
140
|
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
231
143
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
144
|
+
try {
|
|
145
|
+
program.parse(processArgv)
|
|
146
|
+
} catch (e) {
|
|
147
|
+
const errMsg = `${logSymbols.error} ${e.message || '参数异常,请检查您是否使用了正确的命令!'}`
|
|
148
|
+
console.log(errMsg)
|
|
149
|
+
}
|
|
236
150
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
151
|
+
/**
|
|
152
|
+
* 处理异常
|
|
153
|
+
*/
|
|
154
|
+
function errorHandler(err) {
|
|
155
|
+
process.emit('tcbError')
|
|
156
|
+
const stackIngoreErrors = ['TencentCloudSDKHttpException', 'CloudBaseError']
|
|
157
|
+
// 忽略自定义错误的错误栈
|
|
158
|
+
if (err && err.stack && !stackIngoreErrors.includes(err.name)) {
|
|
159
|
+
console.log(err.stack)
|
|
241
160
|
}
|
|
242
161
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
const fetchedRegion = await Promise.all(regionSupported.map(async region => {
|
|
249
|
-
const { EnvList = [] } = await fetchEnvInfoWithRegion(envId, region)
|
|
250
|
-
if (EnvList.length !== 0 && EnvList.find(item => item.EnvId === envId)) {
|
|
251
|
-
return res.EnvList[0].Region
|
|
252
|
-
}
|
|
253
|
-
return ''
|
|
254
|
-
}))
|
|
162
|
+
// 3 空格,兼容中文字符编码长度问题
|
|
163
|
+
if (err && err.message) {
|
|
164
|
+
let errMsg = logSymbols.error + ' ' + err.message
|
|
165
|
+
errMsg += err.requestId ? `\n${err.requestId}` : ''
|
|
166
|
+
console.log(errMsg)
|
|
255
167
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
168
|
+
// 多地域错误提示
|
|
169
|
+
if (errMsg.includes('Environment') && errMsg.includes('not found')) {
|
|
170
|
+
console.log(
|
|
171
|
+
chalk.yellow.bold(
|
|
172
|
+
'\n此环境可能不属于当前账号,或为非上海地域环境,如需切换地域请追加参数(例:-r gz),请检查环境归属,参考多地域使用方法:https://docs.cloudbase.net/cli-v1/region.html'
|
|
173
|
+
)
|
|
174
|
+
)
|
|
175
|
+
}
|
|
263
176
|
}
|
|
264
177
|
|
|
265
|
-
//
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
const commonOpts = {
|
|
269
|
-
service: 'tcb',
|
|
270
|
-
version: '2019-09-24',
|
|
271
|
-
proxy: getProxy(),
|
|
272
|
-
timeout: 15000,
|
|
273
|
-
getCredential: async () => {
|
|
274
|
-
if (commonCredential.secretId && !isTokenExpired(commonCredential)) {
|
|
275
|
-
return commonCredential
|
|
276
|
-
}
|
|
277
|
-
const credential = await getCredentialWithoutCheck()
|
|
278
|
-
if (!credential) {
|
|
279
|
-
throw new Error('无有效身份信息,请使用 cloudbase login 登录')
|
|
280
|
-
}
|
|
281
|
-
commonCredential = credential
|
|
282
|
-
return {
|
|
283
|
-
...credential,
|
|
284
|
-
tokenExpired: Number(credential.accessTokenExpired)
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
const apiName = 'DescribeEnvs'
|
|
289
|
-
const tcbApi = new CloudApiService({
|
|
290
|
-
...commonOpts,
|
|
291
|
-
region
|
|
292
|
-
})
|
|
293
|
-
const res = await tcbApi.request(apiName, {
|
|
294
|
-
EnvId: envId,
|
|
295
|
-
})
|
|
296
|
-
return res
|
|
178
|
+
// 输出详细的错误信息
|
|
179
|
+
if (processArgv.includes('--verbose')) {
|
|
180
|
+
console.log(err)
|
|
297
181
|
}
|
|
298
182
|
|
|
299
|
-
process.
|
|
300
|
-
|
|
183
|
+
process.emit('tcbExit')
|
|
184
|
+
setTimeout(() => {
|
|
185
|
+
process.exit(1)
|
|
186
|
+
}, 1000)
|
|
187
|
+
}
|
|
301
188
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
// Beta 版 1 个小时检查一次,稳定版 1 天检查一次
|
|
305
|
-
const CheckInterval = isBeta ? 3600000 : ONE_DAY
|
|
189
|
+
process.on('uncaughtException', errorHandler)
|
|
190
|
+
process.on('unhandledRejection', errorHandler)
|
|
306
191
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
updateCheckInterval: CheckInterval
|
|
312
|
-
})
|
|
192
|
+
// 检查更新
|
|
193
|
+
const ONE_DAY = 86400000
|
|
194
|
+
// Beta 版 1 个小时检查一次,稳定版 1 天检查一次
|
|
195
|
+
const CheckInterval = isBeta ? 3600000 : ONE_DAY
|
|
313
196
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
197
|
+
const notifier = updateNotifier({
|
|
198
|
+
pkg,
|
|
199
|
+
distTag: isBeta ? 'beta' : 'latest',
|
|
200
|
+
// 检查更新间隔 1 天
|
|
201
|
+
updateCheckInterval: CheckInterval
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
notifier.notify({
|
|
205
|
+
isGlobal: true
|
|
206
|
+
})
|
|
317
207
|
|
|
318
208
|
}
|
|
319
209
|
|
|
320
|
-
if
|
|
210
|
+
if(require.main === module) {
|
|
321
211
|
try {
|
|
322
212
|
main()
|
|
323
213
|
} catch (error) {
|
|
@@ -326,6 +216,4 @@ if (require.main === module) {
|
|
|
326
216
|
}
|
|
327
217
|
process.on('unhandledRejection', (err) => {
|
|
328
218
|
console.log('unhandledRejection', err)
|
|
329
|
-
})
|
|
330
|
-
|
|
331
|
-
exports.main = main
|
|
219
|
+
})
|
|
@@ -235,9 +235,7 @@ __decorate([
|
|
|
235
235
|
__metadata("design:returntype", Promise)
|
|
236
236
|
], LowCodeDebugComps.prototype, "execute", null);
|
|
237
237
|
LowCodeDebugComps = __decorate([
|
|
238
|
-
(0, common_1.ICommand)(
|
|
239
|
-
supportPrivate: true
|
|
240
|
-
})
|
|
238
|
+
(0, common_1.ICommand)()
|
|
241
239
|
], LowCodeDebugComps);
|
|
242
240
|
exports.LowCodeDebugComps = LowCodeDebugComps;
|
|
243
241
|
let LowCodePublishComps = class LowCodePublishComps extends common_1.Command {
|
|
@@ -60,11 +60,12 @@ function promisifyProcess(p, pipe = false) {
|
|
|
60
60
|
exports.promisifyProcess = promisifyProcess;
|
|
61
61
|
function getLowcodeCli() {
|
|
62
62
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
var _a;
|
|
63
64
|
const key = '@cloudbase/lowcode-cli';
|
|
64
65
|
const cache = new Map();
|
|
65
66
|
let result;
|
|
66
67
|
if (!cache.get(key)) {
|
|
67
|
-
const module = yield Promise.resolve().then(() => __importStar(require(
|
|
68
|
+
const module = yield (_a = key, Promise.resolve().then(() => __importStar(require(_a))));
|
|
68
69
|
cache.set(key, module);
|
|
69
70
|
}
|
|
70
71
|
result = cache.get(key);
|
|
@@ -18,6 +18,15 @@ const debug_logger_1 = require("../debug-logger");
|
|
|
18
18
|
let commonCredential;
|
|
19
19
|
const isTokenExpired = (credential, gap = 120) => credential.accessTokenExpired && Number(credential.accessTokenExpired) < Date.now() + gap * 1000;
|
|
20
20
|
class CloudApiService {
|
|
21
|
+
static getInstance(service) {
|
|
22
|
+
var _a;
|
|
23
|
+
if ((_a = CloudApiService.serviceCacheMap) === null || _a === void 0 ? void 0 : _a[service]) {
|
|
24
|
+
return CloudApiService.serviceCacheMap[service];
|
|
25
|
+
}
|
|
26
|
+
const apiService = new CloudApiService(service);
|
|
27
|
+
CloudApiService.serviceCacheMap[service] = apiService;
|
|
28
|
+
return apiService;
|
|
29
|
+
}
|
|
21
30
|
constructor(service, baseParams, version = '') {
|
|
22
31
|
this.apiService = new cloud_api_1.CloudApiService({
|
|
23
32
|
service,
|
|
@@ -38,15 +47,6 @@ class CloudApiService {
|
|
|
38
47
|
})
|
|
39
48
|
});
|
|
40
49
|
}
|
|
41
|
-
static getInstance(service) {
|
|
42
|
-
var _a;
|
|
43
|
-
if ((_a = CloudApiService.serviceCacheMap) === null || _a === void 0 ? void 0 : _a[service]) {
|
|
44
|
-
return CloudApiService.serviceCacheMap[service];
|
|
45
|
-
}
|
|
46
|
-
const apiService = new CloudApiService(service);
|
|
47
|
-
CloudApiService.serviceCacheMap[service] = apiService;
|
|
48
|
-
return apiService;
|
|
49
|
-
}
|
|
50
50
|
request(action, data = {}, method = 'POST') {
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
52
|
const region = this.region || (yield (0, toolbox_1.getRegion)());
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.14",
|
|
4
4
|
"description": "cli tool for cloudbase",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "rimraf lib types && tsc
|
|
7
|
+
"build": "rimraf lib types && tsc",
|
|
8
8
|
"watch": "rimraf lib types && tsc -w",
|
|
9
9
|
"dev": "rimraf lib types && tsc -w",
|
|
10
10
|
"eslint": "eslint \"./**/*.ts\"",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@cloudbase/cloud-api": "^0.5.5",
|
|
34
34
|
"@cloudbase/framework-core": "^1.9.6",
|
|
35
|
-
"@cloudbase/lowcode-cli": "0.18.
|
|
36
|
-
"@cloudbase/manager-node": "4.
|
|
37
|
-
"@cloudbase/toolbox": "^0.7.
|
|
35
|
+
"@cloudbase/lowcode-cli": "^0.18.5",
|
|
36
|
+
"@cloudbase/manager-node": "4.2.3",
|
|
37
|
+
"@cloudbase/toolbox": "^0.7.4",
|
|
38
38
|
"@sentry/node": "^5.10.2",
|
|
39
39
|
"address": "^1.1.2",
|
|
40
40
|
"chalk": "^2.4.2",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ParamTypes } from '../constants';
|
|
2
|
-
|
|
2
|
+
type GetterFunction = (target: any) => Promise<any> | any;
|
|
3
3
|
export declare const createParamDecorator: (paramtype: ParamTypes, getter: GetterFunction) => () => (target: any, key: string | symbol, index: number) => void;
|
|
4
4
|
export {};
|
package/types/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export
|
|
2
|
+
export type CustomEvent = 'logout';
|
|
3
3
|
export interface ICommandContext {
|
|
4
4
|
cmd: string;
|
|
5
5
|
envId: string;
|
|
@@ -33,7 +33,7 @@ export interface TmpCredential {
|
|
|
33
33
|
uin?: string;
|
|
34
34
|
hash?: string;
|
|
35
35
|
}
|
|
36
|
-
export
|
|
36
|
+
export type Credential = TmpCredential & PermanentCredential;
|
|
37
37
|
export interface AuthSecret {
|
|
38
38
|
secretId: string;
|
|
39
39
|
secretKey: string;
|
package/types/utils/config.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface IArgs {
|
|
|
10
10
|
}
|
|
11
11
|
export declare const getArgs: () => Arguments<IArgs>;
|
|
12
12
|
export declare function getPrivateSettings(config: ICloudBaseRcSettings, cmd?: string): undefined | IPrivateSettings;
|
|
13
|
-
|
|
13
|
+
type IAbsUrl = `http://${string}` | `https://${string}`;
|
|
14
14
|
export interface IPrivateSettings {
|
|
15
15
|
credential: Credential;
|
|
16
16
|
endpoints: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './del';
|
|
2
|
-
export
|
|
2
|
+
export type SizeUnit = 'KB' | 'MB' | 'GB';
|
|
3
3
|
export declare function checkFullAccess(dest: string, throwError?: boolean): boolean;
|
|
4
4
|
export declare function checkWritable(dest: string, throwError?: boolean): boolean;
|
|
5
5
|
export declare function checkReadable(dest: string, throwError?: boolean): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _fetch, { RequestInit } from 'node-fetch';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
type fetchReturnType = ReturnType<typeof _fetch>;
|
|
3
|
+
type UnPromisify<T> = T extends PromiseLike<infer U> ? U : T;
|
|
4
|
+
type fetchReturnTypeExtracted = UnPromisify<fetchReturnType>;
|
|
5
5
|
export declare function fetch(url: string, config?: RequestInit): Promise<any>;
|
|
6
6
|
export declare function postFetch(url: string, data?: Record<string, any>): Promise<any>;
|
|
7
7
|
export declare function fetchStream(url: any, config?: Record<string, any>): Promise<fetchReturnTypeExtracted>;
|
|
@@ -8,7 +8,7 @@ declare class Loading {
|
|
|
8
8
|
fail(text: string): void;
|
|
9
9
|
}
|
|
10
10
|
export declare const loadingFactory: () => Loading;
|
|
11
|
-
|
|
11
|
+
type Task<T> = (flush: (text: string) => void, ...args: any[]) => Promise<T>;
|
|
12
12
|
export interface ILoadingOptions {
|
|
13
13
|
startTip?: string;
|
|
14
14
|
successTip?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type SimpleValue = number | string | boolean;
|
|
2
2
|
export declare function assertTruthy(val: SimpleValue | SimpleValue[], errMsg: string): void;
|
|
3
3
|
export declare function assertHas(obj: any, prop: string, errMsg: any): void;
|
|
4
4
|
export declare const validateIp: (ip: string) => boolean;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# Logs
|
|
2
|
-
logs
|
|
3
|
-
*.log
|
|
4
|
-
npm-debug.log*
|
|
5
|
-
yarn-debug.log*
|
|
6
|
-
yarn-error.log*
|
|
7
|
-
package-lock.json
|
|
8
|
-
yarn.lock
|
|
9
|
-
|
|
10
|
-
# Runtime data
|
|
11
|
-
pids
|
|
12
|
-
*.pid
|
|
13
|
-
*.seed
|
|
14
|
-
*.pid.lock
|
|
15
|
-
|
|
16
|
-
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
17
|
-
lib-cov
|
|
18
|
-
|
|
19
|
-
# Coverage directory used by tools like istanbul
|
|
20
|
-
coverage
|
|
21
|
-
|
|
22
|
-
# nyc test coverage
|
|
23
|
-
.nyc_output
|
|
24
|
-
|
|
25
|
-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
26
|
-
.grunt
|
|
27
|
-
|
|
28
|
-
# Bower dependency directory (https://bower.io/)
|
|
29
|
-
bower_components
|
|
30
|
-
|
|
31
|
-
# node-waf configuration
|
|
32
|
-
.lock-wscript
|
|
33
|
-
|
|
34
|
-
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
35
|
-
build/Release
|
|
36
|
-
|
|
37
|
-
# Dependency directories
|
|
38
|
-
node_modules/
|
|
39
|
-
jspm_packages/
|
|
40
|
-
|
|
41
|
-
# TypeScript v1 declaration files
|
|
42
|
-
typings/
|
|
43
|
-
|
|
44
|
-
# Optional npm cache directory
|
|
45
|
-
.npm
|
|
46
|
-
|
|
47
|
-
# Optional eslint cache
|
|
48
|
-
.eslintcache
|
|
49
|
-
|
|
50
|
-
# Optional REPL history
|
|
51
|
-
.node_repl_history
|
|
52
|
-
|
|
53
|
-
# Output of 'npm pack'
|
|
54
|
-
*.tgz
|
|
55
|
-
|
|
56
|
-
# Yarn Integrity file
|
|
57
|
-
.yarn-integrity
|
|
58
|
-
|
|
59
|
-
# dotenv environment variables file
|
|
60
|
-
.env
|
|
61
|
-
|
|
62
|
-
# next.js build output
|
|
63
|
-
.next
|
|
64
|
-
|
|
65
|
-
dist
|
|
66
|
-
|
|
67
|
-
example/**/tcb.json
|
|
68
|
-
|
|
69
|
-
node_modules
|
|
70
|
-
|
|
71
|
-
.idea
|
|
72
|
-
.vscode/*
|
|
73
|
-
!.vscode/launch.json
|
|
74
|
-
|
|
75
|
-
# Test api Key
|
|
76
|
-
test/api-key.js
|
|
77
|
-
|
|
78
|
-
pkg/
|
|
79
|
-
|
|
80
|
-
.DS_Store
|
|
81
|
-
|
|
82
|
-
# Build files
|
|
83
|
-
/lib
|
|
84
|
-
/types
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# Logs
|
|
2
|
-
logs
|
|
3
|
-
*.log
|
|
4
|
-
npm-debug.log*
|
|
5
|
-
yarn-debug.log*
|
|
6
|
-
yarn-error.log*
|
|
7
|
-
package-lock.json
|
|
8
|
-
yarn.lock
|
|
9
|
-
|
|
10
|
-
# Runtime data
|
|
11
|
-
pids
|
|
12
|
-
*.pid
|
|
13
|
-
*.seed
|
|
14
|
-
*.pid.lock
|
|
15
|
-
|
|
16
|
-
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
17
|
-
lib-cov
|
|
18
|
-
|
|
19
|
-
# Coverage directory used by tools like istanbul
|
|
20
|
-
coverage
|
|
21
|
-
|
|
22
|
-
# nyc test coverage
|
|
23
|
-
.nyc_output
|
|
24
|
-
|
|
25
|
-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
26
|
-
.grunt
|
|
27
|
-
|
|
28
|
-
# Bower dependency directory (https://bower.io/)
|
|
29
|
-
bower_components
|
|
30
|
-
|
|
31
|
-
# node-waf configuration
|
|
32
|
-
.lock-wscript
|
|
33
|
-
|
|
34
|
-
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
35
|
-
build/Release
|
|
36
|
-
|
|
37
|
-
# Dependency directories
|
|
38
|
-
node_modules/
|
|
39
|
-
jspm_packages/
|
|
40
|
-
|
|
41
|
-
# TypeScript v1 declaration files
|
|
42
|
-
typings/
|
|
43
|
-
|
|
44
|
-
# Optional npm cache directory
|
|
45
|
-
.npm
|
|
46
|
-
|
|
47
|
-
# Optional eslint cache
|
|
48
|
-
.eslintcache
|
|
49
|
-
|
|
50
|
-
# Optional REPL history
|
|
51
|
-
.node_repl_history
|
|
52
|
-
|
|
53
|
-
# Output of 'npm pack'
|
|
54
|
-
*.tgz
|
|
55
|
-
|
|
56
|
-
# Yarn Integrity file
|
|
57
|
-
.yarn-integrity
|
|
58
|
-
|
|
59
|
-
# dotenv environment variables file
|
|
60
|
-
.env
|
|
61
|
-
|
|
62
|
-
# next.js build output
|
|
63
|
-
.next
|
|
64
|
-
|
|
65
|
-
dist
|
|
66
|
-
|
|
67
|
-
example/**/tcb.json
|
|
68
|
-
|
|
69
|
-
node_modules
|
|
70
|
-
|
|
71
|
-
.idea
|
|
72
|
-
.vscode/*
|
|
73
|
-
!.vscode/launch.json
|
|
74
|
-
|
|
75
|
-
# Test api Key
|
|
76
|
-
test/api-key.js
|
|
77
|
-
|
|
78
|
-
pkg/
|
|
79
|
-
|
|
80
|
-
.DS_Store
|
|
81
|
-
|
|
82
|
-
# Build files
|
|
83
|
-
/lib
|
|
84
|
-
/types
|
|
85
|
-
|
|
86
|
-
.history
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.2.7",
|
|
4
|
-
"description": "cli tool for cloudbase",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "rimraf lib types && tsc",
|
|
8
|
-
"watch": "rimraf lib types && tsc -w",
|
|
9
|
-
"dev": "rimraf lib types && tsc -w",
|
|
10
|
-
"eslint": "eslint \"./**/*.ts\"",
|
|
11
|
-
"test": "jest --runInBand --forceExit --detectOpenHandles --coverage --verbose --testTimeout=10000",
|
|
12
|
-
"tsc": "tsc",
|
|
13
|
-
"pkg": "pkg ./bin/cloudbase.js --out-path ./pkg",
|
|
14
|
-
"postinstall": "node ./post-install.js || exit 0",
|
|
15
|
-
"prepublishOnly": "npm run build"
|
|
16
|
-
},
|
|
17
|
-
"repository": {
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "https://github.com/TencentCloudBase/cloud-base-cli.git"
|
|
20
|
-
},
|
|
21
|
-
"bin": {
|
|
22
|
-
"tcb": "bin/tcb.js",
|
|
23
|
-
"cloudbase": "bin/cloudbase.js"
|
|
24
|
-
},
|
|
25
|
-
"husky": {
|
|
26
|
-
"hooks": {
|
|
27
|
-
"pre-commit": "npm run build"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"author": "cwuyiqing@gmail.com",
|
|
31
|
-
"license": "ISC",
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"@cloudbase/cloud-api": "^0.5.5",
|
|
34
|
-
"@cloudbase/framework-core": "^1.9.6",
|
|
35
|
-
"@cloudbase/lowcode-cli": "^0.18.7",
|
|
36
|
-
"@cloudbase/manager-node": "4.0.1",
|
|
37
|
-
"@cloudbase/toolbox": "^0.7.5",
|
|
38
|
-
"@sentry/node": "^5.10.2",
|
|
39
|
-
"address": "^1.1.2",
|
|
40
|
-
"chalk": "^2.4.2",
|
|
41
|
-
"cli-table3": "^0.5.1",
|
|
42
|
-
"commander": "7",
|
|
43
|
-
"del": "^5.1.0",
|
|
44
|
-
"didyoumean": "^1.2.2",
|
|
45
|
-
"enquirer": "^2.3.6",
|
|
46
|
-
"execa": "^4.0.3",
|
|
47
|
-
"fs-extra": "^8.1.0",
|
|
48
|
-
"https-proxy-agent": "^5.0.1",
|
|
49
|
-
"inquirer": "^6.5.0",
|
|
50
|
-
"lodash": "^4.17.21",
|
|
51
|
-
"log-symbols": "^3.0.0",
|
|
52
|
-
"lowdb": "^1.0.0",
|
|
53
|
-
"make-dir": "^3.0.0",
|
|
54
|
-
"node-fetch": "^2.6.0",
|
|
55
|
-
"open": "^7.0.0",
|
|
56
|
-
"ora": "^4.0.2",
|
|
57
|
-
"portfinder": "^1.0.28",
|
|
58
|
-
"progress": "^2.0.3",
|
|
59
|
-
"query-string": "^6.8.1",
|
|
60
|
-
"reflect-metadata": "^0.1.13",
|
|
61
|
-
"semver": "^7.3.7",
|
|
62
|
-
"tar-fs": "^2.0.1",
|
|
63
|
-
"terminal-link": "^2.1.1",
|
|
64
|
-
"unzipper": "^0.10.10",
|
|
65
|
-
"update-notifier": "^4.0.0",
|
|
66
|
-
"xdg-basedir": "^4.0.0",
|
|
67
|
-
"yargs": "^16.2.0",
|
|
68
|
-
"yargs-parser": "^21.0.1"
|
|
69
|
-
},
|
|
70
|
-
"devDependencies": {
|
|
71
|
-
"@types/jest": "^27",
|
|
72
|
-
"@types/koa__router": "^8.0.11",
|
|
73
|
-
"@types/lodash": "^4.14.182",
|
|
74
|
-
"@types/node": "^12.12.38",
|
|
75
|
-
"@types/node-fetch": "^2.5.4",
|
|
76
|
-
"@types/react": "^17.0.37",
|
|
77
|
-
"@types/semver": "^7.3.9",
|
|
78
|
-
"@types/webpack-dev-server": "^3.11.1",
|
|
79
|
-
"@typescript-eslint/eslint-plugin": "^4.8.1",
|
|
80
|
-
"@typescript-eslint/parser": "^4.8.1",
|
|
81
|
-
"eslint": "^7.14.0",
|
|
82
|
-
"eslint-config-alloy": "^3.8.2",
|
|
83
|
-
"husky": "^3.0.9",
|
|
84
|
-
"jest": "^27",
|
|
85
|
-
"rimraf": "^3.0.2",
|
|
86
|
-
"ts-jest": "^27",
|
|
87
|
-
"typescript": "^4.7.2"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.2.8",
|
|
4
|
-
"description": "cli tool for cloudbase",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "rimraf lib types && tsc",
|
|
8
|
-
"watch": "rimraf lib types && tsc -w",
|
|
9
|
-
"dev": "rimraf lib types && tsc -w",
|
|
10
|
-
"eslint": "eslint \"./**/*.ts\"",
|
|
11
|
-
"test": "jest --runInBand --forceExit --detectOpenHandles --coverage --verbose --testTimeout=10000",
|
|
12
|
-
"tsc": "tsc",
|
|
13
|
-
"pkg": "pkg ./bin/cloudbase.js --out-path ./pkg",
|
|
14
|
-
"postinstall": "node ./post-install.js || exit 0",
|
|
15
|
-
"prepublishOnly": "npm run build"
|
|
16
|
-
},
|
|
17
|
-
"repository": {
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "https://github.com/TencentCloudBase/cloud-base-cli.git"
|
|
20
|
-
},
|
|
21
|
-
"bin": {
|
|
22
|
-
"tcb": "bin/tcb.js",
|
|
23
|
-
"cloudbase": "bin/cloudbase.js"
|
|
24
|
-
},
|
|
25
|
-
"husky": {
|
|
26
|
-
"hooks": {
|
|
27
|
-
"pre-commit": "npm run build"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"author": "cwuyiqing@gmail.com",
|
|
31
|
-
"license": "ISC",
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"@cloudbase/cloud-api": "^0.5.5",
|
|
34
|
-
"@cloudbase/framework-core": "^1.9.6",
|
|
35
|
-
"@cloudbase/lowcode-cli": "^0.18.7",
|
|
36
|
-
"@cloudbase/manager-node": "4.0.1",
|
|
37
|
-
"@cloudbase/toolbox": "^0.7.5",
|
|
38
|
-
"@sentry/node": "^5.10.2",
|
|
39
|
-
"address": "^1.1.2",
|
|
40
|
-
"chalk": "^2.4.2",
|
|
41
|
-
"cli-table3": "^0.5.1",
|
|
42
|
-
"commander": "7",
|
|
43
|
-
"del": "^5.1.0",
|
|
44
|
-
"didyoumean": "^1.2.2",
|
|
45
|
-
"enquirer": "^2.3.6",
|
|
46
|
-
"execa": "^4.0.3",
|
|
47
|
-
"fs-extra": "^8.1.0",
|
|
48
|
-
"https-proxy-agent": "^5.0.1",
|
|
49
|
-
"inquirer": "^6.5.0",
|
|
50
|
-
"lodash": "^4.17.21",
|
|
51
|
-
"log-symbols": "^3.0.0",
|
|
52
|
-
"lowdb": "^1.0.0",
|
|
53
|
-
"make-dir": "^3.0.0",
|
|
54
|
-
"node-fetch": "^2.6.0",
|
|
55
|
-
"open": "^7.0.0",
|
|
56
|
-
"ora": "^4.0.2",
|
|
57
|
-
"portfinder": "^1.0.28",
|
|
58
|
-
"progress": "^2.0.3",
|
|
59
|
-
"query-string": "^6.8.1",
|
|
60
|
-
"reflect-metadata": "^0.1.13",
|
|
61
|
-
"semver": "^7.3.7",
|
|
62
|
-
"tar-fs": "^2.0.1",
|
|
63
|
-
"terminal-link": "^2.1.1",
|
|
64
|
-
"unzipper": "^0.10.10",
|
|
65
|
-
"update-notifier": "^4.0.0",
|
|
66
|
-
"xdg-basedir": "^4.0.0",
|
|
67
|
-
"yargs": "^16.2.0",
|
|
68
|
-
"yargs-parser": "^21.0.1"
|
|
69
|
-
},
|
|
70
|
-
"devDependencies": {
|
|
71
|
-
"@types/jest": "^27",
|
|
72
|
-
"@types/koa__router": "^8.0.11",
|
|
73
|
-
"@types/lodash": "^4.14.182",
|
|
74
|
-
"@types/node": "^12.12.38",
|
|
75
|
-
"@types/node-fetch": "^2.5.4",
|
|
76
|
-
"@types/react": "^17.0.37",
|
|
77
|
-
"@types/semver": "^7.3.9",
|
|
78
|
-
"@types/webpack-dev-server": "^3.11.1",
|
|
79
|
-
"@typescript-eslint/eslint-plugin": "^4.8.1",
|
|
80
|
-
"@typescript-eslint/parser": "^4.8.1",
|
|
81
|
-
"eslint": "^7.14.0",
|
|
82
|
-
"eslint-config-alloy": "^3.8.2",
|
|
83
|
-
"husky": "^3.0.9",
|
|
84
|
-
"jest": "^27",
|
|
85
|
-
"rimraf": "^3.0.2",
|
|
86
|
-
"ts-jest": "^27",
|
|
87
|
-
"typescript": "^4.7.2"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash'
|
|
2
|
-
import { Command, ICommand } from '../common'
|
|
3
|
-
import { watchApp } from '@cloudbase/lowcode-cli'
|
|
4
|
-
import { InjectParams, Log, Logger, CmdContext, ArgsOptions } from '../../decorators'
|
|
5
|
-
|
|
6
|
-
@ICommand()
|
|
7
|
-
export class LowCodeWatch extends Command {
|
|
8
|
-
get options() {
|
|
9
|
-
return {
|
|
10
|
-
cmd: 'lowcode',
|
|
11
|
-
childCmd: 'watch',
|
|
12
|
-
options: [
|
|
13
|
-
{
|
|
14
|
-
flags: '--verbose',
|
|
15
|
-
desc: '是否打印详细日志'
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
flags: '--wx-devtool-path <wxDevtoolPath>',
|
|
19
|
-
desc: '微信开发者工具的安装路径'
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
desc: '开启云开发低码的本地构建模式',
|
|
23
|
-
requiredEnvId: false
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@InjectParams()
|
|
28
|
-
async execute(@CmdContext() ctx, @ArgsOptions() options) {
|
|
29
|
-
await watchApp({
|
|
30
|
-
watchPort: 8288,
|
|
31
|
-
wxDevtoolPath: options?.wxDevtoolPath
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@ICommand()
|
|
37
|
-
export class DanielWatch extends Command {
|
|
38
|
-
get options() {
|
|
39
|
-
return {
|
|
40
|
-
cmd: 'lowcode',
|
|
41
|
-
childCmd: 'watch-ws',
|
|
42
|
-
options: [],
|
|
43
|
-
desc: '开启云开发低码的本地开发模式',
|
|
44
|
-
requiredEnvId: false
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@InjectParams()
|
|
49
|
-
async execute(@CmdContext() ctx, @ArgsOptions() options) {
|
|
50
|
-
console.log('>>> 启动啦')
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash'
|
|
2
|
-
import { Command, ICommand } from '../common'
|
|
3
|
-
import { watchApp } from '@cloudbase/lowcode-cli'
|
|
4
|
-
import { InjectParams, Log, Logger, CmdContext, ArgsOptions } from '../../decorators'
|
|
5
|
-
|
|
6
|
-
@ICommand()
|
|
7
|
-
export class LowCodeWatch extends Command {
|
|
8
|
-
get options() {
|
|
9
|
-
return {
|
|
10
|
-
cmd: 'lowcode',
|
|
11
|
-
childCmd: 'watch',
|
|
12
|
-
options: [
|
|
13
|
-
{
|
|
14
|
-
flags: '--verbose',
|
|
15
|
-
desc: '是否打印详细日志'
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
flags: '--wx-devtool-path <wxDevtoolPath>',
|
|
19
|
-
desc: '微信开发者工具的安装路径'
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
desc: '开启云开发低码的本地构建模式',
|
|
23
|
-
requiredEnvId: false
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@InjectParams()
|
|
28
|
-
async execute(@CmdContext() ctx, @ArgsOptions() options) {
|
|
29
|
-
await watchApp({
|
|
30
|
-
watchPort: 8288,
|
|
31
|
-
wxDevtoolPath: options?.wxDevtoolPath
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash'
|
|
2
|
-
import { Command, ICommand } from '../common'
|
|
3
|
-
import { watchApp } from '@cloudbase/lowcode-cli'
|
|
4
|
-
import { InjectParams, Log, Logger, CmdContext, ArgsOptions } from '../../decorators'
|
|
5
|
-
|
|
6
|
-
@ICommand()
|
|
7
|
-
export class LowCodeWatch extends Command {
|
|
8
|
-
get options() {
|
|
9
|
-
return {
|
|
10
|
-
cmd: 'lowcode',
|
|
11
|
-
childCmd: 'watch',
|
|
12
|
-
options: [
|
|
13
|
-
{
|
|
14
|
-
flags: '--verbose',
|
|
15
|
-
desc: '是否打印详细日志'
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
flags: '--wx-devtool-path <wxDevtoolPath>',
|
|
19
|
-
desc: '微信开发者工具的安装路径'
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
desc: '开启微搭低代码的本地构建模式',
|
|
23
|
-
requiredEnvId: false
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@InjectParams()
|
|
28
|
-
async execute(@CmdContext() ctx, @ArgsOptions() options) {
|
|
29
|
-
await watchApp({
|
|
30
|
-
watchPort: 8288,
|
|
31
|
-
wxDevtoolPath: options?.wxDevtoolPath
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata'
|
|
2
|
-
import { registerCommands } from './commands/common'
|
|
3
|
-
import './commands'
|
|
4
|
-
|
|
5
|
-
export { smartDeploy } from './commands'
|
|
6
|
-
|
|
7
|
-
registerCommands()
|
|
8
|
-
|
|
9
|
-
// HACK: 部分依赖使用了 globalThis,会在 Node12 以下的版本报错
|
|
10
|
-
if (typeof globalThis === undefined) {
|
|
11
|
-
// eslint-disable-next-line no-undef
|
|
12
|
-
;(globalThis as any) = global
|
|
13
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata'
|
|
2
|
-
import { registerCommands } from './commands/common'
|
|
3
|
-
import './commands'
|
|
4
|
-
|
|
5
|
-
export { smartDeploy } from './commands'
|
|
6
|
-
|
|
7
|
-
registerCommands()
|
|
8
|
-
|
|
9
|
-
// HACK: 部分依赖使用了 globalThis,会在 Node12 以下的版本报错
|
|
10
|
-
if (typeof globalThis === undefined) {
|
|
11
|
-
// eslint-disable-next-line no-undef
|
|
12
|
-
;(globalThis as any) = global
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
console.log("daniel tcb")
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata'
|
|
2
|
-
import { registerCommands } from './commands/common'
|
|
3
|
-
import './commands'
|
|
4
|
-
|
|
5
|
-
export { smartDeploy } from './commands'
|
|
6
|
-
|
|
7
|
-
registerCommands()
|
|
8
|
-
|
|
9
|
-
// HACK: 部分依赖使用了 globalThis,会在 Node12 以下的版本报错
|
|
10
|
-
if (typeof globalThis === undefined) {
|
|
11
|
-
// eslint-disable-next-line no-undef
|
|
12
|
-
;(globalThis as any) = global
|
|
13
|
-
}
|