@cabloy/cli 1.0.8 → 1.0.10

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/dist/start.d.ts DELETED
@@ -1,22 +0,0 @@
1
- import CommonBin from '@zhennann/common-bin';
2
- declare const DISPATCH: unique symbol;
3
- export declare class CabloyCommand extends CommonBin {
4
- constructor(rawArgv?: any);
5
- [DISPATCH](): Promise<void>;
6
- _handleCli(): Promise<void>;
7
- _prepareCliFullName(cliName: any): {
8
- cliFullName: string;
9
- set: any;
10
- group?: undefined;
11
- } | {
12
- cliFullName: string;
13
- set: any;
14
- group: any;
15
- } | {
16
- cliFullName: any;
17
- set?: undefined;
18
- group?: undefined;
19
- };
20
- }
21
- export {};
22
- //# sourceMappingURL=start.d.ts.map
package/dist/start.js DELETED
@@ -1,85 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CabloyCommand = void 0;
7
- const common_bin_1 = __importDefault(require("@zhennann/common-bin"));
8
- const bean_cli_js_1 = require("./lib/bean.cli.js");
9
- const cli_js_1 = require("./lib/cli.js");
10
- const DISPATCH = Symbol.for('eb:Command#dispatch');
11
- const PARSE = Symbol.for('eb:Command#parse');
12
- class CabloyCommand extends common_bin_1.default {
13
- constructor(rawArgv) {
14
- super(rawArgv);
15
- this.usage = 'Usage: cabloy [command] [options]';
16
- }
17
- async [DISPATCH]() {
18
- // cli
19
- await this._handleCli();
20
- }
21
- async _handleCli() {
22
- // get parsed argument without handling helper and version
23
- const parsed = await this[PARSE](this.rawArgv);
24
- // argv
25
- const argv = {
26
- projectPath: process.cwd(),
27
- };
28
- // indexCabloy
29
- const indexCabloy = this.rawArgv.indexOf('cabloy');
30
- // cli
31
- const indexCommand = indexCabloy > -1 ? indexCabloy + 1 : 0;
32
- Object.assign(argv, this._prepareCliFullName(parsed._[indexCommand]));
33
- // cli meta
34
- const context = { argv };
35
- const beanCli = new bean_cli_js_1.BeanCli();
36
- const meta = await beanCli.meta({ context });
37
- // cli run
38
- const rawArgv = this.rawArgv.slice();
39
- if (indexCabloy > -1) {
40
- rawArgv.splice(0, indexCabloy + 2);
41
- }
42
- else {
43
- rawArgv.splice(0, 1);
44
- }
45
- const command = new cli_js_1.CliCommand(rawArgv, { meta, argv });
46
- await command[DISPATCH]();
47
- // force exit
48
- process.exit(0);
49
- }
50
- _prepareCliFullName(cliName) {
51
- if (!cliName) {
52
- return { cliFullName: 'core:default:list' };
53
- // throw new Error('Please specify the cli name');
54
- }
55
- const parts = cliName.split(':');
56
- if (parts.length === 1) {
57
- // means show module's commands
58
- parts[1] = '';
59
- }
60
- if (parts.length === 2) {
61
- if (parts[1]) {
62
- // means show group's commands
63
- parts[2] = '';
64
- }
65
- else {
66
- // means show module's commands
67
- if (!parts[0])
68
- parts[0] = 'core';
69
- return { cliFullName: 'core:default:list', set: parts[0] };
70
- }
71
- }
72
- if (!parts[0])
73
- parts[0] = 'core';
74
- if (!parts[1])
75
- parts[1] = 'default';
76
- if (!parts[2]) {
77
- // means show group's commands
78
- return { cliFullName: 'core:default:list', set: parts[0], group: parts[1] };
79
- }
80
- // default
81
- return { cliFullName: parts.join(':') };
82
- }
83
- }
84
- exports.CabloyCommand = CabloyCommand;
85
- //# sourceMappingURL=start.js.map
@@ -1,22 +0,0 @@
1
- export interface ICommandArgv {
2
- projectPath: string;
3
- cliFullName: string;
4
- }
5
- export interface ICommandContext {
6
- argv: ICommandArgv;
7
- }
8
- export interface CmdOptions {
9
- command: CmdCommand;
10
- context: ICommandContext;
11
- terminal: boolean;
12
- }
13
- export interface CmdCommand {
14
- bean: string;
15
- info: {
16
- version: string;
17
- title: string;
18
- };
19
- options: object;
20
- groups: object | null;
21
- }
22
- //# sourceMappingURL=argv.d.ts.map
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=argv.js.map
@@ -1,9 +0,0 @@
1
- export interface IConsoleLogData {
2
- text: string;
3
- total?: number;
4
- progress?: number;
5
- }
6
- export interface IConsoleLogOptions {
7
- logPrefix?: boolean;
8
- }
9
- //# sourceMappingURL=console.d.ts.map
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=console.js.map
@@ -1,3 +0,0 @@
1
- export * from './argv.js';
2
- export * from './console.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,19 +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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./argv.js"), exports);
18
- __exportStar(require("./console.js"), exports);
19
- //# sourceMappingURL=index.js.map