@cloudbase/cli 2.3.12-alpha.7 → 2.3.12
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/common.js
CHANGED
|
@@ -134,7 +134,7 @@ class Command extends events_1.EventEmitter {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
createProgram(instance, deprecate, newCmd) {
|
|
137
|
-
const { cmd, desc, options,
|
|
137
|
+
const { cmd, desc, options, requiredEnvId = true, withoutAuth = false } = this.options;
|
|
138
138
|
instance.storeOptionsAsProperties(false);
|
|
139
139
|
options.forEach((option) => {
|
|
140
140
|
const { hideHelp } = option;
|
|
@@ -145,9 +145,6 @@ class Command extends events_1.EventEmitter {
|
|
|
145
145
|
instance.option(option.flags, option.desc);
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
|
-
const argsStr = args.map((argItem) => argItem.flags).join(' ');
|
|
149
|
-
if (argsStr)
|
|
150
|
-
instance.arguments(argsStr);
|
|
151
148
|
instance.description(desc);
|
|
152
149
|
instance.action((...args) => __awaiter(this, void 0, void 0, function* () {
|
|
153
150
|
const params = args.slice(0, -1);
|
package/lib/commands/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.3.12
|
|
3
|
+
"version": "2.3.12",
|
|
4
4
|
"description": "cli tool for cloudbase",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -33,8 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@cloudbase/cloud-api": "^0.5.5",
|
|
35
35
|
"@cloudbase/framework-core": "^1.9.7",
|
|
36
|
-
"@cloudbase/lowcode-cli": "^0.
|
|
37
|
-
"@cloudbase/addon-cli": "0.0.4",
|
|
36
|
+
"@cloudbase/lowcode-cli": "^0.21.1",
|
|
38
37
|
"@cloudbase/manager-node": "4.2.8",
|
|
39
38
|
"@cloudbase/toolbox": "^0.7.5",
|
|
40
39
|
"@sentry/node": "^5.10.2",
|
|
@@ -6,9 +6,6 @@ interface ICommandOption {
|
|
|
6
6
|
desc: string;
|
|
7
7
|
hideHelp?: boolean;
|
|
8
8
|
}
|
|
9
|
-
interface ICommandArgument {
|
|
10
|
-
flags: string;
|
|
11
|
-
}
|
|
12
9
|
export interface ICommandOptions {
|
|
13
10
|
deprecateCmd?: string;
|
|
14
11
|
cmd: string;
|
|
@@ -17,7 +14,6 @@ export interface ICommandOptions {
|
|
|
17
14
|
desc: string;
|
|
18
15
|
};
|
|
19
16
|
childSubCmd?: string;
|
|
20
|
-
args?: ICommandArgument[];
|
|
21
17
|
options: ICommandOption[];
|
|
22
18
|
desc: string;
|
|
23
19
|
requiredEnvId?: boolean;
|
|
@@ -1,170 +0,0 @@
|
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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;
|
|
22
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
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
|
-
};
|
|
31
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
32
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
33
|
-
};
|
|
34
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
35
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
36
|
-
};
|
|
37
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
38
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
39
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
40
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
41
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
42
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
43
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
-
exports.AddonPush = exports.AddonPull = void 0;
|
|
48
|
-
const cloud_api_1 = require("@cloudbase/cloud-api");
|
|
49
|
-
const toolbox_1 = require("@cloudbase/toolbox");
|
|
50
|
-
const decorators_1 = require("../../decorators");
|
|
51
|
-
const utils_1 = require("../../utils");
|
|
52
|
-
const common_1 = require("../common");
|
|
53
|
-
let AddonPull = class AddonPull extends common_1.Command {
|
|
54
|
-
get options() {
|
|
55
|
-
return getOptions({
|
|
56
|
-
childCmd: 'pull',
|
|
57
|
-
options: [
|
|
58
|
-
{
|
|
59
|
-
flags: '--envId <envId>',
|
|
60
|
-
desc: '环境 ID'
|
|
61
|
-
}
|
|
62
|
-
],
|
|
63
|
-
desc: '拉取插件/资源代码',
|
|
64
|
-
requiredEnvId: true,
|
|
65
|
-
hasNameArg: true
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
execute(ctx, options) {
|
|
69
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
const cloudService = yield getCloudServiceInstance(ctx);
|
|
71
|
-
const { resource } = options;
|
|
72
|
-
const { name } = getParams(ctx.params);
|
|
73
|
-
Promise.resolve().then(() => __importStar(require('@cloudbase/addon-cli'))).then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
yield res.pull({ name, resource, envId: ctx.envId, cloudService });
|
|
75
|
-
}));
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
__decorate([
|
|
80
|
-
(0, decorators_1.InjectParams)(),
|
|
81
|
-
__param(0, (0, decorators_1.CmdContext)()),
|
|
82
|
-
__param(1, (0, decorators_1.ArgsOptions)()),
|
|
83
|
-
__metadata("design:type", Function),
|
|
84
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
85
|
-
__metadata("design:returntype", Promise)
|
|
86
|
-
], AddonPull.prototype, "execute", null);
|
|
87
|
-
AddonPull = __decorate([
|
|
88
|
-
(0, common_1.ICommand)({
|
|
89
|
-
supportPrivate: true
|
|
90
|
-
})
|
|
91
|
-
], AddonPull);
|
|
92
|
-
exports.AddonPull = AddonPull;
|
|
93
|
-
let AddonPush = class AddonPush extends common_1.Command {
|
|
94
|
-
get options() {
|
|
95
|
-
return getOptions({
|
|
96
|
-
childCmd: 'push',
|
|
97
|
-
desc: '推送插件/资源代码',
|
|
98
|
-
options: [],
|
|
99
|
-
requiredEnvId: true,
|
|
100
|
-
hasNameArg: false
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
execute(ctx, options) {
|
|
104
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
const cloudService = yield getCloudServiceInstance(ctx);
|
|
106
|
-
const { resource } = options;
|
|
107
|
-
Promise.resolve().then(() => __importStar(require('@cloudbase/addon-cli'))).then((res) => __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
yield res.push({ cloudService, envId: ctx.envId, resource });
|
|
109
|
-
}));
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
__decorate([
|
|
114
|
-
(0, decorators_1.InjectParams)(),
|
|
115
|
-
__param(0, (0, decorators_1.CmdContext)()),
|
|
116
|
-
__param(1, (0, decorators_1.ArgsOptions)()),
|
|
117
|
-
__metadata("design:type", Function),
|
|
118
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
119
|
-
__metadata("design:returntype", Promise)
|
|
120
|
-
], AddonPush.prototype, "execute", null);
|
|
121
|
-
AddonPush = __decorate([
|
|
122
|
-
(0, common_1.ICommand)({
|
|
123
|
-
supportPrivate: true
|
|
124
|
-
})
|
|
125
|
-
], AddonPush);
|
|
126
|
-
exports.AddonPush = AddonPush;
|
|
127
|
-
function getCloudServiceInstance(ctx) {
|
|
128
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
-
let credential;
|
|
130
|
-
if (ctx.hasPrivateSettings) {
|
|
131
|
-
process.env.IS_PRIVATE = 'true';
|
|
132
|
-
const privateSettings = (0, utils_1.getPrivateSettings)(ctx.config, this.options.cmd);
|
|
133
|
-
credential = privateSettings.credential;
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
credential = yield utils_1.authSupevisor.getLoginState();
|
|
137
|
-
}
|
|
138
|
-
return {
|
|
139
|
-
lowcode: cloud_api_1.CloudApiService.getInstance({
|
|
140
|
-
service: 'lowcode',
|
|
141
|
-
proxy: (0, toolbox_1.getProxy)(),
|
|
142
|
-
credential,
|
|
143
|
-
version: '2021-01-08'
|
|
144
|
-
}),
|
|
145
|
-
tcb: cloud_api_1.CloudApiService.getInstance({ service: 'tcb', proxy: (0, toolbox_1.getProxy)(), credential })
|
|
146
|
-
};
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
function getOptions({ childCmd, options, desc, requiredEnvId, hasNameArg }) {
|
|
150
|
-
return {
|
|
151
|
-
cmd: 'addon',
|
|
152
|
-
childCmd,
|
|
153
|
-
options: [
|
|
154
|
-
{
|
|
155
|
-
flags: '--resource <resource>',
|
|
156
|
-
desc: '资源名称。当想操作指定资源而非插件时使用。当前支持 automation / block'
|
|
157
|
-
},
|
|
158
|
-
...options
|
|
159
|
-
],
|
|
160
|
-
args: hasNameArg ? [{ flags: '[name]' }] : [],
|
|
161
|
-
desc,
|
|
162
|
-
requiredEnvId
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
function getParams(ctxParams) {
|
|
166
|
-
const params = ctxParams.filter((param) => typeof param === 'string');
|
|
167
|
-
return {
|
|
168
|
-
name: params[0]
|
|
169
|
-
};
|
|
170
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Command, ICommandOptions } from '../common';
|
|
2
|
-
export declare class AddonPull extends Command {
|
|
3
|
-
get options(): ICommandOptions;
|
|
4
|
-
execute(ctx: any, options: any): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export declare class AddonPush extends Command {
|
|
7
|
-
get options(): ICommandOptions;
|
|
8
|
-
execute(ctx: any, options: any): Promise<void>;
|
|
9
|
-
}
|