@cloudbase/cli 2.1.2-alpha.0 → 2.1.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/.vscode/settings.json +3 -0
- package/bin/cloudbase.js +0 -0
- package/bin/tcb.js +0 -0
- package/dist/index.js +1 -0
- package/dist/main.js +1 -0
- package/lib/commands/hosting/hosting.js +2 -2
- package/lib/commands/lowcode/app.js +29 -5
- package/lib/commands/lowcode/comps.js +13 -55
- package/lib/commands/lowcode/utils.js +47 -1
- package/lib/constant.js +8 -1
- package/lib/hosting.js +62 -5
- package/package.json +3 -3
- package/types/commands/lowcode/utils.d.ts +1 -0
- package/types/constant.d.ts +6 -0
- package/types/hosting.d.ts +6 -0
- package/.history/.gitignore_20220624162613 +0 -84
- package/.history/.gitignore_20220627114054 +0 -86
- package/.history/package_20220722205058.json +0 -88
- package/.history/package_20220726110155.json +0 -88
- package/.history/package_20220726110201.json +0 -88
- package/.history/package_20220728110905.json +0 -88
- package/.history/package_20220728110936.json +0 -88
- package/.history/package_20220728111531.json +0 -89
- package/.history/package_20220728111810.json +0 -89
- package/.history/package_20220729165237.json +0 -89
- package/.history/package_20220729165240.json +0 -89
- package/.history/package_20220802111854.json +0 -89
- package/.history/package_20220802112025.json +0 -89
- package/.history/package_20220815113520.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
|
@@ -70,8 +70,8 @@ let HostingDetail = class HostingDetail extends common_1.Command {
|
|
|
70
70
|
const res = yield (0, hosting_1.getHostingInfo)({ envId });
|
|
71
71
|
const website = (_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a[0];
|
|
72
72
|
if (!website) {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
yield (0, hosting_1.initHosting)({ envId });
|
|
74
|
+
return;
|
|
75
75
|
}
|
|
76
76
|
const link = (0, utils_1.genClickableLink)(`https://${website.cdnDomain}`);
|
|
77
77
|
if (website.status !== 'offline') {
|
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
2
18
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
19
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
20
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
21
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
22
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
23
|
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
+
if (mod && mod.__esModule) return mod;
|
|
26
|
+
var result = {};
|
|
27
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
+
__setModuleDefault(result, mod);
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
8
31
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
32
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
33
|
};
|
|
@@ -23,7 +46,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
23
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
47
|
exports.LowCodeWatch = void 0;
|
|
25
48
|
const common_1 = require("../common");
|
|
26
|
-
const lowcode_cli_1 = require("@cloudbase/lowcode-cli");
|
|
27
49
|
const decorators_1 = require("../../decorators");
|
|
28
50
|
let LowCodeWatch = class LowCodeWatch extends common_1.Command {
|
|
29
51
|
get options() {
|
|
@@ -46,10 +68,12 @@ let LowCodeWatch = class LowCodeWatch extends common_1.Command {
|
|
|
46
68
|
}
|
|
47
69
|
execute(ctx, options) {
|
|
48
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
71
|
+
Promise.resolve().then(() => __importStar(require('@cloudbase/lowcode-cli'))).then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
yield res.watchApp({
|
|
73
|
+
watchPort: 8288,
|
|
74
|
+
wxDevtoolPath: options === null || options === void 0 ? void 0 : options.wxDevtoolPath,
|
|
75
|
+
});
|
|
76
|
+
}));
|
|
53
77
|
});
|
|
54
78
|
}
|
|
55
79
|
};
|
|
@@ -43,22 +43,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
|
-
};
|
|
49
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
47
|
exports.LowCodePublishVersionComps = exports.LowCodePublishComps = exports.LowCodeDebugComps = exports.LowCodeBuildComps = exports.LowCodeCreateComps = void 0;
|
|
51
|
-
const path_1 = __importDefault(require("path"));
|
|
52
48
|
const common_1 = require("../common");
|
|
53
49
|
const decorators_1 = require("../../decorators");
|
|
54
50
|
const utils_1 = require("../../utils");
|
|
55
51
|
const error_1 = require("../../error");
|
|
56
|
-
const lowcode_cli_1 = require("@cloudbase/lowcode-cli");
|
|
57
52
|
const enquirer_1 = require("enquirer");
|
|
58
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
59
53
|
const semver = __importStar(require("semver"));
|
|
54
|
+
const utils_2 = require("./utils");
|
|
60
55
|
const cloudService = utils_1.CloudApiService.getInstance('lowcode');
|
|
61
|
-
|
|
56
|
+
let lowcodeCli;
|
|
57
|
+
if (process.argv.includes('lowcode')) {
|
|
58
|
+
(0, utils_2.getLowcodeCli)().then(_ => lowcodeCli = _);
|
|
59
|
+
}
|
|
62
60
|
let LowCodeCreateComps = class LowCodeCreateComps extends common_1.Command {
|
|
63
61
|
get options() {
|
|
64
62
|
return {
|
|
@@ -100,7 +98,7 @@ let LowCodeCreateComps = class LowCodeCreateComps extends common_1.Command {
|
|
|
100
98
|
throw new error_1.CloudBaseError(`云端不存在组件库 ${compsName},请到低码控制台新建该组件库!`);
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
|
-
yield
|
|
101
|
+
yield lowcodeCli.bootstrap(compsName, log);
|
|
104
102
|
});
|
|
105
103
|
}
|
|
106
104
|
};
|
|
@@ -135,11 +133,10 @@ let LowCodeBuildComps = class LowCodeBuildComps extends common_1.Command {
|
|
|
135
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
134
|
const config = ctx.config.lowcodeCustomComponents;
|
|
137
135
|
if (config) {
|
|
138
|
-
yield
|
|
136
|
+
yield lowcodeCli.graceBuildComps(Object.assign(Object.assign({}, config), { context: config.context || process.cwd(), logger: log }));
|
|
139
137
|
return;
|
|
140
138
|
}
|
|
141
|
-
|
|
142
|
-
yield _build(compsPath);
|
|
139
|
+
throw new error_1.CloudBaseError('请参考文档填写 cloudbaserc 配置: https://docs.cloudbase.net/lowcode/custom-components/config/config-comps');
|
|
143
140
|
});
|
|
144
141
|
}
|
|
145
142
|
};
|
|
@@ -182,11 +179,10 @@ let LowCodeDebugComps = class LowCodeDebugComps extends common_1.Command {
|
|
|
182
179
|
return __awaiter(this, void 0, void 0, function* () {
|
|
183
180
|
const config = ctx.config.lowcodeCustomComponents;
|
|
184
181
|
if (config) {
|
|
185
|
-
yield
|
|
182
|
+
yield lowcodeCli.graceDebugComps(Object.assign(Object.assign({}, config), { context: config.context || process.cwd(), debugPort: (options === null || options === void 0 ? void 0 : options.debugPort) || 8388, logger: log, wxDevtoolPath: options === null || options === void 0 ? void 0 : options.wxDevtoolPath }));
|
|
186
183
|
return;
|
|
187
184
|
}
|
|
188
|
-
|
|
189
|
-
yield (0, lowcode_cli_1.debug)(compsPath, (options === null || options === void 0 ? void 0 : options.debugPort) || 8388);
|
|
185
|
+
throw new error_1.CloudBaseError('请参考文档填写 cloudbaserc 配置: https://docs.cloudbase.net/lowcode/custom-components/config/config-comps');
|
|
190
186
|
});
|
|
191
187
|
}
|
|
192
188
|
};
|
|
@@ -227,29 +223,11 @@ let LowCodePublishComps = class LowCodePublishComps extends common_1.Command {
|
|
|
227
223
|
return __awaiter(this, void 0, void 0, function* () {
|
|
228
224
|
const config = ctx.config.lowcodeCustomComponents;
|
|
229
225
|
if (config) {
|
|
230
|
-
yield
|
|
226
|
+
yield lowcodeCli.gracePublishComps(Object.assign(Object.assign({}, config), { context: config.context || process.cwd(), logger: log, isAdmin: Boolean(options.admin) }));
|
|
231
227
|
log.success('组件库 - 已同步到云端,请到低码控制台发布该组件库!');
|
|
232
228
|
return;
|
|
233
229
|
}
|
|
234
|
-
|
|
235
|
-
const compsName = fs_extra_1.default.readJSONSync(path_1.default.resolve(compsPath, 'package.json')).name;
|
|
236
|
-
const res = yield cloudService.request('ListUserCompositeGroups');
|
|
237
|
-
const comps = res === null || res === void 0 ? void 0 : res.data;
|
|
238
|
-
if (!(comps === null || comps === void 0 ? void 0 : comps.count)) {
|
|
239
|
-
throw new error_1.CloudBaseError(`云端不存在组件库 ${compsName},请到低码控制台新建该组件库!`);
|
|
240
|
-
}
|
|
241
|
-
const comp = comps.rows.find((row) => row.groupName === compsName);
|
|
242
|
-
if (!comp) {
|
|
243
|
-
throw new error_1.CloudBaseError(`云端不存在组件库 ${compsName},请到低码控制台新建该组件库!`);
|
|
244
|
-
}
|
|
245
|
-
yield _build(compsPath);
|
|
246
|
-
yield _publish({
|
|
247
|
-
id: comp.id,
|
|
248
|
-
name: compsName,
|
|
249
|
-
path: compsPath,
|
|
250
|
-
log,
|
|
251
|
-
});
|
|
252
|
-
log.info('\n👉 组件库已经同步到云端,请到低码控制台发布该组件库!');
|
|
230
|
+
throw new error_1.CloudBaseError('请参考文档填写 cloudbaserc 配置: https://docs.cloudbase.net/lowcode/custom-components/config/config-comps');
|
|
253
231
|
});
|
|
254
232
|
}
|
|
255
233
|
};
|
|
@@ -313,7 +291,7 @@ let LowCodePublishVersionComps = class LowCodePublishVersionComps extends common
|
|
|
313
291
|
if (!config) {
|
|
314
292
|
log.error('组件库 - 请添加组件库配置到cloudbaserc.json 以使用该命令');
|
|
315
293
|
}
|
|
316
|
-
const res = yield
|
|
294
|
+
const res = yield lowcodeCli.publishVersion(Object.assign(Object.assign({}, config), { context: config.context || process.cwd(), logger: log, isAdmin: options.admin }), comment, tag);
|
|
317
295
|
if (res.data.code === 200) {
|
|
318
296
|
log.success('组件库 - 已发布新版本!');
|
|
319
297
|
return;
|
|
@@ -351,23 +329,3 @@ LowCodePublishVersionComps = __decorate([
|
|
|
351
329
|
(0, common_1.ICommand)()
|
|
352
330
|
], LowCodePublishVersionComps);
|
|
353
331
|
exports.LowCodePublishVersionComps = LowCodePublishVersionComps;
|
|
354
|
-
function _build(compsPath) {
|
|
355
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
356
|
-
yield (0, utils_1.execWithLoading)(() => __awaiter(this, void 0, void 0, function* () {
|
|
357
|
-
yield (0, lowcode_cli_1.build)(compsPath);
|
|
358
|
-
}), {
|
|
359
|
-
startTip: '组件库 - 构建中',
|
|
360
|
-
successTip: '组件库 - 构建成功'
|
|
361
|
-
});
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
function _publish(info) {
|
|
365
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
366
|
-
yield (0, utils_1.execWithLoading)(() => __awaiter(this, void 0, void 0, function* () {
|
|
367
|
-
yield (0, lowcode_cli_1.publishComps)(info);
|
|
368
|
-
}), {
|
|
369
|
-
startTip: '组件库 - 发布中',
|
|
370
|
-
successTip: '组件库 - 发布成功'
|
|
371
|
-
});
|
|
372
|
-
});
|
|
373
|
-
}
|
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
2
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promisifyProcess = void 0;
|
|
35
|
+
exports.getLowcodeCli = exports.promisifyProcess = void 0;
|
|
4
36
|
const toolbox_1 = require("@cloudbase/toolbox");
|
|
5
37
|
function promisifyProcess(p, pipe = false) {
|
|
6
38
|
return new Promise((resolve, reject) => {
|
|
@@ -23,3 +55,17 @@ function promisifyProcess(p, pipe = false) {
|
|
|
23
55
|
});
|
|
24
56
|
}
|
|
25
57
|
exports.promisifyProcess = promisifyProcess;
|
|
58
|
+
function getLowcodeCli() {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const key = '@cloudbase/lowcode-cli';
|
|
61
|
+
const cache = new Map();
|
|
62
|
+
let result;
|
|
63
|
+
if (!cache.get(key)) {
|
|
64
|
+
const module = yield Promise.resolve().then(() => __importStar(require(key)));
|
|
65
|
+
cache.set(key, module);
|
|
66
|
+
}
|
|
67
|
+
result = cache.get(key);
|
|
68
|
+
return result;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
exports.getLowcodeCli = getLowcodeCli;
|
package/lib/constant.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_CPU_MEM_SET = exports.CPU_MEM_OPTS = exports.ConcurrencyTaskStatus = exports.StatusMap = exports.ALL_COMMANDS = exports.STATUS_TEXT = exports.REQUEST_TIMEOUT = exports.DefaultCloudBaseConfig = exports.DefaultFunctionDeployConfig = exports.ConfigItems = void 0;
|
|
3
|
+
exports.EnvType = exports.DEFAULT_CPU_MEM_SET = exports.CPU_MEM_OPTS = exports.ConcurrencyTaskStatus = exports.StatusMap = exports.ALL_COMMANDS = exports.STATUS_TEXT = exports.REQUEST_TIMEOUT = exports.DefaultCloudBaseConfig = exports.DefaultFunctionDeployConfig = exports.ConfigItems = void 0;
|
|
4
4
|
class ConfigItems {
|
|
5
5
|
}
|
|
6
6
|
exports.ConfigItems = ConfigItems;
|
|
@@ -132,3 +132,10 @@ exports.DEFAULT_CPU_MEM_SET = [
|
|
|
132
132
|
PolicyThreshold: 60
|
|
133
133
|
},
|
|
134
134
|
];
|
|
135
|
+
var EnvType;
|
|
136
|
+
(function (EnvType) {
|
|
137
|
+
EnvType["BAAS"] = "baas";
|
|
138
|
+
EnvType["RUN"] = "run";
|
|
139
|
+
EnvType["HOTING"] = "hoting";
|
|
140
|
+
EnvType["WEDA"] = "weda";
|
|
141
|
+
})(EnvType = exports.EnvType || (exports.EnvType = {}));
|
package/lib/hosting.js
CHANGED
|
@@ -12,10 +12,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.walkLocalDir = exports.hostingDelete = exports.hostingDeploy = exports.destroyHosting = exports.hostingList = exports.enableHosting = exports.checkHostingStatus = exports.getHostingInfo = void 0;
|
|
15
|
+
exports.walkLocalDir = exports.hostingDelete = exports.hostingDeploy = exports.destroyHosting = exports.hostingList = exports.subscribeHosting = exports.getEnvInfoByEnvId = exports.enableHosting = exports.checkHostingStatus = exports.initHosting = exports.getHostingInfo = void 0;
|
|
16
16
|
const path_1 = __importDefault(require("path"));
|
|
17
17
|
const utils_1 = require("./utils");
|
|
18
18
|
const error_1 = require("./error");
|
|
19
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
20
|
+
const constant_1 = require("./constant");
|
|
19
21
|
const HostingStatusMap = {
|
|
20
22
|
init: '初始化中',
|
|
21
23
|
process: '处理中',
|
|
@@ -37,15 +39,45 @@ function getHostingInfo(options) {
|
|
|
37
39
|
});
|
|
38
40
|
}
|
|
39
41
|
exports.getHostingInfo = getHostingInfo;
|
|
40
|
-
function
|
|
42
|
+
function initHosting(options) {
|
|
41
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
44
|
+
const { envId } = options;
|
|
45
|
+
const envInfo = yield getEnvInfoByEnvId({ envId });
|
|
46
|
+
if (envInfo.EnvType === constant_1.EnvType.BAAS) {
|
|
47
|
+
const { confirm } = yield inquirer_1.default.prompt({
|
|
48
|
+
type: 'confirm',
|
|
49
|
+
name: 'confirm',
|
|
50
|
+
message: '您还未开通静态托管,是否立即开通?'
|
|
51
|
+
});
|
|
52
|
+
if (confirm) {
|
|
53
|
+
const res = yield subscribeHosting({ envId });
|
|
54
|
+
if (!res.code) {
|
|
55
|
+
utils_1.logger.success('开通静态托管成功!资源正在初始化中,请稍候3~5分钟再试...');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
throw new error_1.CloudBaseError(`开通静态托管失败\n request id: ${res.requestId}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const link = (0, utils_1.genClickableLink)('https://console.cloud.tencent.com/tcb');
|
|
45
67
|
throw new error_1.CloudBaseError(`您还没有开启静态网站服务,请先到云开发控制台开启静态网站服务!\n👉 ${link}`, {
|
|
46
68
|
code: 'INVALID_OPERATION'
|
|
47
69
|
});
|
|
48
70
|
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
exports.initHosting = initHosting;
|
|
74
|
+
function checkHostingStatus(envId) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const hostings = yield getHostingInfo({ envId });
|
|
77
|
+
if (!hostings.data || !hostings.data.length) {
|
|
78
|
+
yield initHosting({ envId });
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
49
81
|
const website = hostings.data[0];
|
|
50
82
|
if (website.status !== 'online') {
|
|
51
83
|
throw new error_1.CloudBaseError(`静态网站服务【${HostingStatusMap[website.status]}】,无法进行此操作!`, {
|
|
@@ -78,6 +110,31 @@ function enableHosting(options) {
|
|
|
78
110
|
});
|
|
79
111
|
}
|
|
80
112
|
exports.enableHosting = enableHosting;
|
|
113
|
+
function getEnvInfoByEnvId(options) {
|
|
114
|
+
var _a;
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
const { envId } = options;
|
|
117
|
+
const res = yield tcbService.request('DescribeEnvs', {
|
|
118
|
+
EnvId: envId
|
|
119
|
+
});
|
|
120
|
+
return (_a = res === null || res === void 0 ? void 0 : res.EnvList) === null || _a === void 0 ? void 0 : _a.filter(item => item.EnvId === envId)[0];
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
exports.getEnvInfoByEnvId = getEnvInfoByEnvId;
|
|
124
|
+
function subscribeHosting(options) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
const { envId } = options;
|
|
127
|
+
const res = yield tcbService.request('DescribeStaticStore', {
|
|
128
|
+
EnvId: envId
|
|
129
|
+
});
|
|
130
|
+
const code = res.Result === 'succ' ? 0 : -1;
|
|
131
|
+
return {
|
|
132
|
+
code,
|
|
133
|
+
requestId: res.RequestId
|
|
134
|
+
};
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
exports.subscribeHosting = subscribeHosting;
|
|
81
138
|
function hostingList(options) {
|
|
82
139
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
140
|
const { envId } = options;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
4
4
|
"description": "cli tool for cloudbase",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"license": "ISC",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@cloudbase/cloud-api": "^0.5.5",
|
|
34
|
-
"@cloudbase/framework-core": "^1.
|
|
35
|
-
"@cloudbase/lowcode-cli": "0.
|
|
34
|
+
"@cloudbase/framework-core": "^1.9.5",
|
|
35
|
+
"@cloudbase/lowcode-cli": "^0.16.0",
|
|
36
36
|
"@cloudbase/manager-node": "4.0.1",
|
|
37
37
|
"@cloudbase/toolbox": "^0.7.3",
|
|
38
38
|
"@sentry/node": "^5.10.2",
|
package/types/constant.d.ts
CHANGED
package/types/hosting.d.ts
CHANGED
|
@@ -13,11 +13,17 @@ interface IHostingCloudOptions extends IBaseOptions {
|
|
|
13
13
|
isDir: boolean;
|
|
14
14
|
}
|
|
15
15
|
export declare function getHostingInfo(options: IBaseOptions): Promise<any>;
|
|
16
|
+
export declare function initHosting(options: IBaseOptions): Promise<void>;
|
|
16
17
|
export declare function checkHostingStatus(envId: string): Promise<any>;
|
|
17
18
|
export declare function enableHosting(options: IBaseOptions): Promise<{
|
|
18
19
|
code: number;
|
|
19
20
|
requestId: any;
|
|
20
21
|
}>;
|
|
22
|
+
export declare function getEnvInfoByEnvId(options: IBaseOptions): Promise<any>;
|
|
23
|
+
export declare function subscribeHosting(options: IBaseOptions): Promise<{
|
|
24
|
+
code: number;
|
|
25
|
+
requestId: any;
|
|
26
|
+
}>;
|
|
21
27
|
export declare function hostingList(options: IBaseOptions): Promise<import("@cloudbase/manager-node/types/interfaces").IListFileInfo[]>;
|
|
22
28
|
export declare function destroyHosting(options: IBaseOptions): Promise<{
|
|
23
29
|
code: number;
|
|
@@ -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
|