@cloudbase/cli 2.6.7 → 2.6.9
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/tcb.js +0 -19
- package/lib/commands/fun/base.js +1 -9
- package/lib/commands/runf/base.js +14 -12
- package/package.json +1 -1
- package/types/commands/runf/base.d.ts +1 -1
package/bin/tcb.js
CHANGED
|
@@ -42,7 +42,6 @@ async function main() {
|
|
|
42
42
|
|
|
43
43
|
// 定义最小版本和推荐版本
|
|
44
44
|
const NODE_MIN_VERSION = 18
|
|
45
|
-
const NODE_RECOMMENDED_VERSIONS = [18]
|
|
46
45
|
|
|
47
46
|
// 检查当前版本是否满足最小版本要求
|
|
48
47
|
if (NODE_MIN_VERSION > currentMajorVersion) {
|
|
@@ -51,27 +50,9 @@ async function main() {
|
|
|
51
50
|
`当前 Node.js 版本为 v${currentMajorVersion}。请升级到至少 v${NODE_MIN_VERSION} 版本。`
|
|
52
51
|
)
|
|
53
52
|
)
|
|
54
|
-
console.warn(
|
|
55
|
-
chalk.bold.yellow(
|
|
56
|
-
`建议使用 ${NODE_RECOMMENDED_VERSIONS.map((item) => `v${item}`).join(
|
|
57
|
-
' 或 '
|
|
58
|
-
)} 版本。`
|
|
59
|
-
)
|
|
60
|
-
)
|
|
61
53
|
process.exit(1)
|
|
62
54
|
}
|
|
63
55
|
|
|
64
|
-
// 检查当前版本是否在推荐版本列表中
|
|
65
|
-
if (!NODE_RECOMMENDED_VERSIONS.some((version) => currentMajorVersion === version)) {
|
|
66
|
-
console.warn(
|
|
67
|
-
chalk.bold.yellow(
|
|
68
|
-
`当前 Node.js 版本为 v${currentMajorVersion}。建议使用 ${NODE_RECOMMENDED_VERSIONS.map(
|
|
69
|
-
(item) => `v${item}`
|
|
70
|
-
).join(' 或 ')} 版本。`
|
|
71
|
-
)
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
56
|
// Sentry 错误上报
|
|
76
57
|
Sentry.init({
|
|
77
58
|
release: pkg.version,
|
package/lib/commands/fun/base.js
CHANGED
|
@@ -168,15 +168,7 @@ let FunDeployCommand = class FunDeployCommand extends common_1.Command {
|
|
|
168
168
|
}
|
|
169
169
|
else {
|
|
170
170
|
if (!(loadResult === null || loadResult === void 0 ? void 0 : loadResult.userFunction)) {
|
|
171
|
-
|
|
172
|
-
log.error(`${source} 不是一个有效的函数式托管代码目录,可以通过 --source <source> 指定代码目录路径`);
|
|
173
|
-
}
|
|
174
|
-
else if (loadResult === null || loadResult === void 0 ? void 0 : loadResult.reason.includes('is not defined in the provided module')) {
|
|
175
|
-
log.error(`主文件并未导出目标函数 ${target},请导出 ${target} 目标函数`);
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
log.error(loadResult === null || loadResult === void 0 ? void 0 : loadResult.reason);
|
|
179
|
-
}
|
|
171
|
+
log.error(`验证加载云函数失败: ${loadResult === null || loadResult === void 0 ? void 0 : loadResult.reason}`);
|
|
180
172
|
return;
|
|
181
173
|
}
|
|
182
174
|
}
|
|
@@ -148,22 +148,14 @@ let RunfDeployCommand = class RunfDeployCommand extends common_1.Command {
|
|
|
148
148
|
if (Array.isArray(loadResult)) {
|
|
149
149
|
for (const loadItem of loadResult) {
|
|
150
150
|
if (!(loadItem === null || loadItem === void 0 ? void 0 : loadItem.userFunction)) {
|
|
151
|
-
log.error(
|
|
151
|
+
log.error(`验证加载函数 ${loadItem === null || loadItem === void 0 ? void 0 : loadItem.name} 失败: "${loadItem === null || loadItem === void 0 ? void 0 : loadItem.reason}"`);
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
else {
|
|
157
157
|
if (!(loadResult === null || loadResult === void 0 ? void 0 : loadResult.userFunction)) {
|
|
158
|
-
|
|
159
|
-
log.error(`${targetDir} 不是一个有效的函数式托管代码目录,可以通过 --source <source> 指定代码目录路径`);
|
|
160
|
-
}
|
|
161
|
-
else if (loadResult === null || loadResult === void 0 ? void 0 : loadResult.reason.includes('is not defined in the provided module')) {
|
|
162
|
-
log.error(`主文件并未导出目标函数 ${target},请导出 ${target} 目标函数`);
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
log.error(loadResult === null || loadResult === void 0 ? void 0 : loadResult.reason);
|
|
166
|
-
}
|
|
158
|
+
log.error(`验证加载云函数失败: ${loadResult === null || loadResult === void 0 ? void 0 : loadResult.reason}`);
|
|
167
159
|
return;
|
|
168
160
|
}
|
|
169
161
|
}
|
|
@@ -457,11 +449,19 @@ let RunfRunCommand = class RunfRunCommand extends common_1.Command {
|
|
|
457
449
|
desc: '本地运行云函数 2.0 代码'
|
|
458
450
|
};
|
|
459
451
|
}
|
|
460
|
-
execute(logger) {
|
|
452
|
+
execute(logger, ctx, options) {
|
|
461
453
|
return __awaiter(this, void 0, void 0, function* () {
|
|
462
454
|
const args = process.argv.slice(2);
|
|
463
455
|
const watchFlag = ['--watch', '-w'];
|
|
464
456
|
const defaultIgnoreFiles = ['logs/*.*'];
|
|
457
|
+
const credential = yield getCredential(ctx, options);
|
|
458
|
+
process.env.EXTENDED_CONTEXT = JSON.stringify({
|
|
459
|
+
tmpSecret: {
|
|
460
|
+
secretId: credential.secretId,
|
|
461
|
+
secretKey: credential.secretKey,
|
|
462
|
+
token: credential.token
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
465
|
if (watchFlag.some((flag) => args.includes(flag))) {
|
|
466
466
|
const cmd = args.filter((arg) => !watchFlag.includes(arg)).join(' ');
|
|
467
467
|
(0, nodemon_1.default)({
|
|
@@ -506,8 +506,10 @@ let RunfRunCommand = class RunfRunCommand extends common_1.Command {
|
|
|
506
506
|
__decorate([
|
|
507
507
|
(0, decorators_1.InjectParams)(),
|
|
508
508
|
__param(0, (0, decorators_1.Log)()),
|
|
509
|
+
__param(1, (0, decorators_1.CmdContext)()),
|
|
510
|
+
__param(2, (0, decorators_1.ArgsOptions)()),
|
|
509
511
|
__metadata("design:type", Function),
|
|
510
|
-
__metadata("design:paramtypes", [decorators_1.Logger]),
|
|
512
|
+
__metadata("design:paramtypes", [decorators_1.Logger, Object, Object]),
|
|
511
513
|
__metadata("design:returntype", Promise)
|
|
512
514
|
], RunfRunCommand.prototype, "execute", null);
|
|
513
515
|
RunfRunCommand = __decorate([
|
package/package.json
CHANGED