@cloudbase/cli 2.6.0-alpha.3 → 2.6.0-alpha.5

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.
Binary file
@@ -54,7 +54,6 @@ let FunListCommand = class FunListCommand extends common_1.Command {
54
54
  };
55
55
  }
56
56
  execute(envId, log) {
57
- var _a;
58
57
  return __awaiter(this, void 0, void 0, function* () {
59
58
  const loading = (0, utils_1.loadingFactory)();
60
59
  if (!envId) {
@@ -69,10 +68,13 @@ let FunListCommand = class FunListCommand extends common_1.Command {
69
68
  .request('DescribeCloudBaseRunServers', {
70
69
  EnvId: envId,
71
70
  Limit: 100,
72
- Offset: 0
71
+ Offset: 0,
72
+ Filter: {
73
+ Tag: 'function'
74
+ }
73
75
  })
74
76
  .finally(() => loading.stop());
75
- const serverList = (_a = serverListRes.CloudBaseRunServerSet) === null || _a === void 0 ? void 0 : _a.filter((item) => item.Tag === 'function');
77
+ const serverList = serverListRes.CloudBaseRunServerSet;
76
78
  const head = ['服务名称', '状态', '创建时间', '更新时间'];
77
79
  const tableData = serverList.map((serverItem) => [
78
80
  serverItem.ServerName,
@@ -121,6 +123,10 @@ let FunDeployCommand = class FunDeployCommand extends common_1.Command {
121
123
  {
122
124
  flags: '--source <source>',
123
125
  desc: '目标函数文件所在目录路径。默认为当前路径'
126
+ },
127
+ {
128
+ flags: '--includeNodeModules',
129
+ desc: '包含本地 node_modules 目录,默认为 false 不包含'
124
130
  }
125
131
  ],
126
132
  requiredEnvId: false,
@@ -130,7 +136,7 @@ let FunDeployCommand = class FunDeployCommand extends common_1.Command {
130
136
  }
131
137
  execute(envId, log, options) {
132
138
  return __awaiter(this, void 0, void 0, function* () {
133
- let { serviceName, appId, source } = options;
139
+ let { serviceName, appId, source, includeNodeModules = false } = options;
134
140
  const target = 'main';
135
141
  source = path_1.default.resolve(source || process.cwd());
136
142
  const loadResult = yield (0, functions_framework_1.loadUserFunction)(source, target);
@@ -171,7 +177,7 @@ let FunDeployCommand = class FunDeployCommand extends common_1.Command {
171
177
  Limit: 1,
172
178
  Offset: 0
173
179
  });
174
- if (fetchSvrRes.ServerName && fetchSvrRes.Tag !== 'function') {
180
+ if (fetchSvrRes.ServerName && !_hasTag(fetchSvrRes.Tags, 'function')) {
175
181
  log.error(`${serviceName} 服务已存在,但不是一个函数式托管服务,请使用另外的服务名称`);
176
182
  return;
177
183
  }
@@ -224,7 +230,8 @@ let FunDeployCommand = class FunDeployCommand extends common_1.Command {
224
230
  const { PackageName, PackageVersion } = yield (0, run_1.packageDeploy)({
225
231
  envId,
226
232
  serviceName,
227
- filePath: source
233
+ filePath: source,
234
+ fileToIgnore: includeNodeModules ? [] : ['node_modules/**/*']
228
235
  });
229
236
  packageName = PackageName;
230
237
  packageVersion = PackageVersion;
@@ -405,3 +412,8 @@ function _inputAppId(defaultVal = '') {
405
412
  return answers['appId'];
406
413
  });
407
414
  }
415
+ function _hasTag(tagsStr, target) {
416
+ const tags = tagsStr.split(',');
417
+ const tag_list = tags.map((item) => item.split(':')[0]);
418
+ return tag_list.includes(target);
419
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cli",
3
- "version": "2.6.0-alpha.3",
3
+ "version": "2.6.0-alpha.5",
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": "^0.0.12",
36
+ "@cloudbase/functions-framework": "^1.0.0-beta.3",
37
37
  "@cloudbase/lowcode-cli": "^0.21.1",
38
38
  "@cloudbase/manager-node": "4.2.8",
39
39
  "@cloudbase/toolbox": "^0.7.5",