@cloudbase/cli 2.3.12-alpha.1 → 2.4.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.
@@ -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, args = [], requiredEnvId = true, withoutAuth = false } = this.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);
@@ -27,4 +27,3 @@ __exportStar(require("./framework"), exports);
27
27
  __exportStar(require("./smart"), exports);
28
28
  __exportStar(require("./lowcode"), exports);
29
29
  __exportStar(require("./run"), exports);
30
- __exportStar(require("./addon"), exports);
@@ -60,11 +60,12 @@ function promisifyProcess(p, pipe = false) {
60
60
  exports.promisifyProcess = promisifyProcess;
61
61
  function getLowcodeCli() {
62
62
  return __awaiter(this, void 0, void 0, function* () {
63
+ var _a;
63
64
  const key = '@cloudbase/lowcode-cli';
64
65
  const cache = new Map();
65
66
  let result;
66
67
  if (!cache.get(key)) {
67
- const module = yield Promise.resolve().then(() => __importStar(require(key)));
68
+ const module = yield (_a = key, Promise.resolve().then(() => __importStar(require(_a))));
68
69
  cache.set(key, module);
69
70
  }
70
71
  result = cache.get(key);
@@ -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.12-alpha.1",
3
+ "version": "2.4.0",
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.20.5",
37
- "@cloudbase/addon-cli": "0.0.1-alpha.3",
36
+ "@cloudbase/lowcode-cli": "^0.21.0",
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;
@@ -11,4 +11,3 @@ export * from './framework';
11
11
  export * from './smart';
12
12
  export * from './lowcode';
13
13
  export * from './run';
14
- export * from './addon';
@@ -1,4 +1,4 @@
1
1
  import { ParamTypes } from '../constants';
2
- declare type GetterFunction = (target: any) => Promise<any> | any;
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 declare type CustomEvent = 'logout';
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 declare type Credential = TmpCredential & PermanentCredential;
36
+ export type Credential = TmpCredential & PermanentCredential;
37
37
  export interface AuthSecret {
38
38
  secretId: string;
39
39
  secretKey: string;
@@ -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
- declare type IAbsUrl = `http://${string}` | `https://${string}`;
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 declare type SizeUnit = 'KB' | 'MB' | 'GB';
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
- declare type fetchReturnType = ReturnType<typeof _fetch>;
3
- declare type UnPromisify<T> = T extends PromiseLike<infer U> ? U : T;
4
- declare type fetchReturnTypeExtracted = UnPromisify<fetchReturnType>;
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
- declare type Task<T> = (flush: (text: string) => void, ...args: any[]) => Promise<T>;
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
- export declare type AsyncTask = () => Promise<any>;
1
+ export type AsyncTask = () => Promise<any>;
2
2
  export declare class AsyncTaskParallelController {
3
3
  maxParallel: number;
4
4
  tasks: AsyncTask[];
@@ -1,4 +1,4 @@
1
- declare type SimpleValue = number | string | boolean;
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,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
@@ -1,89 +0,0 @@
1
- {
2
- "name": "@cloudbase/cli",
3
- "version": "2.2.7",
4
- "description": "cli tool for cloudbase",
5
- "main": "lib/index.js",
6
- "scripts": {
7
- "build": "rimraf lib types && tsc",
8
- "watch": "rimraf lib types && tsc -w",
9
- "dev": "rimraf lib types && tsc -w",
10
- "eslint": "eslint \"./**/*.ts\"",
11
- "test": "jest --runInBand --forceExit --detectOpenHandles --coverage --verbose --testTimeout=10000",
12
- "tsc": "tsc",
13
- "pkg": "pkg ./bin/cloudbase.js --out-path ./pkg",
14
- "postinstall": "node ./post-install.js || exit 0",
15
- "prepublishOnly": "npm run build"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/TencentCloudBase/cloud-base-cli.git"
20
- },
21
- "bin": {
22
- "tcb": "bin/tcb.js",
23
- "cloudbase": "bin/cloudbase.js"
24
- },
25
- "husky": {
26
- "hooks": {
27
- "pre-commit": "npm run build"
28
- }
29
- },
30
- "author": "cwuyiqing@gmail.com",
31
- "license": "ISC",
32
- "dependencies": {
33
- "@cloudbase/cloud-api": "^0.5.5",
34
- "@cloudbase/framework-core": "^1.9.6",
35
- "@cloudbase/lowcode-cli": "^0.18.7",
36
- "@cloudbase/manager-node": "4.0.1",
37
- "@cloudbase/toolbox": "^0.7.5",
38
- "@sentry/node": "^5.10.2",
39
- "address": "^1.1.2",
40
- "chalk": "^2.4.2",
41
- "cli-table3": "^0.5.1",
42
- "commander": "7",
43
- "del": "^5.1.0",
44
- "didyoumean": "^1.2.2",
45
- "enquirer": "^2.3.6",
46
- "execa": "^4.0.3",
47
- "fs-extra": "^8.1.0",
48
- "https-proxy-agent": "^5.0.1",
49
- "inquirer": "^6.5.0",
50
- "lodash": "^4.17.21",
51
- "log-symbols": "^3.0.0",
52
- "lowdb": "^1.0.0",
53
- "make-dir": "^3.0.0",
54
- "node-fetch": "^2.6.0",
55
- "open": "^7.0.0",
56
- "ora": "^4.0.2",
57
- "portfinder": "^1.0.28",
58
- "progress": "^2.0.3",
59
- "query-string": "^6.8.1",
60
- "reflect-metadata": "^0.1.13",
61
- "semver": "^7.3.7",
62
- "tar-fs": "^2.0.1",
63
- "terminal-link": "^2.1.1",
64
- "unzipper": "^0.10.10",
65
- "update-notifier": "^4.0.0",
66
- "xdg-basedir": "^4.0.0",
67
- "yargs": "^16.2.0",
68
- "yargs-parser": "^21.0.1"
69
- },
70
- "devDependencies": {
71
- "@types/jest": "^27",
72
- "@types/koa__router": "^8.0.11",
73
- "@types/lodash": "^4.14.182",
74
- "@types/node": "^12.12.38",
75
- "@types/node-fetch": "^2.5.4",
76
- "@types/react": "^17.0.37",
77
- "@types/semver": "^7.3.9",
78
- "@types/webpack-dev-server": "^3.11.1",
79
- "@typescript-eslint/eslint-plugin": "^4.8.1",
80
- "@typescript-eslint/parser": "^4.8.1",
81
- "eslint": "^7.14.0",
82
- "eslint-config-alloy": "^3.8.2",
83
- "husky": "^3.0.9",
84
- "jest": "^27",
85
- "rimraf": "^3.0.2",
86
- "ts-jest": "^27",
87
- "typescript": "^4.7.2"
88
- }
89
- }
@@ -1,89 +0,0 @@
1
- {
2
- "name": "@cloudbase/cli",
3
- "version": "2.2.8",
4
- "description": "cli tool for cloudbase",
5
- "main": "lib/index.js",
6
- "scripts": {
7
- "build": "rimraf lib types && tsc",
8
- "watch": "rimraf lib types && tsc -w",
9
- "dev": "rimraf lib types && tsc -w",
10
- "eslint": "eslint \"./**/*.ts\"",
11
- "test": "jest --runInBand --forceExit --detectOpenHandles --coverage --verbose --testTimeout=10000",
12
- "tsc": "tsc",
13
- "pkg": "pkg ./bin/cloudbase.js --out-path ./pkg",
14
- "postinstall": "node ./post-install.js || exit 0",
15
- "prepublishOnly": "npm run build"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/TencentCloudBase/cloud-base-cli.git"
20
- },
21
- "bin": {
22
- "tcb": "bin/tcb.js",
23
- "cloudbase": "bin/cloudbase.js"
24
- },
25
- "husky": {
26
- "hooks": {
27
- "pre-commit": "npm run build"
28
- }
29
- },
30
- "author": "cwuyiqing@gmail.com",
31
- "license": "ISC",
32
- "dependencies": {
33
- "@cloudbase/cloud-api": "^0.5.5",
34
- "@cloudbase/framework-core": "^1.9.6",
35
- "@cloudbase/lowcode-cli": "^0.18.7",
36
- "@cloudbase/manager-node": "4.0.1",
37
- "@cloudbase/toolbox": "^0.7.5",
38
- "@sentry/node": "^5.10.2",
39
- "address": "^1.1.2",
40
- "chalk": "^2.4.2",
41
- "cli-table3": "^0.5.1",
42
- "commander": "7",
43
- "del": "^5.1.0",
44
- "didyoumean": "^1.2.2",
45
- "enquirer": "^2.3.6",
46
- "execa": "^4.0.3",
47
- "fs-extra": "^8.1.0",
48
- "https-proxy-agent": "^5.0.1",
49
- "inquirer": "^6.5.0",
50
- "lodash": "^4.17.21",
51
- "log-symbols": "^3.0.0",
52
- "lowdb": "^1.0.0",
53
- "make-dir": "^3.0.0",
54
- "node-fetch": "^2.6.0",
55
- "open": "^7.0.0",
56
- "ora": "^4.0.2",
57
- "portfinder": "^1.0.28",
58
- "progress": "^2.0.3",
59
- "query-string": "^6.8.1",
60
- "reflect-metadata": "^0.1.13",
61
- "semver": "^7.3.7",
62
- "tar-fs": "^2.0.1",
63
- "terminal-link": "^2.1.1",
64
- "unzipper": "^0.10.10",
65
- "update-notifier": "^4.0.0",
66
- "xdg-basedir": "^4.0.0",
67
- "yargs": "^16.2.0",
68
- "yargs-parser": "^21.0.1"
69
- },
70
- "devDependencies": {
71
- "@types/jest": "^27",
72
- "@types/koa__router": "^8.0.11",
73
- "@types/lodash": "^4.14.182",
74
- "@types/node": "^12.12.38",
75
- "@types/node-fetch": "^2.5.4",
76
- "@types/react": "^17.0.37",
77
- "@types/semver": "^7.3.9",
78
- "@types/webpack-dev-server": "^3.11.1",
79
- "@typescript-eslint/eslint-plugin": "^4.8.1",
80
- "@typescript-eslint/parser": "^4.8.1",
81
- "eslint": "^7.14.0",
82
- "eslint-config-alloy": "^3.8.2",
83
- "husky": "^3.0.9",
84
- "jest": "^27",
85
- "rimraf": "^3.0.2",
86
- "ts-jest": "^27",
87
- "typescript": "^4.7.2"
88
- }
89
- }
@@ -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
- }
@@ -1,173 +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 decorators_1 = require("../../decorators");
50
- const utils_1 = require("../../utils");
51
- const common_1 = require("../common");
52
- let AddonPull = class AddonPull extends common_1.Command {
53
- get options() {
54
- return getOptions({
55
- childCmd: 'pull',
56
- options: [
57
- {
58
- flags: '--envId <envId>',
59
- desc: '环境 ID'
60
- }
61
- ],
62
- desc: '拉取插件代码',
63
- requiredEnvId: true,
64
- hasNameArg: true
65
- });
66
- }
67
- execute(ctx, options) {
68
- return __awaiter(this, void 0, void 0, function* () {
69
- const tcbService = yield getTcbServiceInstance(ctx);
70
- const { name, resource } = getParams(ctx.params, true);
71
- Promise.resolve().then(() => __importStar(require('@cloudbase/addon-cli'))).then((res) => __awaiter(this, void 0, void 0, function* () {
72
- yield res.pull({ name, resource, envId: ctx.envId, tcbService });
73
- }));
74
- });
75
- }
76
- };
77
- __decorate([
78
- (0, decorators_1.InjectParams)(),
79
- __param(0, (0, decorators_1.CmdContext)()),
80
- __param(1, (0, decorators_1.ArgsOptions)()),
81
- __metadata("design:type", Function),
82
- __metadata("design:paramtypes", [Object, Object]),
83
- __metadata("design:returntype", Promise)
84
- ], AddonPull.prototype, "execute", null);
85
- AddonPull = __decorate([
86
- (0, common_1.ICommand)({
87
- supportPrivate: true
88
- })
89
- ], AddonPull);
90
- exports.AddonPull = AddonPull;
91
- let AddonPush = class AddonPush extends common_1.Command {
92
- get options() {
93
- return getOptions({
94
- childCmd: 'push',
95
- desc: '推送插件代码',
96
- options: [],
97
- requiredEnvId: true,
98
- hasNameArg: false
99
- });
100
- }
101
- execute(ctx, options) {
102
- return __awaiter(this, void 0, void 0, function* () {
103
- const tcbService = yield getTcbServiceInstance(ctx);
104
- const { resource } = getParams(ctx.params, false);
105
- Promise.resolve().then(() => __importStar(require('@cloudbase/addon-cli'))).then((res) => __awaiter(this, void 0, void 0, function* () {
106
- yield res.push({ tcbService, envId: ctx.envId, resource });
107
- }));
108
- });
109
- }
110
- };
111
- __decorate([
112
- (0, decorators_1.InjectParams)(),
113
- __param(0, (0, decorators_1.CmdContext)()),
114
- __param(1, (0, decorators_1.ArgsOptions)()),
115
- __metadata("design:type", Function),
116
- __metadata("design:paramtypes", [Object, Object]),
117
- __metadata("design:returntype", Promise)
118
- ], AddonPush.prototype, "execute", null);
119
- AddonPush = __decorate([
120
- (0, common_1.ICommand)({
121
- supportPrivate: true
122
- })
123
- ], AddonPush);
124
- exports.AddonPush = AddonPush;
125
- function getTcbServiceInstance(ctx) {
126
- return __awaiter(this, void 0, void 0, function* () {
127
- let credential;
128
- if (ctx.hasPrivateSettings) {
129
- process.env.IS_PRIVATE = 'true';
130
- const privateSettings = (0, utils_1.getPrivateSettings)(ctx.config, this.options.cmd);
131
- credential = privateSettings.credential;
132
- }
133
- else {
134
- credential = yield utils_1.authSupevisor.getLoginState();
135
- }
136
- const tcbService = cloud_api_1.CloudApiService.getInstance({ service: 'tcb', credential });
137
- return tcbService;
138
- });
139
- }
140
- function getOptions({ childCmd, options, desc, requiredEnvId, hasNameArg }) {
141
- return {
142
- cmd: 'addon',
143
- childCmd,
144
- options,
145
- args: hasNameArg
146
- ? [{ flags: '[resource]' }, { flags: '[name]' }]
147
- : [{ flags: '[resource]' }],
148
- desc,
149
- requiredEnvId
150
- };
151
- }
152
- function getParams(ctxParams, hasNameArg) {
153
- const params = ctxParams.filter((param) => typeof param === 'string');
154
- let name, resource;
155
- if (hasNameArg) {
156
- if (params.length === 1) {
157
- name = params[0];
158
- }
159
- else if (params.length === 2) {
160
- resource = params[0];
161
- name = params[1];
162
- }
163
- }
164
- else {
165
- if (params.length === 1) {
166
- resource = params[0];
167
- }
168
- }
169
- return {
170
- name,
171
- resource
172
- };
173
- }
@@ -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
- }