@cenk1cenk2/oclif-common 3.9.6 → 3.9.8
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/base.command-d3038122.d.ts +77 -0
- package/dist/commands/base.command.d.ts +24 -0
- package/dist/commands/base.command.js +174 -0
- package/dist/commands/config.command.d.ts +71 -0
- package/dist/commands/config.command.js +60 -0
- package/dist/commands/index.d.ts +34 -0
- package/dist/commands/index.js +18 -0
- package/dist/constants/file.constants.d.ts +5 -0
- package/dist/constants/file.constants.js +30 -0
- package/dist/constants/global-flags.constants.d.ts +5 -0
- package/dist/constants/global-flags.constants.js +53 -0
- package/dist/constants/help-groups.constants.d.ts +5 -0
- package/dist/constants/help-groups.constants.js +30 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/index.js +19 -0
- package/dist/hooks/index.d.ts +3 -1
- package/dist/hooks/index.js +4 -744
- package/dist/hooks/not-found.hook.js +4 -686
- package/dist/hooks/store.hook.d.ts +7 -2
- package/dist/hooks/store.hook.js +3 -708
- package/dist/hooks/update-notifier.hook.js +1 -3
- package/dist/index.d.ts +52 -404
- package/dist/index.js +7 -1335
- package/dist/interfaces/class.interface.d.ts +3 -0
- package/dist/interfaces/class.interface.js +15 -0
- package/dist/interfaces/config-command.interface.d.ts +12 -0
- package/dist/interfaces/config-command.interface.js +15 -0
- package/dist/interfaces/index.d.ts +10 -0
- package/dist/interfaces/index.js +20 -0
- package/dist/interfaces/oclif.interface.d.ts +9 -0
- package/dist/interfaces/oclif.interface.js +27 -0
- package/dist/interfaces/type-helper.interface.d.ts +8 -0
- package/dist/interfaces/type-helper.interface.js +15 -0
- package/dist/lib/config/config.constants.d.ts +8 -0
- package/dist/lib/config/config.constants.js +33 -0
- package/dist/lib/config/config.interface.d.ts +15 -0
- package/dist/lib/config/config.interface.js +15 -0
- package/dist/lib/config/config.service.d.ts +24 -0
- package/dist/lib/config/config.service.js +172 -0
- package/dist/lib/config/index.d.ts +24 -0
- package/dist/lib/config/index.js +18 -0
- package/dist/lib/fs/filesystem.service.d.ts +28 -0
- package/dist/lib/fs/filesystem.service.js +162 -0
- package/dist/lib/fs/index.d.ts +2 -0
- package/dist/lib/fs/index.js +17 -0
- package/dist/lib/index.d.ts +29 -0
- package/dist/lib/index.js +23 -0
- package/dist/lib/locker/index.d.ts +4 -0
- package/dist/lib/locker/index.js +18 -0
- package/dist/lib/locker/locker.interface.d.ts +17 -0
- package/dist/lib/locker/locker.interface.js +15 -0
- package/dist/lib/locker/locker.service.d.ts +30 -0
- package/dist/lib/locker/locker.service.js +170 -0
- package/dist/lib/parser/env-parser.service.d.ts +13 -0
- package/dist/lib/parser/env-parser.service.js +62 -0
- package/dist/lib/parser/index.d.ts +8 -0
- package/dist/lib/parser/index.js +21 -0
- package/dist/lib/parser/json-parser.service.d.ts +12 -0
- package/dist/lib/parser/json-parser.service.js +52 -0
- package/dist/lib/parser/parser.interface.d.ts +7 -0
- package/dist/lib/parser/parser.interface.js +15 -0
- package/dist/lib/parser/parser.service.d.ts +21 -0
- package/dist/lib/parser/parser.service.js +87 -0
- package/dist/lib/parser/yaml-parser.service.d.ts +12 -0
- package/dist/lib/parser/yaml-parser.service.js +53 -0
- package/dist/lib/setup.d.ts +3 -0
- package/dist/lib/setup.js +60 -0
- package/dist/lib/store/index.d.ts +2 -0
- package/dist/lib/store/index.js +18 -0
- package/dist/lib/store/store.interface.d.ts +5 -0
- package/dist/lib/store/store.interface.js +15 -0
- package/dist/lib/store/store.service.d.ts +12 -0
- package/dist/lib/store/store.service.js +48 -0
- package/dist/lib/validator/index.d.ts +5 -0
- package/dist/lib/validator/index.js +18 -0
- package/dist/lib/validator/validator.interface.d.ts +9 -0
- package/dist/lib/validator/validator.interface.js +15 -0
- package/dist/lib/validator/validator.service.d.ts +16 -0
- package/dist/lib/validator/validator.service.js +77 -0
- package/dist/utils/color.d.ts +5 -0
- package/dist/utils/color.js +34 -0
- package/dist/utils/defaults.d.ts +11 -0
- package/dist/utils/defaults.js +47 -0
- package/dist/utils/environment.d.ts +7 -0
- package/dist/utils/environment.js +44 -0
- package/dist/utils/index.d.ts +17 -0
- package/dist/utils/index.js +34 -0
- package/dist/utils/logger/index.d.ts +10 -0
- package/dist/utils/logger/index.js +21 -0
- package/dist/utils/logger/listr-logger.d.ts +20 -0
- package/dist/utils/logger/listr-logger.js +60 -0
- package/dist/utils/logger/logger.constants.d.ts +20 -0
- package/dist/utils/logger/logger.constants.js +48 -0
- package/dist/utils/logger/logger.d.ts +31 -0
- package/dist/utils/logger/logger.interface.d.ts +16 -0
- package/dist/utils/logger/logger.interface.js +15 -0
- package/dist/utils/logger/logger.js +200 -0
- package/dist/utils/logger/pipe/index.d.ts +9 -0
- package/dist/utils/logger/pipe/index.js +19 -0
- package/dist/utils/logger/pipe/pipe-process-to-listr.d.ts +6 -0
- package/dist/utils/logger/pipe/pipe-process-to-listr.js +43 -0
- package/dist/utils/logger/pipe/pipe-process-to-logger.d.ts +13 -0
- package/dist/utils/logger/pipe/pipe-process-to-logger.interface.d.ts +16 -0
- package/dist/utils/logger/pipe/pipe-process-to-logger.interface.js +15 -0
- package/dist/utils/logger/pipe/pipe-process-to-logger.js +80 -0
- package/dist/utils/merge.constants.d.ts +6 -0
- package/dist/utils/merge.constants.js +31 -0
- package/dist/utils/merge.d.ts +8 -0
- package/dist/utils/merge.js +47 -0
- package/package.json +6 -6
- package/dist/store.hook-519df5f8.d.ts +0 -18
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Command as Command$1 } from '@oclif/core';
|
|
2
|
+
import { ListrContext, Manager, PromptOptions } from 'listr2';
|
|
3
|
+
import { Logger } from './utils/logger/logger.js';
|
|
4
|
+
import { GlobalConfig } from './lib/config/config.interface.js';
|
|
5
|
+
import { FileSystemService } from './lib/fs/filesystem.service.js';
|
|
6
|
+
import { SetCtxDefaultsOptions, SetCtxAssignOptions } from './utils/defaults.js';
|
|
7
|
+
import { ParserService } from './lib/parser/parser.service.js';
|
|
8
|
+
import { StoreService } from './lib/store/store.service.js';
|
|
9
|
+
import { ValidatorService } from './lib/validator/validator.service.js';
|
|
10
|
+
import { InferFlags, InferArgs } from './interfaces/oclif.interface.js';
|
|
11
|
+
import { LockableData } from './lib/locker/locker.interface.js';
|
|
12
|
+
import { LogLevels } from './utils/logger/logger.constants.js';
|
|
13
|
+
import { MergeStrategy } from './utils/merge.constants.js';
|
|
14
|
+
|
|
15
|
+
declare class ConfigService implements GlobalConfig {
|
|
16
|
+
oclif: Command['config'];
|
|
17
|
+
command: Command['ctor'];
|
|
18
|
+
private static instance;
|
|
19
|
+
defaults: string;
|
|
20
|
+
root: string;
|
|
21
|
+
parser: ParserService;
|
|
22
|
+
logLevel: LogLevels;
|
|
23
|
+
isVerbose: boolean;
|
|
24
|
+
isDebug: boolean;
|
|
25
|
+
isSilent: boolean;
|
|
26
|
+
ci: boolean;
|
|
27
|
+
json: boolean;
|
|
28
|
+
private logger;
|
|
29
|
+
constructor(oclif: Command['config'], command: Command['ctor'], config: GlobalConfig);
|
|
30
|
+
read<T extends LockableData = LockableData>(path: string): Promise<T>;
|
|
31
|
+
extend<T extends LockableData = LockableData>(paths: (string | Partial<T>)[], strategy?: MergeStrategy): Promise<T>;
|
|
32
|
+
merge<T extends LockableData = LockableData>(configs: Partial<T>[], strategy?: MergeStrategy): T;
|
|
33
|
+
env<T extends LockableData = LockableData>(definition: string | Record<PropertyKey, any>, config: T): Promise<T>;
|
|
34
|
+
write<T extends LockableData = LockableData>(path: string, data: T): Promise<void>;
|
|
35
|
+
private recalculate;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare class Command<Ctx extends ListrContext = ListrContext, Flags extends Record<PropertyKey, any> = InferFlags<typeof Command>, Args extends Record<PropertyKey, any> = InferArgs<typeof Command>, Store extends Record<PropertyKey, any> = Record<PropertyKey, any>> extends Command$1 {
|
|
39
|
+
context: string;
|
|
40
|
+
logger: Logger;
|
|
41
|
+
tasks: Manager<Ctx, 'default' | 'verbose' | 'silent' | 'simple'>;
|
|
42
|
+
validator: ValidatorService;
|
|
43
|
+
cs: ConfigService;
|
|
44
|
+
parser: ParserService;
|
|
45
|
+
fs: FileSystemService;
|
|
46
|
+
store: StoreService<Store>;
|
|
47
|
+
flags: Flags;
|
|
48
|
+
args: Args;
|
|
49
|
+
/**
|
|
50
|
+
* Construct the class if you dont want to extend init or constructor.
|
|
51
|
+
*/
|
|
52
|
+
shouldRunBefore(): void | Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Deconstruct the class if you dont want to extend finally or catch.
|
|
55
|
+
*/
|
|
56
|
+
shouldRunAfter(_ctx?: Ctx): void | Promise<void>;
|
|
57
|
+
run(): Promise<any>;
|
|
58
|
+
_run<T>(): Promise<T | undefined>;
|
|
59
|
+
exit(code?: number): void;
|
|
60
|
+
/** Run all tasks from task manager. */
|
|
61
|
+
runTasks<C extends Ctx = Ctx>(): Promise<C>;
|
|
62
|
+
/** Gets prompt from user. */
|
|
63
|
+
prompt<T = any>(options: PromptOptions): Promise<T>;
|
|
64
|
+
protected setCtxDefaults<T extends Ctx = Ctx>(...defaults: SetCtxDefaultsOptions<T>[]): void;
|
|
65
|
+
protected setCtxAssign<K = Record<PropertyKey, any>>(...assigns: SetCtxAssignOptions<K>[]): void;
|
|
66
|
+
/** Initial functions / constructor */
|
|
67
|
+
protected init(): Promise<void>;
|
|
68
|
+
/** Tasks to run before end of the command. */
|
|
69
|
+
protected finally<C extends Ctx = Ctx>(): Promise<{
|
|
70
|
+
ctx: C;
|
|
71
|
+
}>;
|
|
72
|
+
/** Catch any error occurred during command. */
|
|
73
|
+
protected catch(e: Error, exit?: number): Promise<void>;
|
|
74
|
+
private greet;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export { Command as C, ConfigService as a };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import '@oclif/core';
|
|
2
|
+
import 'listr2';
|
|
3
|
+
import '../utils/logger/logger.js';
|
|
4
|
+
export { C as Command } from '../base.command-d3038122.js';
|
|
5
|
+
import '../lib/fs/filesystem.service.js';
|
|
6
|
+
import '../utils/defaults.js';
|
|
7
|
+
import '../lib/parser/parser.service.js';
|
|
8
|
+
import '../lib/store/store.service.js';
|
|
9
|
+
import '../lib/validator/validator.service.js';
|
|
10
|
+
import '../interfaces/oclif.interface.js';
|
|
11
|
+
import '../utils/logger/logger.constants.js';
|
|
12
|
+
import '../utils/logger/logger.interface.js';
|
|
13
|
+
import 'winston';
|
|
14
|
+
import '../lib/config/config.interface.js';
|
|
15
|
+
import '../lib/locker/locker.interface.js';
|
|
16
|
+
import '../utils/merge.constants.js';
|
|
17
|
+
import 'fs-extra';
|
|
18
|
+
import '../lib/parser/parser.interface.js';
|
|
19
|
+
import '../interfaces/class.interface.js';
|
|
20
|
+
import '../lib/store/store.interface.js';
|
|
21
|
+
import '../lib/validator/validator.interface.js';
|
|
22
|
+
import 'class-transformer';
|
|
23
|
+
import 'class-validator';
|
|
24
|
+
import '@oclif/core/lib/interfaces';
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var base_command_exports = {};
|
|
20
|
+
__export(base_command_exports, {
|
|
21
|
+
Command: () => Command
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(base_command_exports);
|
|
24
|
+
var import_core = require("@oclif/core");
|
|
25
|
+
var import_listr2 = require("listr2");
|
|
26
|
+
var import_readline = require("readline");
|
|
27
|
+
var import_reflect_metadata = require("reflect-metadata");
|
|
28
|
+
var import_constants = require("../constants");
|
|
29
|
+
var import_lib = require("../lib");
|
|
30
|
+
var import_parser = require("../lib/parser/parser.service");
|
|
31
|
+
var import_utils = require("../utils");
|
|
32
|
+
var import_logger = require("../utils/logger");
|
|
33
|
+
class Command extends import_core.Command {
|
|
34
|
+
constructor() {
|
|
35
|
+
super(...arguments);
|
|
36
|
+
this.flags = {};
|
|
37
|
+
this.args = {};
|
|
38
|
+
}
|
|
39
|
+
shouldRunBefore() {
|
|
40
|
+
}
|
|
41
|
+
shouldRunAfter(_ctx) {
|
|
42
|
+
}
|
|
43
|
+
run() {
|
|
44
|
+
throw new Error("The command should have a run function to do something!");
|
|
45
|
+
}
|
|
46
|
+
async _run() {
|
|
47
|
+
let result;
|
|
48
|
+
try {
|
|
49
|
+
delete process.env[this.config.scopedEnvVarKey("REDIRECTED")];
|
|
50
|
+
await this.init();
|
|
51
|
+
result = await this.run();
|
|
52
|
+
await this.finally();
|
|
53
|
+
} catch (error) {
|
|
54
|
+
await this.catch(error, 127);
|
|
55
|
+
}
|
|
56
|
+
if (result && this.jsonEnabled()) {
|
|
57
|
+
import_utils.CliUx.ux.styledJSON(this.toSuccessJson(result));
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
exit(code) {
|
|
62
|
+
this.logger.trace("Code -> %d", code, { status: import_logger.LogFieldStatus.EXIT });
|
|
63
|
+
process.exit(code ?? 0);
|
|
64
|
+
}
|
|
65
|
+
runTasks() {
|
|
66
|
+
return this.tasks.runAll();
|
|
67
|
+
}
|
|
68
|
+
prompt(options) {
|
|
69
|
+
return (0, import_listr2.createPrompt)(options, {
|
|
70
|
+
error: true,
|
|
71
|
+
stdout: process.stdout
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
setCtxDefaults(...defaults) {
|
|
75
|
+
(0, import_utils.setCtxDefaults)(this.tasks.options.ctx, ...defaults);
|
|
76
|
+
this.logger.trace("Updated context with defaults: %o", this.tasks.options.ctx, { status: "ctx" });
|
|
77
|
+
}
|
|
78
|
+
setCtxAssign(...assigns) {
|
|
79
|
+
(0, import_utils.setCtxAssign)(this.tasks.options.ctx, ...assigns);
|
|
80
|
+
this.logger.trace("Updated context with assign: %o", this.tasks.options.ctx, { status: "ctx" });
|
|
81
|
+
}
|
|
82
|
+
async init() {
|
|
83
|
+
this.constructor.flags = Object.assign({}, import_constants.CLI_FLAGS, this.constructor.flags);
|
|
84
|
+
await super.init();
|
|
85
|
+
let err;
|
|
86
|
+
try {
|
|
87
|
+
const { flags, args } = await this.parse();
|
|
88
|
+
this.flags = flags;
|
|
89
|
+
this.args = args;
|
|
90
|
+
} catch (e) {
|
|
91
|
+
err = e;
|
|
92
|
+
}
|
|
93
|
+
this.cs = new import_lib.ConfigService(this.config, this.ctor, {
|
|
94
|
+
logLevel: this.flags["log-level"],
|
|
95
|
+
ci: this.flags.ci,
|
|
96
|
+
json: this.flags.json
|
|
97
|
+
});
|
|
98
|
+
this.context = this.cs.command.id ? this.cs.command.id : this.cs.command.name;
|
|
99
|
+
this.logger = new import_logger.Logger(null, { level: this.cs.logLevel });
|
|
100
|
+
this.store = new import_lib.StoreService();
|
|
101
|
+
this.greet();
|
|
102
|
+
if (err) {
|
|
103
|
+
throw err;
|
|
104
|
+
}
|
|
105
|
+
this.logger.stage("Initiating services.");
|
|
106
|
+
this.parser = new import_parser.ParserService();
|
|
107
|
+
this.fs = new import_lib.FileSystemService();
|
|
108
|
+
this.validator = new import_lib.ValidatorService();
|
|
109
|
+
this.tasks = new import_listr2.Manager({
|
|
110
|
+
rendererFallback: this.cs.isDebug,
|
|
111
|
+
rendererSilent: this.cs.isSilent,
|
|
112
|
+
nonTTYRendererOptions: {
|
|
113
|
+
logEmptyTitle: false,
|
|
114
|
+
logTitleChange: false,
|
|
115
|
+
logger: import_logger.ListrLogger
|
|
116
|
+
},
|
|
117
|
+
ctx: {}
|
|
118
|
+
});
|
|
119
|
+
if (this.cs.oclif.windows) {
|
|
120
|
+
(0, import_readline.createInterface)({
|
|
121
|
+
input: process.stdin,
|
|
122
|
+
output: process.stdout
|
|
123
|
+
}).on("SIGINT", () => {
|
|
124
|
+
process.kill(process.pid, "SIGINT");
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
const terminate = /* @__PURE__ */ __name(() => {
|
|
128
|
+
this.logger.fatal("Caught terminate signal.", { status: import_logger.LogFieldStatus.TERMINATE });
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}, "terminate");
|
|
131
|
+
process.on("SIGINT", terminate);
|
|
132
|
+
process.on("SIGTERM", terminate);
|
|
133
|
+
this.logger.stage("Running shouldRunBefore.");
|
|
134
|
+
await this.shouldRunBefore();
|
|
135
|
+
this.logger.stage("Finished shouldRunBefore.");
|
|
136
|
+
}
|
|
137
|
+
async finally() {
|
|
138
|
+
this.logger.stage("Running tasks.");
|
|
139
|
+
const ctx = await this.runTasks();
|
|
140
|
+
this.logger.stage("Finished tasks.");
|
|
141
|
+
this.logger.stage("Running shouldRunAfter.");
|
|
142
|
+
await this.shouldRunAfter(ctx);
|
|
143
|
+
this.logger.stage("Finished shouldRunAfter.");
|
|
144
|
+
return { ctx };
|
|
145
|
+
}
|
|
146
|
+
catch(e, exit) {
|
|
147
|
+
if (!this.logger) {
|
|
148
|
+
console.error("Logger has not been initiated yet!");
|
|
149
|
+
console.error(e.message);
|
|
150
|
+
console.debug(e.stack);
|
|
151
|
+
}
|
|
152
|
+
this.logger.fatal(e.message);
|
|
153
|
+
this.logger.debug(e.stack, { context: "crash" });
|
|
154
|
+
if (exit > 0) {
|
|
155
|
+
this.exit(exit);
|
|
156
|
+
}
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
greet() {
|
|
160
|
+
if (this.cs.isSilent || this.cs.json) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const logo = this.store.get("logo") ?? `${this.cs.oclif.name} v${this.cs.oclif.version}`;
|
|
164
|
+
this.logger.direct(logo);
|
|
165
|
+
if (!this.store.has("logo")) {
|
|
166
|
+
this.logger.direct("-".repeat(logo.length));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
__name(Command, "Command");
|
|
171
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
172
|
+
0 && (module.exports = {
|
|
173
|
+
Command
|
|
174
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as _oclif_core_lib_cli_ux_styled_progress from '@oclif/core/lib/cli-ux/styled/progress';
|
|
2
|
+
import * as _oclif_core_lib_cli_ux_open from '@oclif/core/lib/cli-ux/open';
|
|
3
|
+
import * as _oclif_core_lib_cli_ux_styled_tree from '@oclif/core/lib/cli-ux/styled/tree';
|
|
4
|
+
import * as _oclif_core_lib_cli_ux_styled_json from '@oclif/core/lib/cli-ux/styled/json';
|
|
5
|
+
import * as _oclif_core_lib_cli_ux_styled_header from '@oclif/core/lib/cli-ux/styled/header';
|
|
6
|
+
import * as _oclif_core_lib_cli_ux_prompt from '@oclif/core/lib/cli-ux/prompt';
|
|
7
|
+
import * as _oclif_core_lib_errors from '@oclif/core/lib/errors';
|
|
8
|
+
import { ListrContext } from 'listr2';
|
|
9
|
+
import { C as Command } from '../base.command-d3038122.js';
|
|
10
|
+
import { ConfigCommandChoices, ConfigCommandSetup } from '../interfaces/config-command.interface.js';
|
|
11
|
+
import { InferFlags, InferArgs } from '../interfaces/oclif.interface.js';
|
|
12
|
+
import { CliUx } from '@oclif/core';
|
|
13
|
+
import { LockerService } from '../lib/locker/locker.service.js';
|
|
14
|
+
import '../utils/logger/logger.js';
|
|
15
|
+
import '../utils/logger/logger.constants.js';
|
|
16
|
+
import '../utils/logger/logger.interface.js';
|
|
17
|
+
import 'winston';
|
|
18
|
+
import '../lib/config/config.interface.js';
|
|
19
|
+
import '../lib/fs/filesystem.service.js';
|
|
20
|
+
import 'fs-extra';
|
|
21
|
+
import '../utils/defaults.js';
|
|
22
|
+
import '../lib/parser/parser.service.js';
|
|
23
|
+
import '../lib/parser/parser.interface.js';
|
|
24
|
+
import '../interfaces/class.interface.js';
|
|
25
|
+
import '../lib/locker/locker.interface.js';
|
|
26
|
+
import '../utils/merge.constants.js';
|
|
27
|
+
import '../lib/store/store.service.js';
|
|
28
|
+
import '../lib/store/store.interface.js';
|
|
29
|
+
import '../lib/validator/validator.service.js';
|
|
30
|
+
import '../lib/validator/validator.interface.js';
|
|
31
|
+
import 'class-transformer';
|
|
32
|
+
import 'class-validator';
|
|
33
|
+
import '@oclif/core/lib/interfaces';
|
|
34
|
+
|
|
35
|
+
declare class ConfigCommand<CommandChoices extends string = string, LockFile = any, Ctx extends ListrContext = ListrContext, Flags extends Record<PropertyKey, any> = InferFlags<typeof ConfigCommand>, Args extends Record<PropertyKey, any> = InferArgs<typeof ConfigCommand>, Store extends Record<PropertyKey, any> = Record<PropertyKey, any>> extends Command<Ctx, Flags, Args, Store> {
|
|
36
|
+
choices: ConfigCommandChoices<CommandChoices>;
|
|
37
|
+
locker: LockerService<LockFile>;
|
|
38
|
+
protected ux: {
|
|
39
|
+
config: CliUx.Config;
|
|
40
|
+
warn: typeof _oclif_core_lib_errors.warn;
|
|
41
|
+
error: typeof _oclif_core_lib_errors.error;
|
|
42
|
+
exit: typeof _oclif_core_lib_errors.exit;
|
|
43
|
+
readonly prompt: typeof _oclif_core_lib_cli_ux_prompt.prompt;
|
|
44
|
+
readonly anykey: typeof _oclif_core_lib_cli_ux_prompt.anykey;
|
|
45
|
+
readonly confirm: typeof _oclif_core_lib_cli_ux_prompt.confirm;
|
|
46
|
+
readonly action: CliUx.ActionBase;
|
|
47
|
+
readonly prideAction: CliUx.ActionBase;
|
|
48
|
+
styledObject(obj: any, keys?: string[]): void;
|
|
49
|
+
readonly styledHeader: typeof _oclif_core_lib_cli_ux_styled_header.default;
|
|
50
|
+
readonly styledJSON: typeof _oclif_core_lib_cli_ux_styled_json.default;
|
|
51
|
+
readonly table: typeof CliUx.Table.table;
|
|
52
|
+
readonly tree: typeof _oclif_core_lib_cli_ux_styled_tree.default;
|
|
53
|
+
readonly open: typeof _oclif_core_lib_cli_ux_open.default;
|
|
54
|
+
readonly wait: (ms?: number) => Promise<unknown>;
|
|
55
|
+
readonly progress: typeof _oclif_core_lib_cli_ux_styled_progress.default;
|
|
56
|
+
done(): Promise<void>;
|
|
57
|
+
trace(format: string, ...args: string[]): void;
|
|
58
|
+
debug(format: string, ...args: string[]): void;
|
|
59
|
+
info(format: string, ...args: string[]): void;
|
|
60
|
+
log(format?: string, ...args: string[]): void;
|
|
61
|
+
url(text: string, uri: string, params?: {}): void;
|
|
62
|
+
annotation(text: string, annotation: string): void;
|
|
63
|
+
flush(ms?: number): Promise<void>;
|
|
64
|
+
};
|
|
65
|
+
run(): Promise<any>;
|
|
66
|
+
setup(): ConfigCommandSetup<CommandChoices, LockFile> | Promise<ConfigCommandSetup<CommandChoices, LockFile>>;
|
|
67
|
+
protected table(...options: Parameters<typeof CliUx.ux.table>): void;
|
|
68
|
+
protected select(): Promise<string>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { ConfigCommand };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var config_command_exports = {};
|
|
20
|
+
__export(config_command_exports, {
|
|
21
|
+
ConfigCommand: () => ConfigCommand
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(config_command_exports);
|
|
24
|
+
var import_base = require("./base.command");
|
|
25
|
+
var import_utils = require("../utils");
|
|
26
|
+
class ConfigCommand extends import_base.Command {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.ux = import_utils.CliUx.ux;
|
|
30
|
+
}
|
|
31
|
+
async run() {
|
|
32
|
+
this.logger.stage("Setting up config command.");
|
|
33
|
+
const setup = await this.setup();
|
|
34
|
+
this.choices = setup.choices;
|
|
35
|
+
this.locker = setup.locker;
|
|
36
|
+
this.logger.stage("User selection for configuration.");
|
|
37
|
+
const response = await this.select();
|
|
38
|
+
this.logger.stage("Will run selection: %s", response);
|
|
39
|
+
return this.choices[response].bind(this)();
|
|
40
|
+
}
|
|
41
|
+
setup() {
|
|
42
|
+
throw new Error("The command should be setup first!");
|
|
43
|
+
}
|
|
44
|
+
table(...options) {
|
|
45
|
+
this.ux.table(...options);
|
|
46
|
+
}
|
|
47
|
+
async select() {
|
|
48
|
+
const response = await this.prompt({
|
|
49
|
+
type: "Select",
|
|
50
|
+
message: "Please select what to do with the configuration.",
|
|
51
|
+
choices: Object.keys(this.choices)
|
|
52
|
+
});
|
|
53
|
+
return response;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
__name(ConfigCommand, "ConfigCommand");
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
ConfigCommand
|
|
60
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { C as Command } from '../base.command-d3038122.js';
|
|
2
|
+
export { ConfigCommand } from './config.command.js';
|
|
3
|
+
import '@oclif/core';
|
|
4
|
+
import 'listr2';
|
|
5
|
+
import '../utils/logger/logger.js';
|
|
6
|
+
import '../utils/logger/logger.constants.js';
|
|
7
|
+
import '../utils/logger/logger.interface.js';
|
|
8
|
+
import 'winston';
|
|
9
|
+
import '../lib/config/config.interface.js';
|
|
10
|
+
import '../lib/fs/filesystem.service.js';
|
|
11
|
+
import 'fs-extra';
|
|
12
|
+
import '../utils/defaults.js';
|
|
13
|
+
import '../lib/parser/parser.service.js';
|
|
14
|
+
import '../lib/parser/parser.interface.js';
|
|
15
|
+
import '../interfaces/class.interface.js';
|
|
16
|
+
import '../lib/locker/locker.interface.js';
|
|
17
|
+
import '../utils/merge.constants.js';
|
|
18
|
+
import '../lib/store/store.service.js';
|
|
19
|
+
import '../lib/store/store.interface.js';
|
|
20
|
+
import '../lib/validator/validator.service.js';
|
|
21
|
+
import '../lib/validator/validator.interface.js';
|
|
22
|
+
import 'class-transformer';
|
|
23
|
+
import 'class-validator';
|
|
24
|
+
import '../interfaces/oclif.interface.js';
|
|
25
|
+
import '@oclif/core/lib/interfaces';
|
|
26
|
+
import '@oclif/core/lib/cli-ux/styled/progress';
|
|
27
|
+
import '@oclif/core/lib/cli-ux/open';
|
|
28
|
+
import '@oclif/core/lib/cli-ux/styled/tree';
|
|
29
|
+
import '@oclif/core/lib/cli-ux/styled/json';
|
|
30
|
+
import '@oclif/core/lib/cli-ux/styled/header';
|
|
31
|
+
import '@oclif/core/lib/cli-ux/prompt';
|
|
32
|
+
import '@oclif/core/lib/errors';
|
|
33
|
+
import '../interfaces/config-command.interface.js';
|
|
34
|
+
import '../lib/locker/locker.service.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var commands_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(commands_exports);
|
|
17
|
+
__reExport(commands_exports, require("./base.command"), module.exports);
|
|
18
|
+
__reExport(commands_exports, require("./config.command"), module.exports);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var file_constants_exports = {};
|
|
19
|
+
__export(file_constants_exports, {
|
|
20
|
+
FileConstants: () => FileConstants
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(file_constants_exports);
|
|
23
|
+
var FileConstants = /* @__PURE__ */ ((FileConstants2) => {
|
|
24
|
+
FileConstants2["CONFIG_SERVICE_DEFAULTS_DIR"] = "config";
|
|
25
|
+
return FileConstants2;
|
|
26
|
+
})(FileConstants || {});
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
FileConstants
|
|
30
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var global_flags_constants_exports = {};
|
|
19
|
+
__export(global_flags_constants_exports, {
|
|
20
|
+
CLI_FLAGS: () => CLI_FLAGS
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(global_flags_constants_exports);
|
|
23
|
+
var import_help_groups = require("./help-groups.constants");
|
|
24
|
+
var import_interfaces = require("../interfaces");
|
|
25
|
+
var import_logger = require("../utils/logger");
|
|
26
|
+
const CLI_FLAGS = {
|
|
27
|
+
["log-level"]: import_interfaces.Flags.enum({
|
|
28
|
+
default: import_logger.LogLevels.INFO,
|
|
29
|
+
env: "LOG_LEVEL",
|
|
30
|
+
description: "Set the log level of the application.",
|
|
31
|
+
options: [...Object.values(import_logger.LogLevels).map((level) => level.toLowerCase())],
|
|
32
|
+
helpGroup: import_help_groups.HelpGroups.CLI,
|
|
33
|
+
parse: async (input) => input?.toUpperCase()
|
|
34
|
+
}),
|
|
35
|
+
ci: import_interfaces.Flags.boolean({
|
|
36
|
+
default: false,
|
|
37
|
+
hidden: true,
|
|
38
|
+
env: "CI",
|
|
39
|
+
description: "Instruct whether this is running the CI/CD configuration.",
|
|
40
|
+
helpGroup: import_help_groups.HelpGroups.CLI
|
|
41
|
+
}),
|
|
42
|
+
json: import_interfaces.Flags.boolean({
|
|
43
|
+
default: false,
|
|
44
|
+
hidden: true,
|
|
45
|
+
env: "JSON",
|
|
46
|
+
description: "Put the CLI to respond in JSON.",
|
|
47
|
+
helpGroup: import_help_groups.HelpGroups.CLI
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
CLI_FLAGS
|
|
53
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var help_groups_constants_exports = {};
|
|
19
|
+
__export(help_groups_constants_exports, {
|
|
20
|
+
HelpGroups: () => HelpGroups
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(help_groups_constants_exports);
|
|
23
|
+
var HelpGroups = /* @__PURE__ */ ((HelpGroups2) => {
|
|
24
|
+
HelpGroups2["CLI"] = "CLI";
|
|
25
|
+
return HelpGroups2;
|
|
26
|
+
})(HelpGroups || {});
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
HelpGroups
|
|
30
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var constants_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(constants_exports);
|
|
17
|
+
__reExport(constants_exports, require("./file.constants"), module.exports);
|
|
18
|
+
__reExport(constants_exports, require("./global-flags.constants"), module.exports);
|
|
19
|
+
__reExport(constants_exports, require("./help-groups.constants"), module.exports);
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { notFoundHook } from './not-found.hook.js';
|
|
2
2
|
export { updateNotifierHook } from './update-notifier.hook.js';
|
|
3
|
-
export {
|
|
3
|
+
export { storeHook } from './store.hook.js';
|
|
4
4
|
import '@oclif/core';
|
|
5
|
+
import '../lib/store/store.service.js';
|
|
6
|
+
import '../lib/store/store.interface.js';
|