@cloudbase/cli 2.6.0-alpha.1 → 2.6.0-alpha.3
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/lib/commands/fun/base.js +11 -56
- package/package.json +1 -1
package/lib/commands/fun/base.js
CHANGED
|
@@ -60,6 +60,9 @@ let FunListCommand = class FunListCommand extends common_1.Command {
|
|
|
60
60
|
if (!envId) {
|
|
61
61
|
envId = yield _selectEnv();
|
|
62
62
|
}
|
|
63
|
+
else {
|
|
64
|
+
log.info(`当前环境 Id:${envId}`);
|
|
65
|
+
}
|
|
63
66
|
try {
|
|
64
67
|
loading.start('获取函数式托管服务列表中…');
|
|
65
68
|
let serverListRes = yield scfService
|
|
@@ -118,10 +121,6 @@ let FunDeployCommand = class FunDeployCommand extends common_1.Command {
|
|
|
118
121
|
{
|
|
119
122
|
flags: '--source <source>',
|
|
120
123
|
desc: '目标函数文件所在目录路径。默认为当前路径'
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
flags: '--target <target>',
|
|
124
|
-
desc: '目标函数名称,默认为 main'
|
|
125
124
|
}
|
|
126
125
|
],
|
|
127
126
|
requiredEnvId: false,
|
|
@@ -131,7 +130,8 @@ let FunDeployCommand = class FunDeployCommand extends common_1.Command {
|
|
|
131
130
|
}
|
|
132
131
|
execute(envId, log, options) {
|
|
133
132
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
let { serviceName, appId, source
|
|
133
|
+
let { serviceName, appId, source } = options;
|
|
134
|
+
const target = 'main';
|
|
135
135
|
source = path_1.default.resolve(source || process.cwd());
|
|
136
136
|
const loadResult = yield (0, functions_framework_1.loadUserFunction)(source, target);
|
|
137
137
|
if (!(loadResult === null || loadResult === void 0 ? void 0 : loadResult.userFunction)) {
|
|
@@ -139,7 +139,7 @@ let FunDeployCommand = class FunDeployCommand extends common_1.Command {
|
|
|
139
139
|
log.error(`${source} 不是一个有效的函数式托管代码目录,可以通过 --source <source> 指定代码目录路径`);
|
|
140
140
|
}
|
|
141
141
|
else if (loadResult === null || loadResult === void 0 ? void 0 : loadResult.reason.includes('is not defined in the provided module')) {
|
|
142
|
-
log.error(`主文件并未导出目标函数 ${target},请导出 ${target}
|
|
142
|
+
log.error(`主文件并未导出目标函数 ${target},请导出 ${target} 目标函数`);
|
|
143
143
|
}
|
|
144
144
|
else {
|
|
145
145
|
log.error(loadResult === null || loadResult === void 0 ? void 0 : loadResult.reason);
|
|
@@ -149,6 +149,9 @@ let FunDeployCommand = class FunDeployCommand extends common_1.Command {
|
|
|
149
149
|
if (!envId) {
|
|
150
150
|
envId = yield _selectEnv();
|
|
151
151
|
}
|
|
152
|
+
else {
|
|
153
|
+
log.info(`当前环境 Id:${envId}`);
|
|
154
|
+
}
|
|
152
155
|
if (!serviceName) {
|
|
153
156
|
let pkgName = '';
|
|
154
157
|
try {
|
|
@@ -291,44 +294,8 @@ let FunRunCommand = class FunRunCommand extends common_1.Command {
|
|
|
291
294
|
desc: '监听的端口,默认为 3000'
|
|
292
295
|
},
|
|
293
296
|
{
|
|
294
|
-
flags: '--
|
|
295
|
-
desc: '
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
flags: '--signatureType <signatureType>',
|
|
299
|
-
desc: '函数格式,默认为 event,当前仅支持 event'
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
flags: '--gracefulShutdown <gracefulShutdown>',
|
|
303
|
-
desc: '是否启用服务的优雅停止,默认为 true'
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
flags: 'KILL_TIMEOUT <timeout>',
|
|
307
|
-
desc: '优雅停止时,等待请求处理完成的超时时间,默认为 5000 毫秒'
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
flags: '--timeout <timeout>',
|
|
311
|
-
desc: 'Node.js Server 超时时间,默认为 0,见 https://nodejs.org/api/http.html#servertimeout'
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
flags: '--keepAliveTimeout <keepAliveTimeout>',
|
|
315
|
-
desc: 'Node.js Server keep-alive 超时时间,默认为 65000 毫秒,见 https://nodejs.org/api/http.html#server-keepalivetimeout'
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
flags: '--captureStack <captureStack>',
|
|
319
|
-
desc: '请求出错时,是否返回错误堆栈,默认为 NODE_ENV 不为 production 时开启'
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
flags: '--concurrencyLimit <concurrencyLimit>',
|
|
323
|
-
desc: '并发请求数限制,默认为 0,0 为不限制'
|
|
324
|
-
},
|
|
325
|
-
{
|
|
326
|
-
flags: '--noExit <noExit>',
|
|
327
|
-
desc: '是否禁用 process.exit() 避免进程意外退出,默认为 false'
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
flags: '--logHeaderBody <logHeaderBody>',
|
|
331
|
-
desc: '是否在请求日志中记录请求头、请求体、响应头、响应体,默认为 false,如记录,将会限制 body 大小为 2KB'
|
|
297
|
+
flags: '-w, --watch',
|
|
298
|
+
desc: '是否启用热重启模式,如启用,将会在文件变更时自动重启服务,默认为 false'
|
|
332
299
|
},
|
|
333
300
|
{
|
|
334
301
|
flags: '--dry-run',
|
|
@@ -337,18 +304,6 @@ let FunRunCommand = class FunRunCommand extends common_1.Command {
|
|
|
337
304
|
{
|
|
338
305
|
flags: '--logDirname <logDirname>',
|
|
339
306
|
desc: '日志文件目录,默认为 ./logs'
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
flags: '--maxLogFileSize <maxLogFileSize>',
|
|
343
|
-
desc: '单个日志文件最大字节数,默认为 128MB'
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
flags: '--maxLogFiles <maxLogFiles>',
|
|
347
|
-
desc: '最多同时存在的日志文件数量,默认为 4'
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
flags: '-w, --watch',
|
|
351
|
-
desc: '是否启用热重启模式,如启用,将会在文件变更时自动重启服务,默认为 false'
|
|
352
307
|
}
|
|
353
308
|
],
|
|
354
309
|
requiredEnvId: false,
|