@antelopejs/core 1.10.2 → 1.11.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/README.md +1 -1
- package/dist/core/cli/cancellation.d.ts +4 -0
- package/dist/core/cli/cancellation.js +19 -0
- package/dist/core/cli/cancellation.js.map +1 -0
- package/dist/core/cli/cli-ui.d.ts +8 -13
- package/dist/core/cli/cli-ui.js +36 -116
- package/dist/core/cli/cli-ui.js.map +1 -1
- package/dist/core/cli/command.d.ts +11 -0
- package/dist/core/cli/command.js +30 -4
- package/dist/core/cli/command.js.map +1 -1
- package/dist/core/cli/commands/config/get-action.d.ts +6 -0
- package/dist/core/cli/commands/config/get-action.js +39 -0
- package/dist/core/cli/commands/config/get-action.js.map +1 -0
- package/dist/core/cli/commands/config/get.d.ts +2 -1
- package/dist/core/cli/commands/config/get.js +50 -33
- package/dist/core/cli/commands/config/get.js.map +1 -1
- package/dist/core/cli/commands/config/index.js +2 -2
- package/dist/core/cli/commands/config/index.js.map +1 -1
- package/dist/core/cli/commands/config/keys.d.ts +3 -0
- package/dist/core/cli/commands/config/keys.js +13 -0
- package/dist/core/cli/commands/config/keys.js.map +1 -0
- package/dist/core/cli/commands/config/reset-action.d.ts +5 -0
- package/dist/core/cli/commands/config/reset-action.js +45 -0
- package/dist/core/cli/commands/config/reset-action.js.map +1 -0
- package/dist/core/cli/commands/config/reset.js +13 -49
- package/dist/core/cli/commands/config/reset.js.map +1 -1
- package/dist/core/cli/commands/config/set-action.d.ts +1 -0
- package/dist/core/cli/commands/config/set-action.js +24 -0
- package/dist/core/cli/commands/config/set-action.js.map +1 -0
- package/dist/core/cli/commands/config/set.js +48 -34
- package/dist/core/cli/commands/config/set.js.map +1 -1
- package/dist/core/cli/commands/config/show-action.d.ts +6 -0
- package/dist/core/cli/commands/config/show-action.js +38 -0
- package/dist/core/cli/commands/config/show-action.js.map +1 -0
- package/dist/core/cli/commands/config/show.d.ts +2 -1
- package/dist/core/cli/commands/config/show.js +45 -23
- package/dist/core/cli/commands/config/show.js.map +1 -1
- package/dist/core/cli/commands/module/index.js +2 -1
- package/dist/core/cli/commands/module/index.js.map +1 -1
- package/dist/core/cli/commands/module/init-action.d.ts +20 -0
- package/dist/core/cli/commands/module/init-action.js +311 -0
- package/dist/core/cli/commands/module/init-action.js.map +1 -0
- package/dist/core/cli/commands/module/init.d.ts +0 -5
- package/dist/core/cli/commands/module/init.js +29 -168
- package/dist/core/cli/commands/module/init.js.map +1 -1
- package/dist/core/cli/commands/module/test-action.d.ts +5 -0
- package/dist/core/cli/commands/module/test-action.js +45 -0
- package/dist/core/cli/commands/module/test-action.js.map +1 -0
- package/dist/core/cli/commands/module/test.d.ts +0 -5
- package/dist/core/cli/commands/module/test.js +51 -30
- package/dist/core/cli/commands/module/test.js.map +1 -1
- package/dist/core/cli/commands/plugins-action.d.ts +7 -0
- package/dist/core/cli/commands/plugins-action.js +17 -0
- package/dist/core/cli/commands/plugins-action.js.map +1 -0
- package/dist/core/cli/commands/plugins.d.ts +2 -1
- package/dist/core/cli/commands/plugins.js +58 -25
- package/dist/core/cli/commands/plugins.js.map +1 -1
- package/dist/core/cli/commands/project/build-action.d.ts +7 -0
- package/dist/core/cli/commands/project/build-action.js +54 -0
- package/dist/core/cli/commands/project/build-action.js.map +1 -0
- package/dist/core/cli/commands/project/build.js +48 -64
- package/dist/core/cli/commands/project/build.js.map +1 -1
- package/dist/core/cli/commands/project/dev-action.d.ts +13 -0
- package/dist/core/cli/commands/project/dev-action.js +231 -0
- package/dist/core/cli/commands/project/dev-action.js.map +1 -0
- package/dist/core/cli/commands/project/dev.d.ts +1 -2
- package/dist/core/cli/commands/project/dev.js +28 -206
- package/dist/core/cli/commands/project/dev.js.map +1 -1
- package/dist/core/cli/commands/project/index.js +2 -2
- package/dist/core/cli/commands/project/index.js.map +1 -1
- package/dist/core/cli/commands/project/init-action.d.ts +10 -0
- package/dist/core/cli/commands/project/init-action.js +183 -0
- package/dist/core/cli/commands/project/init-action.js.map +1 -0
- package/dist/core/cli/commands/project/init.js +62 -111
- package/dist/core/cli/commands/project/init.js.map +1 -1
- package/dist/core/cli/commands/project/logging/index.js +2 -2
- package/dist/core/cli/commands/project/logging/index.js.map +1 -1
- package/dist/core/cli/commands/project/logging/logging-draft.d.ts +14 -0
- package/dist/core/cli/commands/project/logging/logging-draft.js +34 -0
- package/dist/core/cli/commands/project/logging/logging-draft.js.map +1 -0
- package/dist/core/cli/commands/project/logging/set-action.d.ts +2 -0
- package/dist/core/cli/commands/project/logging/set-action.js +217 -0
- package/dist/core/cli/commands/project/logging/set-action.js.map +1 -0
- package/dist/core/cli/commands/project/logging/set-operations.d.ts +24 -0
- package/dist/core/cli/commands/project/logging/set-operations.js +115 -0
- package/dist/core/cli/commands/project/logging/set-operations.js.map +1 -0
- package/dist/core/cli/commands/project/logging/set-usage.d.ts +8 -0
- package/dist/core/cli/commands/project/logging/set-usage.js +71 -0
- package/dist/core/cli/commands/project/logging/set-usage.js.map +1 -0
- package/dist/core/cli/commands/project/logging/set.js +98 -355
- package/dist/core/cli/commands/project/logging/set.js.map +1 -1
- package/dist/core/cli/commands/project/logging/show-action.d.ts +8 -0
- package/dist/core/cli/commands/project/logging/show-action.js +71 -0
- package/dist/core/cli/commands/project/logging/show-action.js.map +1 -0
- package/dist/core/cli/commands/project/logging/show.d.ts +2 -1
- package/dist/core/cli/commands/project/logging/show.js +54 -89
- package/dist/core/cli/commands/project/logging/show.js.map +1 -1
- package/dist/core/cli/commands/project/modules/add-action.d.ts +17 -0
- package/dist/core/cli/commands/project/modules/add-action.js +240 -0
- package/dist/core/cli/commands/project/modules/add-action.js.map +1 -0
- package/dist/core/cli/commands/project/modules/add.d.ts +1 -15
- package/dist/core/cli/commands/project/modules/add.js +56 -261
- package/dist/core/cli/commands/project/modules/add.js.map +1 -1
- package/dist/core/cli/commands/project/modules/index.js +2 -2
- package/dist/core/cli/commands/project/modules/index.js.map +1 -1
- package/dist/core/cli/commands/project/modules/install-action.d.ts +17 -0
- package/dist/core/cli/commands/project/modules/install-action.js +265 -0
- package/dist/core/cli/commands/project/modules/install-action.js.map +1 -0
- package/dist/core/cli/commands/project/modules/install.d.ts +0 -9
- package/dist/core/cli/commands/project/modules/install.js +54 -240
- package/dist/core/cli/commands/project/modules/install.js.map +1 -1
- package/dist/core/cli/commands/project/modules/list-action.d.ts +8 -0
- package/dist/core/cli/commands/project/modules/list-action.js +85 -0
- package/dist/core/cli/commands/project/modules/list-action.js.map +1 -0
- package/dist/core/cli/commands/project/modules/list.d.ts +2 -1
- package/dist/core/cli/commands/project/modules/list.js +54 -116
- package/dist/core/cli/commands/project/modules/list.js.map +1 -1
- package/dist/core/cli/commands/project/modules/remove-action.d.ts +7 -0
- package/dist/core/cli/commands/project/modules/remove-action.js +81 -0
- package/dist/core/cli/commands/project/modules/remove-action.js.map +1 -0
- package/dist/core/cli/commands/project/modules/remove.d.ts +0 -7
- package/dist/core/cli/commands/project/modules/remove.js +50 -100
- package/dist/core/cli/commands/project/modules/remove.js.map +1 -1
- package/dist/core/cli/commands/project/modules/update-action.d.ts +7 -0
- package/dist/core/cli/commands/project/modules/update-action.js +117 -0
- package/dist/core/cli/commands/project/modules/update-action.js.map +1 -0
- package/dist/core/cli/commands/project/modules/update.js +54 -86
- package/dist/core/cli/commands/project/modules/update.js.map +1 -1
- package/dist/core/cli/commands/project/run.js +2 -2
- package/dist/core/cli/commands/project/run.js.map +1 -1
- package/dist/core/cli/commands/project/start-action.d.ts +8 -0
- package/dist/core/cli/commands/project/start-action.js +47 -0
- package/dist/core/cli/commands/project/start-action.js.map +1 -0
- package/dist/core/cli/commands/project/start.js +53 -55
- package/dist/core/cli/commands/project/start.js.map +1 -1
- package/dist/core/cli/commands/shared/names.d.ts +1 -0
- package/dist/core/cli/commands/shared/names.js +10 -0
- package/dist/core/cli/commands/shared/names.js.map +1 -0
- package/dist/core/cli/commands/shared/next-steps.d.ts +5 -0
- package/dist/core/cli/commands/shared/next-steps.js +26 -0
- package/dist/core/cli/commands/shared/next-steps.js.map +1 -0
- package/dist/core/cli/commands/shared/project-command.d.ts +9 -0
- package/dist/core/cli/commands/shared/project-command.js +79 -14
- package/dist/core/cli/commands/shared/project-command.js.map +1 -1
- package/dist/core/cli/commands/update.js +47 -9
- package/dist/core/cli/commands/update.js.map +1 -1
- package/dist/core/cli/common.d.ts +3 -8
- package/dist/core/cli/common.js +26 -32
- package/dist/core/cli/common.js.map +1 -1
- package/dist/core/cli/exit-codes.d.ts +2 -0
- package/dist/core/cli/exit-codes.js +4 -1
- package/dist/core/cli/exit-codes.js.map +1 -1
- package/dist/core/cli/full-cli.js +62 -41
- package/dist/core/cli/full-cli.js.map +1 -1
- package/dist/core/cli/git-operations.js +10 -17
- package/dist/core/cli/git-operations.js.map +1 -1
- package/dist/core/cli/help.d.ts +8 -0
- package/dist/core/cli/help.js +34 -0
- package/dist/core/cli/help.js.map +1 -0
- package/dist/core/cli/index.js +7 -15
- package/dist/core/cli/index.js.map +1 -1
- package/dist/core/cli/lazy-action.d.ts +4 -0
- package/dist/core/cli/lazy-action.js +10 -0
- package/dist/core/cli/lazy-action.js.map +1 -0
- package/dist/core/cli/logging-utils.js +18 -14
- package/dist/core/cli/logging-utils.js.map +1 -1
- package/dist/core/cli/options.d.ts +20 -0
- package/dist/core/cli/options.js +51 -0
- package/dist/core/cli/options.js.map +1 -0
- package/dist/core/cli/output/boundary.d.ts +6 -0
- package/dist/core/cli/output/boundary.js +38 -0
- package/dist/core/cli/output/boundary.js.map +1 -0
- package/dist/core/cli/output/capabilities.d.ts +9 -0
- package/dist/core/cli/output/capabilities.js +113 -0
- package/dist/core/cli/output/capabilities.js.map +1 -0
- package/dist/core/cli/output/data.d.ts +7 -0
- package/dist/core/cli/output/data.js +11 -0
- package/dist/core/cli/output/data.js.map +1 -0
- package/dist/core/cli/output/errors.d.ts +14 -0
- package/dist/core/cli/output/errors.js +67 -0
- package/dist/core/cli/output/errors.js.map +1 -0
- package/dist/core/cli/output/failures.d.ts +3 -0
- package/dist/core/cli/output/failures.js +94 -0
- package/dist/core/cli/output/failures.js.map +1 -0
- package/dist/core/cli/output/format.d.ts +7 -0
- package/dist/core/cli/output/format.js +64 -0
- package/dist/core/cli/output/format.js.map +1 -0
- package/dist/core/cli/output/index.d.ts +13 -0
- package/dist/core/cli/output/index.js +30 -0
- package/dist/core/cli/output/index.js.map +1 -0
- package/dist/core/cli/output/prompt.d.ts +15 -0
- package/dist/core/cli/output/prompt.js +145 -0
- package/dist/core/cli/output/prompt.js.map +1 -0
- package/dist/core/cli/output/symbols.d.ts +4 -0
- package/dist/core/cli/output/symbols.js +44 -0
- package/dist/core/cli/output/symbols.js.map +1 -0
- package/dist/core/cli/output/tasks.d.ts +57 -0
- package/dist/core/cli/output/tasks.js +310 -0
- package/dist/core/cli/output/tasks.js.map +1 -0
- package/dist/core/cli/output/translations.d.ts +4 -0
- package/dist/core/cli/output/translations.js +109 -0
- package/dist/core/cli/output/translations.js.map +1 -0
- package/dist/core/cli/output/types.d.ts +139 -0
- package/dist/core/cli/output/types.js +3 -0
- package/dist/core/cli/output/types.js.map +1 -0
- package/dist/core/cli/output/ui.d.ts +2 -0
- package/dist/core/cli/output/ui.js +155 -0
- package/dist/core/cli/output/ui.js.map +1 -0
- package/dist/core/cli/output/verbosity.d.ts +5 -0
- package/dist/core/cli/output/verbosity.js +17 -0
- package/dist/core/cli/output/verbosity.js.map +1 -0
- package/dist/core/cli/package-manager.js +11 -4
- package/dist/core/cli/package-manager.js.map +1 -1
- package/dist/core/cli/plugin-compatibility.d.ts +5 -2
- package/dist/core/cli/plugin-compatibility.js +22 -15
- package/dist/core/cli/plugin-compatibility.js.map +1 -1
- package/dist/core/cli/plugin-management.d.ts +19 -1
- package/dist/core/cli/plugin-management.js +102 -48
- package/dist/core/cli/plugin-management.js.map +1 -1
- package/dist/core/cli/plugin-registry.d.ts +0 -1
- package/dist/core/cli/plugin-registry.js +2 -3
- package/dist/core/cli/plugin-registry.js.map +1 -1
- package/dist/core/cli/plugin.js +39 -53
- package/dist/core/cli/plugin.js.map +1 -1
- package/dist/core/cli/production-start.d.ts +0 -1
- package/dist/core/cli/production-start.js +12 -21
- package/dist/core/cli/production-start.js.map +1 -1
- package/dist/core/cli/usage-errors.d.ts +2 -0
- package/dist/core/cli/usage-errors.js +50 -0
- package/dist/core/cli/usage-errors.js.map +1 -0
- package/dist/core/cli/version-check.d.ts +22 -3
- package/dist/core/cli/version-check.js +140 -16
- package/dist/core/cli/version-check.js.map +1 -1
- package/dist/core/config/config-loader.d.ts +2 -1
- package/dist/core/config/config-loader.js +6 -2
- package/dist/core/config/config-loader.js.map +1 -1
- package/dist/core/downloaders/git.js +26 -20
- package/dist/core/downloaders/git.js.map +1 -1
- package/dist/core/downloaders/local.js +0 -1
- package/dist/core/downloaders/local.js.map +1 -1
- package/dist/core/downloaders/package.js +4 -5
- package/dist/core/downloaders/package.js.map +1 -1
- package/dist/core/downloaders/utils.d.ts +3 -1
- package/dist/core/downloaders/utils.js +39 -29
- package/dist/core/downloaders/utils.js.map +1 -1
- package/dist/core/runtime/launch-sequence.js +4 -4
- package/dist/core/runtime/launch-sequence.js.map +1 -1
- package/dist/core/runtime/module-loading.js +43 -36
- package/dist/core/runtime/module-loading.js.map +1 -1
- package/dist/core/version-checker.js +19 -13
- package/dist/core/version-checker.js.map +1 -1
- package/dist/logging/index.js +31 -7
- package/dist/logging/index.js.map +1 -1
- package/dist/logging/log-template.d.ts +8 -0
- package/dist/logging/log-template.js +45 -0
- package/dist/logging/log-template.js.map +1 -0
- package/dist/utils/object.d.ts +1 -0
- package/dist/utils/object.js +12 -0
- package/dist/utils/object.js.map +1 -1
- package/package.json +6 -5
- package/dist/core/cli/terminal-display.d.ts +0 -17
- package/dist/core/cli/terminal-display.js +0 -113
- package/dist/core/cli/terminal-display.js.map +0 -1
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ Run a plugin command through the CLI:
|
|
|
67
67
|
ajs dms <command>
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
If the plugin is not installed, the CLI offers to install it globally with the same package manager that installed `@antelopejs/core
|
|
70
|
+
If the plugin is not installed, the CLI offers to install it globally with the same package manager that installed `@antelopejs/core` (the answer defaults to No). You can also install it yourself:
|
|
71
71
|
|
|
72
72
|
```bash
|
|
73
73
|
pnpm add -g @antelopejs/dms-frontend
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CANCELLED_MESSAGE = exports.CANCELLED_ERROR_NAME = void 0;
|
|
4
|
+
exports.isPromptCancellation = isPromptCancellation;
|
|
5
|
+
exports.reportCancellation = reportCancellation;
|
|
6
|
+
const exit_codes_1 = require("./exit-codes");
|
|
7
|
+
exports.CANCELLED_ERROR_NAME = "CancelledError";
|
|
8
|
+
exports.CANCELLED_MESSAGE = "Cancelled";
|
|
9
|
+
function isPromptCancellation(error) {
|
|
10
|
+
return (error !== null &&
|
|
11
|
+
typeof error === "object" &&
|
|
12
|
+
"name" in error &&
|
|
13
|
+
error.name === exports.CANCELLED_ERROR_NAME);
|
|
14
|
+
}
|
|
15
|
+
function reportCancellation() {
|
|
16
|
+
console.error(exports.CANCELLED_MESSAGE);
|
|
17
|
+
process.exitCode = exit_codes_1.CANCELLED_EXIT_CODE;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=cancellation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancellation.js","sourceRoot":"","sources":["../../../src/core/cli/cancellation.ts"],"names":[],"mappings":";;;AAKA,oDAOC;AAED,gDAGC;AAjBD,6CAAmD;AAEtC,QAAA,oBAAoB,GAAG,gBAAgB,CAAC;AACxC,QAAA,iBAAiB,GAAG,WAAW,CAAC;AAE7C,SAAgB,oBAAoB,CAAC,KAAc;IACjD,OAAO,CACL,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,MAAM,IAAI,KAAK;QACf,KAAK,CAAC,IAAI,KAAK,4BAAoB,CACpC,CAAC;AACJ,CAAC;AAED,SAAgB,kBAAkB;IAChC,OAAO,CAAC,KAAK,CAAC,yBAAiB,CAAC,CAAC;IACjC,OAAO,CAAC,QAAQ,GAAG,gCAAmB,CAAC;AACzC,CAAC"}
|
|
@@ -1,33 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { Options as BoxenOptions } from "boxen";
|
|
1
|
+
import { type CliProblem, type OutputStream, type TaskList } from "./output";
|
|
3
2
|
export declare class Spinner {
|
|
4
3
|
private text;
|
|
5
|
-
private
|
|
6
|
-
private
|
|
7
|
-
|
|
8
|
-
private isTerminal;
|
|
9
|
-
constructor(text: string);
|
|
4
|
+
private readonly tasks;
|
|
5
|
+
private task?;
|
|
6
|
+
constructor(text: string, tasks?: TaskList);
|
|
10
7
|
start(text?: string): Promise<Spinner>;
|
|
11
8
|
update(text: string): Spinner;
|
|
12
|
-
log(stream:
|
|
9
|
+
log(stream: OutputStream, message: string): Spinner;
|
|
13
10
|
succeed(text?: string): Promise<void>;
|
|
14
11
|
fail(text?: string): Promise<void>;
|
|
15
12
|
info(text?: string): Promise<void>;
|
|
16
13
|
warn(text?: string): Promise<void>;
|
|
17
|
-
pause(): Promise<void>;
|
|
18
14
|
stop(): Promise<void>;
|
|
19
|
-
|
|
15
|
+
private finish;
|
|
20
16
|
}
|
|
21
|
-
export declare function displayBox(message: string, title?: string, options?: BoxenOptions): Promise<void>;
|
|
22
|
-
export declare function displayBanner(text: string, font?: figlet.FontName): void;
|
|
23
17
|
export declare function success(message: string): void;
|
|
24
18
|
export declare function error(message: string | Error): void;
|
|
25
19
|
export interface CommandOutput {
|
|
26
20
|
info(message: string): void;
|
|
21
|
+
warn(message: string): void;
|
|
27
22
|
error(message: string): void;
|
|
23
|
+
problem(problem: CliProblem): void;
|
|
28
24
|
}
|
|
29
25
|
export declare function warning(message: string | Error): void;
|
|
30
26
|
export declare function info(message: string): void;
|
|
31
27
|
export declare function header(text: string): void;
|
|
32
|
-
export declare function keyValue(key: string, value: string | number | boolean): string;
|
|
33
28
|
export declare const consoleOutput: CommandOutput;
|
package/dist/core/cli/cli-ui.js
CHANGED
|
@@ -1,162 +1,82 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.consoleOutput = exports.Spinner = void 0;
|
|
7
|
-
exports.displayBox = displayBox;
|
|
8
|
-
exports.displayBanner = displayBanner;
|
|
9
4
|
exports.success = success;
|
|
10
5
|
exports.error = error;
|
|
11
6
|
exports.warning = warning;
|
|
12
7
|
exports.info = info;
|
|
13
8
|
exports.header = header;
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const figlet_1 = __importDefault(require("figlet"));
|
|
17
|
-
const logging_utils_1 = require("./logging-utils");
|
|
18
|
-
const clearLine = () => process.stdout.write("\r\x1b[K");
|
|
19
|
-
const spinnerChars = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
20
|
-
const SPINNER_INTERVAL_MS = 80;
|
|
9
|
+
const output_1 = require("./output");
|
|
10
|
+
const LINE_END = "\n";
|
|
21
11
|
class Spinner {
|
|
22
12
|
text;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
isTerminal = (0, logging_utils_1.isTerminalOutput)();
|
|
27
|
-
constructor(text) {
|
|
13
|
+
tasks;
|
|
14
|
+
task;
|
|
15
|
+
constructor(text, tasks = (0, output_1.getProcessTasks)()) {
|
|
28
16
|
this.text = text;
|
|
17
|
+
this.tasks = tasks;
|
|
29
18
|
}
|
|
30
|
-
|
|
19
|
+
start(text) {
|
|
31
20
|
if (text)
|
|
32
21
|
this.text = text;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.isRunning = true;
|
|
36
|
-
this.currentCharIndex = 0;
|
|
37
|
-
if (!this.isTerminal)
|
|
38
|
-
return this;
|
|
39
|
-
this.interval = setInterval(() => {
|
|
40
|
-
if (this.isRunning) {
|
|
41
|
-
const spinnerChar = spinnerChars[this.currentCharIndex];
|
|
42
|
-
process.stdout.write(`\r${spinnerChar} ${this.text}`);
|
|
43
|
-
this.currentCharIndex =
|
|
44
|
-
(this.currentCharIndex + 1) % spinnerChars.length;
|
|
45
|
-
}
|
|
46
|
-
}, SPINNER_INTERVAL_MS);
|
|
47
|
-
return this;
|
|
22
|
+
this.task ??= this.tasks.start(this.text);
|
|
23
|
+
return Promise.resolve(this);
|
|
48
24
|
}
|
|
49
25
|
update(text) {
|
|
50
26
|
this.text = text;
|
|
27
|
+
this.task?.update(text);
|
|
51
28
|
return this;
|
|
52
29
|
}
|
|
53
30
|
log(stream, message) {
|
|
54
|
-
|
|
55
|
-
clearLine();
|
|
56
|
-
stream.write(`${message}\n`);
|
|
57
|
-
const spinnerChar = spinnerChars[this.currentCharIndex];
|
|
58
|
-
process.stdout.write(`${spinnerChar} ${this.text}`);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
stream.write(`${message}\n`);
|
|
62
|
-
}
|
|
31
|
+
this.tasks.write(stream, `${message}${LINE_END}`);
|
|
63
32
|
return this;
|
|
64
33
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return;
|
|
68
|
-
await this.stop();
|
|
69
|
-
const message = text || this.text;
|
|
70
|
-
console.log(`${chalk_1.default.green.bold("✓")} ${message}`);
|
|
34
|
+
succeed(text) {
|
|
35
|
+
return this.finish("success", text);
|
|
71
36
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return;
|
|
75
|
-
await this.stop();
|
|
76
|
-
const message = text || this.text;
|
|
77
|
-
console.log(`${chalk_1.default.red.bold("✗")} ${chalk_1.default.red(message)}`);
|
|
78
|
-
}
|
|
79
|
-
async info(text) {
|
|
80
|
-
if (!this.isRunning)
|
|
81
|
-
return;
|
|
82
|
-
await this.stop();
|
|
83
|
-
const message = text || this.text;
|
|
84
|
-
console.log(`${chalk_1.default.blue.bold("ℹ")} ${message}`);
|
|
37
|
+
fail(text) {
|
|
38
|
+
return this.finish("error", text);
|
|
85
39
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return;
|
|
89
|
-
await this.stop();
|
|
90
|
-
const message = text || this.text;
|
|
91
|
-
console.log(`${chalk_1.default.yellow.bold("⚠")} ${message}`);
|
|
40
|
+
info(text) {
|
|
41
|
+
return this.finish("info", text);
|
|
92
42
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
clearInterval(this.interval);
|
|
96
|
-
this.interval = undefined;
|
|
97
|
-
}
|
|
98
|
-
if (this.isTerminal)
|
|
99
|
-
clearLine();
|
|
43
|
+
warn(text) {
|
|
44
|
+
return this.finish("warn", text);
|
|
100
45
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
this.isRunning = false;
|
|
107
|
-
if (this.isTerminal)
|
|
108
|
-
clearLine();
|
|
46
|
+
stop() {
|
|
47
|
+
this.task?.dismiss();
|
|
48
|
+
this.task = undefined;
|
|
49
|
+
return Promise.resolve();
|
|
109
50
|
}
|
|
110
|
-
async
|
|
51
|
+
async finish(level, text) {
|
|
52
|
+
if (!this.task)
|
|
53
|
+
return;
|
|
111
54
|
await this.stop();
|
|
55
|
+
this.tasks.ui.message(level, text || this.text);
|
|
112
56
|
}
|
|
113
57
|
}
|
|
114
58
|
exports.Spinner = Spinner;
|
|
115
|
-
async function displayBox(message, title, options) {
|
|
116
|
-
const dynamicImport = new Function("specifier", "return import(specifier)");
|
|
117
|
-
const boxen = (await dynamicImport("boxen")).default;
|
|
118
|
-
const defaultOptions = {
|
|
119
|
-
padding: 1,
|
|
120
|
-
margin: 1,
|
|
121
|
-
borderStyle: "round",
|
|
122
|
-
borderColor: "blue",
|
|
123
|
-
title: title,
|
|
124
|
-
titleAlignment: "center",
|
|
125
|
-
};
|
|
126
|
-
console.log(boxen(message, { ...defaultOptions, ...options }));
|
|
127
|
-
}
|
|
128
|
-
function displayBanner(text, font) {
|
|
129
|
-
const figletText = figlet_1.default.textSync(text, { font: font || "Standard" });
|
|
130
|
-
console.log(chalk_1.default.blue(figletText));
|
|
131
|
-
}
|
|
132
59
|
function success(message) {
|
|
133
|
-
|
|
60
|
+
(0, output_1.getProcessUi)().message("success", message, { channel: "result" });
|
|
134
61
|
}
|
|
135
62
|
function error(message) {
|
|
136
63
|
const text = message instanceof Error ? message.message : message;
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
function failure(message) {
|
|
140
|
-
const text = message instanceof Error ? message.message : message;
|
|
141
|
-
console.error(`${chalk_1.default.red.bold("✗")} ${text}`);
|
|
64
|
+
(0, output_1.getProcessUi)().message("error", text);
|
|
142
65
|
}
|
|
143
66
|
function warning(message) {
|
|
144
|
-
const text = message instanceof Error ?
|
|
145
|
-
|
|
67
|
+
const text = message instanceof Error ? message.message : message;
|
|
68
|
+
(0, output_1.getProcessUi)().message("warn", text);
|
|
146
69
|
}
|
|
147
70
|
function info(message) {
|
|
148
|
-
|
|
71
|
+
(0, output_1.getProcessUi)().message("info", message);
|
|
149
72
|
}
|
|
150
73
|
function header(text) {
|
|
151
|
-
|
|
152
|
-
console.log(chalk_1.default.bold.blue(text));
|
|
153
|
-
console.log(chalk_1.default.blue("─".repeat(text.length)));
|
|
154
|
-
}
|
|
155
|
-
function keyValue(key, value) {
|
|
156
|
-
return `${chalk_1.default.cyan(key)}: ${value}`;
|
|
74
|
+
(0, output_1.getProcessUi)().heading(text);
|
|
157
75
|
}
|
|
158
76
|
exports.consoleOutput = {
|
|
159
77
|
info: (message) => info(message),
|
|
160
|
-
|
|
78
|
+
warn: (message) => warning(message),
|
|
79
|
+
error: (message) => error(message),
|
|
80
|
+
problem: (problem) => (0, output_1.getProcessUi)().problem(problem),
|
|
161
81
|
};
|
|
162
82
|
//# sourceMappingURL=cli-ui.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-ui.js","sourceRoot":"","sources":["../../../src/core/cli/cli-ui.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-ui.js","sourceRoot":"","sources":["../../../src/core/cli/cli-ui.ts"],"names":[],"mappings":"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"}
|
|
@@ -4,6 +4,17 @@ export interface CommandResult {
|
|
|
4
4
|
stderr: string;
|
|
5
5
|
code: number;
|
|
6
6
|
}
|
|
7
|
+
export interface ExecFailure extends CommandResult {
|
|
8
|
+
command: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class ExecError extends Error {
|
|
11
|
+
readonly command: string;
|
|
12
|
+
readonly stdout: string;
|
|
13
|
+
readonly stderr: string;
|
|
14
|
+
readonly exitCode: number;
|
|
15
|
+
constructor(failure: ExecFailure);
|
|
16
|
+
get output(): string;
|
|
17
|
+
}
|
|
7
18
|
export declare function nonInteractiveOptions(options: ExecOptions): ExecOptions;
|
|
8
19
|
export declare function closeStdin(child: ChildProcess): void;
|
|
9
20
|
export declare function ExecuteCMD(command: string, options: ExecOptions): Promise<CommandResult>;
|
package/dist/core/cli/command.js
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExecError = void 0;
|
|
3
4
|
exports.nonInteractiveOptions = nonInteractiveOptions;
|
|
4
5
|
exports.closeStdin = closeStdin;
|
|
5
6
|
exports.ExecuteCMD = ExecuteCMD;
|
|
6
7
|
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
7
8
|
const node_child_process_1 = require("node:child_process");
|
|
9
|
+
const exit_codes_1 = require("./exit-codes");
|
|
8
10
|
const Logger = new logging_1.Logging.Channel("cli.command");
|
|
9
11
|
const NON_INTERACTIVE_ENV = {
|
|
10
12
|
CI: "1",
|
|
13
|
+
GIT_TERMINAL_PROMPT: "0",
|
|
11
14
|
};
|
|
15
|
+
const EXEC_ERROR_NAME = "ExecError";
|
|
16
|
+
class ExecError extends Error {
|
|
17
|
+
command;
|
|
18
|
+
stdout;
|
|
19
|
+
stderr;
|
|
20
|
+
exitCode;
|
|
21
|
+
constructor(failure) {
|
|
22
|
+
super(`Command '${failure.command}' failed with exit code ${failure.code}`);
|
|
23
|
+
this.name = EXEC_ERROR_NAME;
|
|
24
|
+
this.command = failure.command;
|
|
25
|
+
this.stdout = failure.stdout;
|
|
26
|
+
this.stderr = failure.stderr;
|
|
27
|
+
this.exitCode = failure.code;
|
|
28
|
+
}
|
|
29
|
+
get output() {
|
|
30
|
+
return this.stderr || this.stdout;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.ExecError = ExecError;
|
|
12
34
|
function nonInteractiveOptions(options) {
|
|
13
35
|
return {
|
|
14
36
|
...options,
|
|
@@ -21,6 +43,11 @@ function nonInteractiveOptions(options) {
|
|
|
21
43
|
function closeStdin(child) {
|
|
22
44
|
child.stdin?.end();
|
|
23
45
|
}
|
|
46
|
+
function exitCodeOf(err) {
|
|
47
|
+
return typeof err.code === "number" && err.code !== 0
|
|
48
|
+
? err.code
|
|
49
|
+
: exit_codes_1.FAILURE_EXIT_CODE;
|
|
50
|
+
}
|
|
24
51
|
function ExecuteCMD(command, options) {
|
|
25
52
|
return new Promise((resolve, reject) => {
|
|
26
53
|
Logger.Trace(`Executing command: ${command}`);
|
|
@@ -28,12 +55,11 @@ function ExecuteCMD(command, options) {
|
|
|
28
55
|
const result = {
|
|
29
56
|
stdout: stdout?.toString() ?? "",
|
|
30
57
|
stderr: stderr?.toString() ?? "",
|
|
31
|
-
code: err ? err
|
|
58
|
+
code: err ? exitCodeOf(err) : 0,
|
|
32
59
|
};
|
|
33
60
|
if (err) {
|
|
34
|
-
Logger.
|
|
35
|
-
|
|
36
|
-
return reject(message);
|
|
61
|
+
Logger.Debug(`Command failed with code ${result.code}: ${command}`);
|
|
62
|
+
return reject(new ExecError({ ...result, command }));
|
|
37
63
|
}
|
|
38
64
|
resolve(result);
|
|
39
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/core/cli/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/core/cli/command.ts"],"names":[],"mappings":";;;AA4DA,sDAQC;AAMD,gCAEC;AAiBD,gCAwBC;AArHD,gEAA6D;AAC7D,2DAK4B;AAE5B,6CAAiD;AAEjD,MAAM,MAAM,GAAG,IAAI,iBAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;AAElD,MAAM,mBAAmB,GAA2B;IAClD,EAAE,EAAE,GAAG;IACP,mBAAmB,EAAE,GAAG;CACzB,CAAC;AAEF,MAAM,eAAe,GAAG,WAAW,CAAC;AAiBpC,MAAa,SAAU,SAAQ,KAAK;IACzB,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,MAAM,CAAS;IACf,QAAQ,CAAS;IAE1B,YAAY,OAAoB;QAC9B,KAAK,CAAC,YAAY,OAAO,CAAC,OAAO,2BAA2B,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5E,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAC/B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC;IACpC,CAAC;CACF;AAlBD,8BAkBC;AAQD,SAAgB,qBAAqB,CAAC,OAAoB;IACxD,OAAO;QACL,GAAG,OAAO;QACV,GAAG,EAAE;YACH,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;YAC/B,GAAG,mBAAmB;SACvB;KACF,CAAC;AACJ,CAAC;AAMD,SAAgB,UAAU,CAAC,KAAmB;IAC5C,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC;AACrB,CAAC;AAED,SAAS,UAAU,CAAC,GAAkB;IACpC,OAAO,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC;QACnD,CAAC,CAAC,GAAG,CAAC,IAAI;QACV,CAAC,CAAC,8BAAiB,CAAC;AACxB,CAAC;AAWD,SAAgB,UAAU,CACxB,OAAe,EACf,OAAoB;IAEpB,OAAO,IAAI,OAAO,CAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpD,MAAM,CAAC,KAAK,CAAC,sBAAsB,OAAO,EAAE,CAAC,CAAC;QAC9C,MAAM,KAAK,GAAG,IAAA,yBAAI,EAChB,OAAO,EACP,qBAAqB,CAAC,OAAO,CAAC,EAC9B,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACtB,MAAM,MAAM,GAAkB;gBAC5B,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAChC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAChC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;aAChC,CAAC;YACF,IAAI,GAAG,EAAE,CAAC;gBACR,MAAM,CAAC,KAAK,CAAC,4BAA4B,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;gBACpE,OAAO,MAAM,CAAC,IAAI,SAAS,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;YACvD,CAAC;YACD,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CACF,CAAC;QACF,UAAU,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getConfigAction = getConfigAction;
|
|
4
|
+
const keys_1 = require("./keys");
|
|
5
|
+
const common_1 = require("../../common");
|
|
6
|
+
const output_1 = require("../../output");
|
|
7
|
+
const SET_COMMAND = "ajs config set";
|
|
8
|
+
function missingKeyError(key) {
|
|
9
|
+
return new output_1.CliError({
|
|
10
|
+
title: `Configuration key '${key}' not found`,
|
|
11
|
+
fixes: [`Set it with ${SET_COMMAND} ${key} <value>`],
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function renderValue(key, value, ui) {
|
|
15
|
+
if (!value) {
|
|
16
|
+
ui.message("info", `${key} is not set`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
ui.value(value);
|
|
20
|
+
}
|
|
21
|
+
async function getConfigValue(key, options, ui) {
|
|
22
|
+
if (!keys_1.CONFIG_KEYS.includes(key)) {
|
|
23
|
+
throw (0, keys_1.invalidConfigKeyError)(key);
|
|
24
|
+
}
|
|
25
|
+
const config = { ...(await (0, common_1.readUserConfig)()) };
|
|
26
|
+
if (!(key in config)) {
|
|
27
|
+
throw missingKeyError(key);
|
|
28
|
+
}
|
|
29
|
+
const value = config[key];
|
|
30
|
+
(0, output_1.writeData)(ui, {
|
|
31
|
+
data: value,
|
|
32
|
+
isJson: options.json,
|
|
33
|
+
render: (target) => renderValue(key, value, target),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function getConfigAction(ui = (0, output_1.getProcessUi)()) {
|
|
37
|
+
return (key, options) => getConfigValue(key, options, ui);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=get-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-action.js","sourceRoot":"","sources":["../../../../../src/core/cli/commands/config/get-action.ts"],"names":[],"mappings":";;AA6CA,0CAEC;AA/CD,iCAA4D;AAC5D,yCAA8C;AAC9C,yCAA0E;AAM1E,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAErC,SAAS,eAAe,CAAC,GAAW;IAClC,OAAO,IAAI,iBAAQ,CAAC;QAClB,KAAK,EAAE,sBAAsB,GAAG,aAAa;QAC7C,KAAK,EAAE,CAAC,eAAe,WAAW,IAAI,GAAG,UAAU,CAAC;KACrD,CAAC,CAAC;AACL,CAAC;AAED,SAAS,WAAW,CAAC,GAAW,EAAE,KAAa,EAAE,EAAM;IACrD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,aAAa,CAAC,CAAC;QACxC,OAAO;IACT,CAAC;IACD,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClB,CAAC;AAED,KAAK,UAAU,cAAc,CAC3B,GAAW,EACX,OAAmB,EACnB,EAAM;IAEN,IAAI,CAAC,kBAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAA,4BAAqB,EAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IACD,MAAM,MAAM,GAA2B,EAAE,GAAG,CAAC,MAAM,IAAA,uBAAc,GAAE,CAAC,EAAE,CAAC;IACvE,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC;QACrB,MAAM,eAAe,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,IAAA,kBAAS,EAAC,EAAE,EAAE;QACZ,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,OAAO,CAAC,IAAI;QACpB,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC;KACpD,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,eAAe,CAAC,KAAS,IAAA,qBAAY,GAAE;IACrD,OAAO,CAAC,GAAW,EAAE,OAAmB,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -1,39 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
5
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
36
|
exports.default = default_1;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
37
|
const commander_1 = require("commander");
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (key in config) {
|
|
27
|
-
const value = config[key];
|
|
28
|
-
await (0, cli_ui_1.displayBox)((0, cli_ui_1.keyValue)(key, value ? chalk_1.default.green(value) : chalk_1.default.dim("Not set")), "🔍 Configuration Value", {
|
|
29
|
-
padding: 1,
|
|
30
|
-
borderColor: "yellow",
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
(0, cli_ui_1.error)(`Configuration key not found: ${chalk_1.default.bold(key)}`);
|
|
35
|
-
process.exitCode = 1;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
+
const keys_1 = require("./keys");
|
|
39
|
+
const options_1 = require("../../options");
|
|
40
|
+
const help_1 = require("../../help");
|
|
41
|
+
const lazy_action_1 = require("../../lazy-action");
|
|
42
|
+
function default_1(ui) {
|
|
43
|
+
const command = new commander_1.Command("get")
|
|
44
|
+
.summary("Print one CLI setting")
|
|
45
|
+
.description("Print the value of one CLI setting on stdout, and nothing else, so that scripts can read it.")
|
|
46
|
+
.argument("<key>", `Setting to print (${keys_1.CONFIG_KEYS.join(", ")})`)
|
|
47
|
+
.addOption(options_1.Options.json)
|
|
48
|
+
.action((0, lazy_action_1.lazyAction)(async () => (await Promise.resolve().then(() => __importStar(require("./get-action")))).getConfigAction(ui)));
|
|
49
|
+
return (0, help_1.withExamples)(command, [
|
|
50
|
+
{
|
|
51
|
+
description: "Print the interface repository URL",
|
|
52
|
+
command: "ajs config get git",
|
|
53
|
+
},
|
|
54
|
+
]);
|
|
38
55
|
}
|
|
39
56
|
//# sourceMappingURL=get.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../../src/core/cli/commands/config/get.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../../src/core/cli/commands/config/get.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,4BAmBC;AA3BD,yCAAoC;AAEpC,iCAAqC;AAErC,2CAAwC;AACxC,qCAA0C;AAC1C,mDAA+C;AAE/C,mBAAyB,EAAO;IAC9B,MAAM,OAAO,GAAG,IAAI,mBAAO,CAAC,KAAK,CAAC;SAC/B,OAAO,CAAC,uBAAuB,CAAC;SAChC,WAAW,CACV,8FAA8F,CAC/F;SACA,QAAQ,CAAC,OAAO,EAAE,qBAAqB,kBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;SACjE,SAAS,CAAC,iBAAO,CAAC,IAAI,CAAC;SACvB,MAAM,CACL,IAAA,wBAAU,EAAC,KAAK,IAAI,EAAE,CACpB,CAAC,wDAAa,cAAc,GAAC,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC,CACnD,CACF,CAAC;IACJ,OAAO,IAAA,mBAAY,EAAC,OAAO,EAAE;QAC3B;YACE,WAAW,EAAE,oCAAoC;YACjD,OAAO,EAAE,oBAAoB;SAC9B;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -11,8 +11,8 @@ const show_1 = __importDefault(require("./show"));
|
|
|
11
11
|
const reset_1 = __importDefault(require("./reset"));
|
|
12
12
|
function default_1() {
|
|
13
13
|
return new commander_1.Command("config")
|
|
14
|
-
.
|
|
15
|
-
|
|
14
|
+
.summary("Show or change CLI settings")
|
|
15
|
+
.description("Show or change the settings of the CLI, stored in ~/.antelopejs/config.json and shared by every project.")
|
|
16
16
|
.addCommand((0, show_1.default)())
|
|
17
17
|
.addCommand((0, get_1.default)())
|
|
18
18
|
.addCommand((0, set_1.default)())
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/cli/commands/config/index.ts"],"names":[],"mappings":";;;;;AAOA,4BAUC;AAjBD,yCAAoC;AAEpC,gDAA2B;AAC3B,gDAA2B;AAC3B,kDAA6B;AAC7B,oDAA+B;AAE/B;IACE,OAAO,IAAI,mBAAO,CAAC,QAAQ,CAAC;SACzB,WAAW,CACV,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/cli/commands/config/index.ts"],"names":[],"mappings":";;;;;AAOA,4BAUC;AAjBD,yCAAoC;AAEpC,gDAA2B;AAC3B,gDAA2B;AAC3B,kDAA6B;AAC7B,oDAA+B;AAE/B;IACE,OAAO,IAAI,mBAAO,CAAC,QAAQ,CAAC;SACzB,OAAO,CAAC,6BAA6B,CAAC;SACtC,WAAW,CACV,0GAA0G,CAC3G;SACA,UAAU,CAAC,IAAA,cAAO,GAAE,CAAC;SACrB,UAAU,CAAC,IAAA,aAAM,GAAE,CAAC;SACpB,UAAU,CAAC,IAAA,aAAM,GAAE,CAAC;SACpB,UAAU,CAAC,IAAA,eAAQ,GAAE,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONFIG_KEYS = void 0;
|
|
4
|
+
exports.invalidConfigKeyError = invalidConfigKeyError;
|
|
5
|
+
const output_1 = require("../../output");
|
|
6
|
+
exports.CONFIG_KEYS = ["git"];
|
|
7
|
+
function invalidConfigKeyError(key) {
|
|
8
|
+
return new output_1.CliError({
|
|
9
|
+
title: `Invalid configuration key '${key}'`,
|
|
10
|
+
reason: `Valid keys: ${exports.CONFIG_KEYS.join(", ")}`,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/core/cli/commands/config/keys.ts"],"names":[],"mappings":";;;AAIA,sDAKC;AATD,yCAAwC;AAE3B,QAAA,WAAW,GAAG,CAAC,KAAK,CAAC,CAAC;AAEnC,SAAgB,qBAAqB,CAAC,GAAW;IAC/C,OAAO,IAAI,iBAAQ,CAAC;QAClB,KAAK,EAAE,8BAA8B,GAAG,GAAG;QAC3C,MAAM,EAAE,eAAe,mBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KAChD,CAAC,CAAC;AACL,CAAC"}
|