@cenk1cenk2/oclif-common 3.5.2 → 3.5.3
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/hooks/index.js +3 -0
- package/dist/hooks/not-found.hook.js +3 -0
- package/dist/hooks/store.hook.js +3 -0
- package/dist/index.d.ts +41 -4
- package/dist/index.js +21 -9
- package/package.json +1 -1
package/dist/hooks/index.js
CHANGED
|
@@ -113,6 +113,9 @@ var Logger = class {
|
|
|
113
113
|
end(data, ...args) {
|
|
114
114
|
return this.parseMessage("INFO" /* INFO */, data, args, { status: "END" /* END */ });
|
|
115
115
|
}
|
|
116
|
+
stage(data, ...args) {
|
|
117
|
+
return this.parseMessage("TRACE" /* TRACE */, data, args, { status: "STAGE" /* STAGE */ });
|
|
118
|
+
}
|
|
116
119
|
initiateLogger() {
|
|
117
120
|
const logFormat = import_winston.format.printf(({ level, message, context, status }) => {
|
|
118
121
|
let multiLineMessage;
|
|
@@ -109,6 +109,9 @@ var Logger = class {
|
|
|
109
109
|
end(data, ...args) {
|
|
110
110
|
return this.parseMessage("INFO" /* INFO */, data, args, { status: "END" /* END */ });
|
|
111
111
|
}
|
|
112
|
+
stage(data, ...args) {
|
|
113
|
+
return this.parseMessage("TRACE" /* TRACE */, data, args, { status: "STAGE" /* STAGE */ });
|
|
114
|
+
}
|
|
112
115
|
initiateLogger() {
|
|
113
116
|
const logFormat = import_winston.format.printf(({ level, message, context, status }) => {
|
|
114
117
|
let multiLineMessage;
|
package/dist/hooks/store.hook.js
CHANGED
|
@@ -115,6 +115,9 @@ var Logger = class {
|
|
|
115
115
|
end(data, ...args) {
|
|
116
116
|
return this.parseMessage("INFO" /* INFO */, data, args, { status: "END" /* END */ });
|
|
117
117
|
}
|
|
118
|
+
stage(data, ...args) {
|
|
119
|
+
return this.parseMessage("TRACE" /* TRACE */, data, args, { status: "STAGE" /* STAGE */ });
|
|
120
|
+
}
|
|
118
121
|
initiateLogger() {
|
|
119
122
|
const logFormat = import_winston.format.printf(({ level, message, context, status }) => {
|
|
120
123
|
let multiLineMessage;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,13 @@ import { ClassTransformOptions } from 'class-transformer';
|
|
|
10
10
|
import { ValidatorOptions } from 'class-validator';
|
|
11
11
|
import { InferredFlags, FlagInput } from '@oclif/core/lib/interfaces';
|
|
12
12
|
export { Arg, ArgInput, Flag, FlagInput, InferredFlags } from '@oclif/core/lib/interfaces';
|
|
13
|
+
import * as _oclif_core_lib_cli_ux_styled_progress from '@oclif/core/lib/cli-ux/styled/progress';
|
|
14
|
+
import * as _oclif_core_lib_cli_ux_open from '@oclif/core/lib/cli-ux/open';
|
|
15
|
+
import * as _oclif_core_lib_cli_ux_styled_tree from '@oclif/core/lib/cli-ux/styled/tree';
|
|
16
|
+
import * as _oclif_core_lib_cli_ux_styled_json from '@oclif/core/lib/cli-ux/styled/json';
|
|
17
|
+
import * as _oclif_core_lib_cli_ux_styled_header from '@oclif/core/lib/cli-ux/styled/header';
|
|
18
|
+
import * as _oclif_core_lib_cli_ux_prompt from '@oclif/core/lib/cli-ux/prompt';
|
|
19
|
+
import * as _oclif_core_lib_errors from '@oclif/core/lib/errors';
|
|
13
20
|
export { notFoundHook } from './hooks/not-found.hook.js';
|
|
14
21
|
export { updateNotifierHook } from './hooks/update-notifier.hook.js';
|
|
15
22
|
import { ExecaChildProcess } from 'execa';
|
|
@@ -30,7 +37,10 @@ declare enum LogLevels {
|
|
|
30
37
|
}
|
|
31
38
|
declare enum LogFieldStatus {
|
|
32
39
|
RUN = "RUN",
|
|
33
|
-
END = "END"
|
|
40
|
+
END = "END",
|
|
41
|
+
STAGE = "STAGE",
|
|
42
|
+
EXIT = "EXIT",
|
|
43
|
+
TERMINATE = "TERMINATE"
|
|
34
44
|
}
|
|
35
45
|
|
|
36
46
|
interface LoggerOptions {
|
|
@@ -65,6 +75,7 @@ declare class Logger {
|
|
|
65
75
|
trace(data: string | Buffer, ...args: any): void;
|
|
66
76
|
run(data: string | Buffer, ...args: any): void;
|
|
67
77
|
end(data: string | Buffer, ...args: any): void;
|
|
78
|
+
stage(data: string | Buffer, ...args: any): void;
|
|
68
79
|
private initiateLogger;
|
|
69
80
|
private parseMessage;
|
|
70
81
|
private logColoring;
|
|
@@ -339,11 +350,37 @@ declare class ConfigCommand<CommandChoices extends string = string, LockFile = a
|
|
|
339
350
|
static globalFlags: object;
|
|
340
351
|
choices: ConfigCommandChoices<CommandChoices>;
|
|
341
352
|
locker: LockerService<LockFile>;
|
|
342
|
-
|
|
353
|
+
protected ux: {
|
|
354
|
+
config: CliUx.Config;
|
|
355
|
+
warn: typeof _oclif_core_lib_errors.warn;
|
|
356
|
+
error: typeof _oclif_core_lib_errors.error;
|
|
357
|
+
exit: typeof _oclif_core_lib_errors.exit;
|
|
358
|
+
readonly prompt: typeof _oclif_core_lib_cli_ux_prompt.prompt;
|
|
359
|
+
readonly anykey: typeof _oclif_core_lib_cli_ux_prompt.anykey;
|
|
360
|
+
readonly confirm: typeof _oclif_core_lib_cli_ux_prompt.confirm;
|
|
361
|
+
readonly action: CliUx.ActionBase;
|
|
362
|
+
readonly prideAction: CliUx.ActionBase;
|
|
363
|
+
styledObject(obj: any, keys?: string[]): void;
|
|
364
|
+
readonly styledHeader: typeof _oclif_core_lib_cli_ux_styled_header.default;
|
|
365
|
+
readonly styledJSON: typeof _oclif_core_lib_cli_ux_styled_json.default;
|
|
366
|
+
readonly table: typeof CliUx.Table.table;
|
|
367
|
+
readonly tree: typeof _oclif_core_lib_cli_ux_styled_tree.default;
|
|
368
|
+
readonly open: typeof _oclif_core_lib_cli_ux_open.default;
|
|
369
|
+
readonly wait: (ms?: number) => Promise<unknown>;
|
|
370
|
+
readonly progress: typeof _oclif_core_lib_cli_ux_styled_progress.default;
|
|
371
|
+
done(): Promise<void>;
|
|
372
|
+
trace(format: string, ...args: string[]): void;
|
|
373
|
+
debug(format: string, ...args: string[]): void;
|
|
374
|
+
info(format: string, ...args: string[]): void;
|
|
375
|
+
log(format?: string, ...args: string[]): void;
|
|
376
|
+
url(text: string, uri: string, params?: {}): void;
|
|
377
|
+
annotation(text: string, annotation: string): void;
|
|
378
|
+
flush(ms?: number): Promise<void>;
|
|
379
|
+
};
|
|
343
380
|
run(): Promise<void>;
|
|
344
|
-
|
|
381
|
+
setup(): ConfigCommandSetup<CommandChoices, LockFile> | Promise<ConfigCommandSetup<CommandChoices, LockFile>>;
|
|
345
382
|
protected table(...options: Parameters<typeof CliUx.ux.table>): void;
|
|
346
|
-
|
|
383
|
+
protected select(): Promise<string>;
|
|
347
384
|
}
|
|
348
385
|
|
|
349
386
|
declare enum FileConstants {
|
package/dist/index.js
CHANGED
|
@@ -108,6 +108,9 @@ var LogLevels = /* @__PURE__ */ ((LogLevels2) => {
|
|
|
108
108
|
var LogFieldStatus = /* @__PURE__ */ ((LogFieldStatus2) => {
|
|
109
109
|
LogFieldStatus2["RUN"] = "RUN";
|
|
110
110
|
LogFieldStatus2["END"] = "END";
|
|
111
|
+
LogFieldStatus2["STAGE"] = "STAGE";
|
|
112
|
+
LogFieldStatus2["EXIT"] = "EXIT";
|
|
113
|
+
LogFieldStatus2["TERMINATE"] = "TERMINATE";
|
|
111
114
|
return LogFieldStatus2;
|
|
112
115
|
})(LogFieldStatus || {});
|
|
113
116
|
|
|
@@ -167,6 +170,9 @@ var Logger = class {
|
|
|
167
170
|
end(data, ...args) {
|
|
168
171
|
return this.parseMessage("INFO" /* INFO */, data, args, { status: "END" /* END */ });
|
|
169
172
|
}
|
|
173
|
+
stage(data, ...args) {
|
|
174
|
+
return this.parseMessage("TRACE" /* TRACE */, data, args, { status: "STAGE" /* STAGE */ });
|
|
175
|
+
}
|
|
170
176
|
initiateLogger() {
|
|
171
177
|
const logFormat = import_winston.format.printf(({ level, message, context, status }) => {
|
|
172
178
|
let multiLineMessage;
|
|
@@ -1049,7 +1055,7 @@ var Command = class extends import_core3.Command {
|
|
|
1049
1055
|
if (err) {
|
|
1050
1056
|
throw err;
|
|
1051
1057
|
}
|
|
1052
|
-
this.logger.
|
|
1058
|
+
this.logger.stage("Initiating services.");
|
|
1053
1059
|
this.parser = new ParserService();
|
|
1054
1060
|
this.fs = new FileSystemService();
|
|
1055
1061
|
this.validator = new ValidatorService();
|
|
@@ -1073,11 +1079,12 @@ var Command = class extends import_core3.Command {
|
|
|
1073
1079
|
});
|
|
1074
1080
|
}
|
|
1075
1081
|
process.on("SIGINT", () => {
|
|
1076
|
-
this.logger.fatal("Caught terminate signal.", {
|
|
1082
|
+
this.logger.fatal("Caught terminate signal.", { status: "TERMINATE" /* TERMINATE */ });
|
|
1077
1083
|
process.exit(1);
|
|
1078
1084
|
});
|
|
1079
|
-
this.logger.
|
|
1085
|
+
this.logger.stage("Running shouldRunBefore.");
|
|
1080
1086
|
await this.shouldRunBefore();
|
|
1087
|
+
this.logger.stage("Finished shouldRunBefore.");
|
|
1081
1088
|
}
|
|
1082
1089
|
shouldRunBefore() {
|
|
1083
1090
|
}
|
|
@@ -1087,10 +1094,12 @@ var Command = class extends import_core3.Command {
|
|
|
1087
1094
|
throw new Error("The command should have a run function to do something!");
|
|
1088
1095
|
}
|
|
1089
1096
|
async finally() {
|
|
1090
|
-
this.logger.
|
|
1097
|
+
this.logger.stage("Running tasks.");
|
|
1091
1098
|
const ctx = await this.runTasks();
|
|
1092
|
-
this.logger.
|
|
1099
|
+
this.logger.stage("Finished tasks.");
|
|
1100
|
+
this.logger.stage("Running shouldRunAfter.");
|
|
1093
1101
|
await this.shouldRunAfter(ctx);
|
|
1102
|
+
this.logger.stage("Finished shouldRunAfter.");
|
|
1094
1103
|
return { ctx };
|
|
1095
1104
|
}
|
|
1096
1105
|
catch(e) {
|
|
@@ -1100,7 +1109,7 @@ var Command = class extends import_core3.Command {
|
|
|
1100
1109
|
return;
|
|
1101
1110
|
}
|
|
1102
1111
|
exit(code) {
|
|
1103
|
-
this.logger.trace("
|
|
1112
|
+
this.logger.trace("Code -> %d", code, { status: "EXIT" /* EXIT */ });
|
|
1104
1113
|
process.exit(code ?? 0);
|
|
1105
1114
|
}
|
|
1106
1115
|
runTasks() {
|
|
@@ -1143,13 +1152,16 @@ var ConfigCommand = class extends Command {
|
|
|
1143
1152
|
this.ux = import_core2.CliUx.ux;
|
|
1144
1153
|
}
|
|
1145
1154
|
async run() {
|
|
1146
|
-
|
|
1155
|
+
this.logger.stage("Setting up config command.");
|
|
1156
|
+
const setup2 = await this.setup();
|
|
1147
1157
|
this.choices = setup2.choices;
|
|
1148
1158
|
this.locker = setup2.locker;
|
|
1159
|
+
this.logger.stage("User selection for configuration.");
|
|
1149
1160
|
const response = await this.select();
|
|
1150
|
-
|
|
1161
|
+
this.logger.stage("Will run selection: %s", response);
|
|
1162
|
+
return this.choices[response]();
|
|
1151
1163
|
}
|
|
1152
|
-
|
|
1164
|
+
setup() {
|
|
1153
1165
|
throw new Error("The command should be setup first!");
|
|
1154
1166
|
}
|
|
1155
1167
|
table(...options) {
|