@cloudbase/cli 2.6.0-alpha.6 → 2.6.0-alpha.8
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/.yarn/cache/@cloudbase-functions-framework-npm-1.0.0-beta.11-9bbeceb6ff-3aa0efd307.zip +0 -0
- package/.yarn/cache/@cloudbase-functions-typings-npm-1.0.0-beta.3-0b2fc0975b-ebe46cc101.zip +0 -0
- package/.yarn/cache/ajv-npm-8.17.1-12ade7edc6-1797bf242c.zip +0 -0
- package/.yarn/cache/fast-uri-npm-3.0.1-20477a5d16-106143ff83.zip +0 -0
- package/.yarn/cache/radix3-npm-1.1.2-bf27d7ceee-c4d49a3f60.zip +0 -0
- package/.yarn/install-state.gz +0 -0
- package/lib/commands/fun/base.js +45 -10
- package/package.json +2 -2
- package/.yarn/cache/@cloudbase-functions-framework-npm-1.0.0-beta.3-68c4d9136e-3d11f97edc.zip +0 -0
- package/.yarn/cache/@koa-router-npm-12.0.1-6a9764e4df-4b8d3940cb.zip +0 -0
- package/.yarn/cache/path-to-regexp-npm-6.2.2-0bf7f6805c-b7b0005c36.zip +0 -0
package/.yarn/cache/@cloudbase-functions-framework-npm-1.0.0-beta.11-9bbeceb6ff-3aa0efd307.zip
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/lib/commands/fun/base.js
CHANGED
|
@@ -125,6 +125,10 @@ let FunDeployCommand = class FunDeployCommand extends common_1.Command {
|
|
|
125
125
|
{
|
|
126
126
|
flags: '--includeNodeModules',
|
|
127
127
|
desc: '包含本地 node_modules 目录,默认为 false 不包含'
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
flags: '--functionsConfigFile <functionsConfigFile>',
|
|
131
|
+
desc: '多函数定义配置文件,默认为 ./cloudbase-functions.json'
|
|
128
132
|
}
|
|
129
133
|
],
|
|
130
134
|
requiredEnvId: false,
|
|
@@ -137,18 +141,45 @@ let FunDeployCommand = class FunDeployCommand extends common_1.Command {
|
|
|
137
141
|
let { serviceName, appId, source, includeNodeModules = false } = options;
|
|
138
142
|
const target = 'main';
|
|
139
143
|
source = path_1.default.resolve(source || process.cwd());
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
const functionsConfigFile = options.functionsConfigFile || 'cloudbase-functions.json';
|
|
145
|
+
let multiFunctionsConfig = null;
|
|
146
|
+
if (functionsConfigFile && (yield fs_extra_1.default.exists(path_1.default.resolve(source, functionsConfigFile)))) {
|
|
147
|
+
try {
|
|
148
|
+
debugger;
|
|
149
|
+
multiFunctionsConfig = (0, functions_framework_1.loadFunctionsConfig)(functionsConfigFile);
|
|
144
150
|
}
|
|
145
|
-
|
|
146
|
-
log.error(
|
|
151
|
+
catch (err) {
|
|
152
|
+
log.error(`多函数定义配置文件 ${functionsConfigFile} 配置文件有误,请检查`);
|
|
153
|
+
log.error(err);
|
|
154
|
+
return;
|
|
147
155
|
}
|
|
148
|
-
|
|
149
|
-
|
|
156
|
+
}
|
|
157
|
+
const loadResult = yield (0, functions_framework_1.loadFunctions)({
|
|
158
|
+
target,
|
|
159
|
+
sourceLocation: source,
|
|
160
|
+
multiFunctionsConfig
|
|
161
|
+
});
|
|
162
|
+
if (Array.isArray(loadResult)) {
|
|
163
|
+
for (const loadItem of loadResult) {
|
|
164
|
+
if (!(loadItem === null || loadItem === void 0 ? void 0 : loadItem.userFunction)) {
|
|
165
|
+
log.error(`加载函数 ${loadItem === null || loadItem === void 0 ? void 0 : loadItem.name} 失败: "${loadItem === null || loadItem === void 0 ? void 0 : loadItem.reason}"`);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
if (!(loadResult === null || loadResult === void 0 ? void 0 : loadResult.userFunction)) {
|
|
172
|
+
if (loadResult.reason.includes('is not a loadable module')) {
|
|
173
|
+
log.error(`${source} 不是一个有效的函数式托管代码目录,可以通过 --source <source> 指定代码目录路径`);
|
|
174
|
+
}
|
|
175
|
+
else if (loadResult === null || loadResult === void 0 ? void 0 : loadResult.reason.includes('is not defined in the provided module')) {
|
|
176
|
+
log.error(`主文件并未导出目标函数 ${target},请导出 ${target} 目标函数`);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
log.error(loadResult === null || loadResult === void 0 ? void 0 : loadResult.reason);
|
|
180
|
+
}
|
|
181
|
+
return;
|
|
150
182
|
}
|
|
151
|
-
return;
|
|
152
183
|
}
|
|
153
184
|
if (!envId) {
|
|
154
185
|
envId = yield _selectEnv();
|
|
@@ -229,7 +260,7 @@ let FunDeployCommand = class FunDeployCommand extends common_1.Command {
|
|
|
229
260
|
envId,
|
|
230
261
|
serviceName,
|
|
231
262
|
filePath: source,
|
|
232
|
-
fileToIgnore: includeNodeModules ? [] : ['node_modules', 'node_modules/**/*']
|
|
263
|
+
fileToIgnore: ['logs', 'logs/**/*'].concat(includeNodeModules ? [] : ['node_modules', 'node_modules/**/*'])
|
|
233
264
|
});
|
|
234
265
|
packageName = PackageName;
|
|
235
266
|
packageVersion = PackageVersion;
|
|
@@ -309,6 +340,10 @@ let FunRunCommand = class FunRunCommand extends common_1.Command {
|
|
|
309
340
|
{
|
|
310
341
|
flags: '--logDirname <logDirname>',
|
|
311
342
|
desc: '日志文件目录,默认为 ./logs'
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
flags: '--functionsConfigFile <functionsConfigFile>',
|
|
346
|
+
desc: '多函数定义配置文件,默认为 ./cloudbase-functions.json'
|
|
312
347
|
}
|
|
313
348
|
],
|
|
314
349
|
requiredEnvId: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.6.0-alpha.
|
|
3
|
+
"version": "2.6.0-alpha.8",
|
|
4
4
|
"description": "cli tool for cloudbase",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@cloudbase/cloud-api": "^0.5.5",
|
|
35
35
|
"@cloudbase/framework-core": "^1.9.7",
|
|
36
|
-
"@cloudbase/functions-framework": "
|
|
36
|
+
"@cloudbase/functions-framework": "1.0.0-beta.11",
|
|
37
37
|
"@cloudbase/lowcode-cli": "^0.21.1",
|
|
38
38
|
"@cloudbase/manager-node": "4.2.8",
|
|
39
39
|
"@cloudbase/toolbox": "^0.7.5",
|
package/.yarn/cache/@cloudbase-functions-framework-npm-1.0.0-beta.3-68c4d9136e-3d11f97edc.zip
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|