@cloudbase/cli 2.6.0-alpha.7 → 2.7.0-alpha.0
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/env/base.js +1 -2
- package/lib/commands/iac/index.js +642 -0
- package/lib/commands/index.js +1 -1
- package/lib/commands/lowcode/utils.js +2 -1
- package/lib/utils/net/cloud-api-request.js +9 -9
- package/package.json +5 -6
- package/types/commands/iac/index.d.ts +30 -0
- package/types/commands/index.d.ts +1 -1
- package/types/decorators/params/common.d.ts +1 -1
- package/types/types.d.ts +2 -2
- package/types/utils/config.d.ts +1 -1
- package/types/utils/fs/index.d.ts +1 -1
- package/types/utils/net/http-request.d.ts +3 -3
- package/types/utils/output/loading.d.ts +1 -1
- package/types/utils/parallel.d.ts +1 -1
- package/types/utils/validator.d.ts +1 -1
- 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
- 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/.yarnrc.yml +0 -1
- package/lib/commands/constants.js +0 -11
- package/lib/commands/fun/base.js +0 -419
- package/lib/commands/fun/index.js +0 -17
- package/lib/commands/utils.js +0 -47
- package/types/commands/constants.d.ts +0 -8
- package/types/commands/fun/base.d.ts +0 -43
- package/types/commands/fun/index.d.ts +0 -1
- package/types/commands/utils.d.ts +0 -3
|
@@ -18,6 +18,15 @@ const debug_logger_1 = require("../debug-logger");
|
|
|
18
18
|
let commonCredential;
|
|
19
19
|
const isTokenExpired = (credential, gap = 120) => credential.accessTokenExpired && Number(credential.accessTokenExpired) < Date.now() + gap * 1000;
|
|
20
20
|
class CloudApiService {
|
|
21
|
+
static getInstance(service) {
|
|
22
|
+
var _a;
|
|
23
|
+
if ((_a = CloudApiService.serviceCacheMap) === null || _a === void 0 ? void 0 : _a[service]) {
|
|
24
|
+
return CloudApiService.serviceCacheMap[service];
|
|
25
|
+
}
|
|
26
|
+
const apiService = new CloudApiService(service);
|
|
27
|
+
CloudApiService.serviceCacheMap[service] = apiService;
|
|
28
|
+
return apiService;
|
|
29
|
+
}
|
|
21
30
|
constructor(service, baseParams, version = '') {
|
|
22
31
|
this.apiService = new cloud_api_1.CloudApiService({
|
|
23
32
|
service,
|
|
@@ -38,15 +47,6 @@ class CloudApiService {
|
|
|
38
47
|
})
|
|
39
48
|
});
|
|
40
49
|
}
|
|
41
|
-
static getInstance(service) {
|
|
42
|
-
var _a;
|
|
43
|
-
if ((_a = CloudApiService.serviceCacheMap) === null || _a === void 0 ? void 0 : _a[service]) {
|
|
44
|
-
return CloudApiService.serviceCacheMap[service];
|
|
45
|
-
}
|
|
46
|
-
const apiService = new CloudApiService(service);
|
|
47
|
-
CloudApiService.serviceCacheMap[service] = apiService;
|
|
48
|
-
return apiService;
|
|
49
|
-
}
|
|
50
50
|
request(action, data = {}, method = 'POST') {
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
52
|
const region = this.region || (yield (0, toolbox_1.getRegion)());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0-alpha.0",
|
|
4
4
|
"description": "cli tool for cloudbase",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"url": "https://github.com/TencentCloudBase/cloud-base-cli.git"
|
|
21
21
|
},
|
|
22
22
|
"bin": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
23
|
+
"tcb": "bin/tcb.js",
|
|
24
|
+
"cloudbase": "bin/cloudbase.js"
|
|
25
25
|
},
|
|
26
26
|
"husky": {
|
|
27
27
|
"hooks": {
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@cloudbase/cloud-api": "^0.5.5",
|
|
35
35
|
"@cloudbase/framework-core": "^1.9.7",
|
|
36
|
-
"@cloudbase/functions-framework": "^1.0.0-beta.3",
|
|
37
36
|
"@cloudbase/lowcode-cli": "^0.21.1",
|
|
38
37
|
"@cloudbase/manager-node": "4.2.8",
|
|
39
38
|
"@cloudbase/toolbox": "^0.7.5",
|
|
@@ -55,7 +54,6 @@
|
|
|
55
54
|
"lowdb": "^1.0.0",
|
|
56
55
|
"make-dir": "^3.0.0",
|
|
57
56
|
"node-fetch": "^2.6.0",
|
|
58
|
-
"nodemon": "^3.1.4",
|
|
59
57
|
"open": "^7.0.0",
|
|
60
58
|
"ora": "^4.0.2",
|
|
61
59
|
"portfinder": "^1.0.28",
|
|
@@ -69,7 +67,8 @@
|
|
|
69
67
|
"update-notifier": "^4.0.0",
|
|
70
68
|
"xdg-basedir": "^4.0.0",
|
|
71
69
|
"yargs": "^16.2.0",
|
|
72
|
-
"yargs-parser": "^21.0.1"
|
|
70
|
+
"yargs-parser": "^21.0.1",
|
|
71
|
+
"@cloudbase/iac-core": "^0.0.2-alpha.2"
|
|
73
72
|
},
|
|
74
73
|
"devDependencies": {
|
|
75
74
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Logger } from '../../decorators';
|
|
2
|
+
import { Command, ICommandOptions } from '../common';
|
|
3
|
+
export declare class IaCInit extends Command {
|
|
4
|
+
get options(): ICommandOptions;
|
|
5
|
+
execute(ctx: any, options: any, log: Logger): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare class IaCPull extends Command {
|
|
8
|
+
get options(): ICommandOptions;
|
|
9
|
+
execute(ctx: any, options: any, log: Logger): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare class IaCBuild extends Command {
|
|
12
|
+
get options(): ICommandOptions;
|
|
13
|
+
execute(ctx: any, options: any, log: Logger): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare class IaCDev extends Command {
|
|
16
|
+
get options(): ICommandOptions;
|
|
17
|
+
execute(ctx: any, options: any, log: Logger): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare class IaCApply extends Command {
|
|
20
|
+
get options(): ICommandOptions;
|
|
21
|
+
execute(ctx: any, options: any, log: Logger): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
export declare class IaCDestory extends Command {
|
|
24
|
+
get options(): ICommandOptions;
|
|
25
|
+
execute(ctx: any, options: any, log: Logger): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
export declare class IaCState extends Command {
|
|
28
|
+
get options(): ICommandOptions;
|
|
29
|
+
execute(ctx: any, options: any, log: Logger): Promise<void>;
|
|
30
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ParamTypes } from '../constants';
|
|
2
|
-
|
|
2
|
+
type GetterFunction = (target: any) => Promise<any> | any;
|
|
3
3
|
export declare const createParamDecorator: (paramtype: ParamTypes, getter: GetterFunction) => () => (target: any, key: string | symbol, index: number) => void;
|
|
4
4
|
export {};
|
package/types/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export
|
|
2
|
+
export type CustomEvent = 'logout';
|
|
3
3
|
export interface ICommandContext {
|
|
4
4
|
cmd: string;
|
|
5
5
|
envId: string;
|
|
@@ -33,7 +33,7 @@ export interface TmpCredential {
|
|
|
33
33
|
uin?: string;
|
|
34
34
|
hash?: string;
|
|
35
35
|
}
|
|
36
|
-
export
|
|
36
|
+
export type Credential = TmpCredential & PermanentCredential;
|
|
37
37
|
export interface AuthSecret {
|
|
38
38
|
secretId: string;
|
|
39
39
|
secretKey: string;
|
package/types/utils/config.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface IArgs {
|
|
|
10
10
|
}
|
|
11
11
|
export declare const getArgs: () => Arguments<IArgs>;
|
|
12
12
|
export declare function getPrivateSettings(config: ICloudBaseRcSettings, cmd?: string): undefined | IPrivateSettings;
|
|
13
|
-
|
|
13
|
+
type IAbsUrl = `http://${string}` | `https://${string}`;
|
|
14
14
|
export interface IPrivateSettings {
|
|
15
15
|
credential: Credential;
|
|
16
16
|
endpoints: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from './del';
|
|
2
|
-
export
|
|
2
|
+
export type SizeUnit = 'KB' | 'MB' | 'GB';
|
|
3
3
|
export declare function checkFullAccess(dest: string, throwError?: boolean): boolean;
|
|
4
4
|
export declare function checkWritable(dest: string, throwError?: boolean): boolean;
|
|
5
5
|
export declare function checkReadable(dest: string, throwError?: boolean): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _fetch, { RequestInit } from 'node-fetch';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
type fetchReturnType = ReturnType<typeof _fetch>;
|
|
3
|
+
type UnPromisify<T> = T extends PromiseLike<infer U> ? U : T;
|
|
4
|
+
type fetchReturnTypeExtracted = UnPromisify<fetchReturnType>;
|
|
5
5
|
export declare function fetch(url: string, config?: RequestInit): Promise<any>;
|
|
6
6
|
export declare function postFetch(url: string, data?: Record<string, any>): Promise<any>;
|
|
7
7
|
export declare function fetchStream(url: any, config?: Record<string, any>): Promise<fetchReturnTypeExtracted>;
|
|
@@ -8,7 +8,7 @@ declare class Loading {
|
|
|
8
8
|
fail(text: string): void;
|
|
9
9
|
}
|
|
10
10
|
export declare const loadingFactory: () => Loading;
|
|
11
|
-
|
|
11
|
+
type Task<T> = (flush: (text: string) => void, ...args: any[]) => Promise<T>;
|
|
12
12
|
export interface ILoadingOptions {
|
|
13
13
|
startTip?: string;
|
|
14
14
|
successTip?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type SimpleValue = number | string | boolean;
|
|
2
2
|
export declare function assertTruthy(val: SimpleValue | SimpleValue[], errMsg: string): void;
|
|
3
3
|
export declare function assertHas(obj: any, prop: string, errMsg: any): void;
|
|
4
4
|
export declare const validateIp: (ip: string) => boolean;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash'
|
|
2
|
-
import { Command, ICommand } from '../common'
|
|
3
|
-
import { watchApp } from '@cloudbase/lowcode-cli'
|
|
4
|
-
import { InjectParams, Log, Logger, CmdContext, ArgsOptions } from '../../decorators'
|
|
5
|
-
|
|
6
|
-
@ICommand()
|
|
7
|
-
export class LowCodeWatch extends Command {
|
|
8
|
-
get options() {
|
|
9
|
-
return {
|
|
10
|
-
cmd: 'lowcode',
|
|
11
|
-
childCmd: 'watch',
|
|
12
|
-
options: [
|
|
13
|
-
{
|
|
14
|
-
flags: '--verbose',
|
|
15
|
-
desc: '是否打印详细日志'
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
flags: '--wx-devtool-path <wxDevtoolPath>',
|
|
19
|
-
desc: '微信开发者工具的安装路径'
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
desc: '开启云开发低码的本地构建模式',
|
|
23
|
-
requiredEnvId: false
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@InjectParams()
|
|
28
|
-
async execute(@CmdContext() ctx, @ArgsOptions() options) {
|
|
29
|
-
await watchApp({
|
|
30
|
-
watchPort: 8288,
|
|
31
|
-
wxDevtoolPath: options?.wxDevtoolPath
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@ICommand()
|
|
37
|
-
export class DanielWatch extends Command {
|
|
38
|
-
get options() {
|
|
39
|
-
return {
|
|
40
|
-
cmd: 'lowcode',
|
|
41
|
-
childCmd: 'watch-ws',
|
|
42
|
-
options: [],
|
|
43
|
-
desc: '开启云开发低码的本地开发模式',
|
|
44
|
-
requiredEnvId: false
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
@InjectParams()
|
|
49
|
-
async execute(@CmdContext() ctx, @ArgsOptions() options) {
|
|
50
|
-
console.log('>>> 启动啦')
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash'
|
|
2
|
-
import { Command, ICommand } from '../common'
|
|
3
|
-
import { watchApp } from '@cloudbase/lowcode-cli'
|
|
4
|
-
import { InjectParams, Log, Logger, CmdContext, ArgsOptions } from '../../decorators'
|
|
5
|
-
|
|
6
|
-
@ICommand()
|
|
7
|
-
export class LowCodeWatch extends Command {
|
|
8
|
-
get options() {
|
|
9
|
-
return {
|
|
10
|
-
cmd: 'lowcode',
|
|
11
|
-
childCmd: 'watch',
|
|
12
|
-
options: [
|
|
13
|
-
{
|
|
14
|
-
flags: '--verbose',
|
|
15
|
-
desc: '是否打印详细日志'
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
flags: '--wx-devtool-path <wxDevtoolPath>',
|
|
19
|
-
desc: '微信开发者工具的安装路径'
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
desc: '开启云开发低码的本地构建模式',
|
|
23
|
-
requiredEnvId: false
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@InjectParams()
|
|
28
|
-
async execute(@CmdContext() ctx, @ArgsOptions() options) {
|
|
29
|
-
await watchApp({
|
|
30
|
-
watchPort: 8288,
|
|
31
|
-
wxDevtoolPath: options?.wxDevtoolPath
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash'
|
|
2
|
-
import { Command, ICommand } from '../common'
|
|
3
|
-
import { watchApp } from '@cloudbase/lowcode-cli'
|
|
4
|
-
import { InjectParams, Log, Logger, CmdContext, ArgsOptions } from '../../decorators'
|
|
5
|
-
|
|
6
|
-
@ICommand()
|
|
7
|
-
export class LowCodeWatch extends Command {
|
|
8
|
-
get options() {
|
|
9
|
-
return {
|
|
10
|
-
cmd: 'lowcode',
|
|
11
|
-
childCmd: 'watch',
|
|
12
|
-
options: [
|
|
13
|
-
{
|
|
14
|
-
flags: '--verbose',
|
|
15
|
-
desc: '是否打印详细日志'
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
flags: '--wx-devtool-path <wxDevtoolPath>',
|
|
19
|
-
desc: '微信开发者工具的安装路径'
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
desc: '开启微搭低代码的本地构建模式',
|
|
23
|
-
requiredEnvId: false
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@InjectParams()
|
|
28
|
-
async execute(@CmdContext() ctx, @ArgsOptions() options) {
|
|
29
|
-
await watchApp({
|
|
30
|
-
watchPort: 8288,
|
|
31
|
-
wxDevtoolPath: options?.wxDevtoolPath
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata'
|
|
2
|
-
import { registerCommands } from './commands/common'
|
|
3
|
-
import './commands'
|
|
4
|
-
|
|
5
|
-
export { smartDeploy } from './commands'
|
|
6
|
-
|
|
7
|
-
registerCommands()
|
|
8
|
-
|
|
9
|
-
// HACK: 部分依赖使用了 globalThis,会在 Node12 以下的版本报错
|
|
10
|
-
if (typeof globalThis === undefined) {
|
|
11
|
-
// eslint-disable-next-line no-undef
|
|
12
|
-
;(globalThis as any) = global
|
|
13
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata'
|
|
2
|
-
import { registerCommands } from './commands/common'
|
|
3
|
-
import './commands'
|
|
4
|
-
|
|
5
|
-
export { smartDeploy } from './commands'
|
|
6
|
-
|
|
7
|
-
registerCommands()
|
|
8
|
-
|
|
9
|
-
// HACK: 部分依赖使用了 globalThis,会在 Node12 以下的版本报错
|
|
10
|
-
if (typeof globalThis === undefined) {
|
|
11
|
-
// eslint-disable-next-line no-undef
|
|
12
|
-
;(globalThis as any) = global
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
console.log("daniel tcb")
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata'
|
|
2
|
-
import { registerCommands } from './commands/common'
|
|
3
|
-
import './commands'
|
|
4
|
-
|
|
5
|
-
export { smartDeploy } from './commands'
|
|
6
|
-
|
|
7
|
-
registerCommands()
|
|
8
|
-
|
|
9
|
-
// HACK: 部分依赖使用了 globalThis,会在 Node12 以下的版本报错
|
|
10
|
-
if (typeof globalThis === undefined) {
|
|
11
|
-
// eslint-disable-next-line no-undef
|
|
12
|
-
;(globalThis as any) = global
|
|
13
|
-
}
|
package/.yarn/cache/@cloudbase-functions-framework-npm-1.0.0-beta.3-68c4d9136e-3d11f97edc.zip
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/.yarnrc.yml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
nodeLinker: node-modules
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EnvStatus = exports.EnvSource = void 0;
|
|
4
|
-
exports.EnvSource = {
|
|
5
|
-
MINIAPP: 'miniapp',
|
|
6
|
-
QCLOUD: 'qcloud'
|
|
7
|
-
};
|
|
8
|
-
exports.EnvStatus = {
|
|
9
|
-
NORMAL: 'NORMAL',
|
|
10
|
-
UNAVAILABLE: 'UNAVAILABLE'
|
|
11
|
-
};
|