@cenk1cenk2/oclif-common 3.1.1 → 3.2.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.
@@ -35,11 +35,13 @@ module.exports = __toCommonJS(hooks_exports);
35
35
  // src/hooks/not-found.hook.ts
36
36
  var import_core = require("@oclif/core");
37
37
 
38
- // src/utils/logger/pipe/pipe-process-to-listr.ts
39
- var import_through = __toESM(require("through"));
38
+ // src/utils/logger/listr-logger.ts
39
+ var import_listr22 = require("listr2");
40
40
 
41
- // src/utils/logger/pipe/pipe-process-to-logger.ts
42
- var import_through2 = __toESM(require("through"));
41
+ // src/utils/logger/logger.ts
42
+ var import_listr2 = require("listr2");
43
+ var import_os = require("os");
44
+ var import_winston = __toESM(require("winston"));
43
45
 
44
46
  // src/utils/logger/logger.constants.ts
45
47
  var LogLevels = /* @__PURE__ */ ((LogLevels2) => {
@@ -55,11 +57,6 @@ var LogLevels = /* @__PURE__ */ ((LogLevels2) => {
55
57
  return LogLevels2;
56
58
  })(LogLevels || {});
57
59
 
58
- // src/utils/logger/logger.ts
59
- var import_listr2 = require("listr2");
60
- var import_os = require("os");
61
- var import_winston = __toESM(require("winston"));
62
-
63
60
  // src/utils/color.ts
64
61
  var colorette = __toESM(require("colorette"));
65
62
  var color = colorette.createColors({ useColor: true });
@@ -216,6 +213,12 @@ var Logger = class {
216
213
  };
217
214
  __name(Logger, "Logger");
218
215
 
216
+ // src/utils/logger/pipe/pipe-process-to-listr.ts
217
+ var import_through = __toESM(require("through"));
218
+
219
+ // src/utils/logger/pipe/pipe-process-to-logger.ts
220
+ var import_through2 = __toESM(require("through"));
221
+
219
222
  // src/hooks/not-found.hook.ts
220
223
  var notFoundHook = /* @__PURE__ */ __name(async (opts) => {
221
224
  const logger = new Logger(opts.config.name);
@@ -298,6 +301,9 @@ var import_path = require("path");
298
301
  // src/utils/merge.ts
299
302
  var import_deepmerge = __toESM(require("deepmerge"));
300
303
 
304
+ // src/utils/index.ts
305
+ var import_core2 = require("@oclif/core");
306
+
301
307
  // src/lib/locker/locker.service.ts
302
308
  var import_object_path_immutable2 = __toESM(require("object-path-immutable"));
303
309
 
@@ -31,11 +31,13 @@ __export(not_found_hook_exports, {
31
31
  module.exports = __toCommonJS(not_found_hook_exports);
32
32
  var import_core = require("@oclif/core");
33
33
 
34
- // src/utils/logger/pipe/pipe-process-to-listr.ts
35
- var import_through = __toESM(require("through"));
34
+ // src/utils/logger/listr-logger.ts
35
+ var import_listr22 = require("listr2");
36
36
 
37
- // src/utils/logger/pipe/pipe-process-to-logger.ts
38
- var import_through2 = __toESM(require("through"));
37
+ // src/utils/logger/logger.ts
38
+ var import_listr2 = require("listr2");
39
+ var import_os = require("os");
40
+ var import_winston = __toESM(require("winston"));
39
41
 
40
42
  // src/utils/logger/logger.constants.ts
41
43
  var LogLevels = /* @__PURE__ */ ((LogLevels2) => {
@@ -51,11 +53,6 @@ var LogLevels = /* @__PURE__ */ ((LogLevels2) => {
51
53
  return LogLevels2;
52
54
  })(LogLevels || {});
53
55
 
54
- // src/utils/logger/logger.ts
55
- var import_listr2 = require("listr2");
56
- var import_os = require("os");
57
- var import_winston = __toESM(require("winston"));
58
-
59
56
  // src/utils/color.ts
60
57
  var colorette = __toESM(require("colorette"));
61
58
  var color = colorette.createColors({ useColor: true });
@@ -212,6 +209,12 @@ var Logger = class {
212
209
  };
213
210
  __name(Logger, "Logger");
214
211
 
212
+ // src/utils/logger/pipe/pipe-process-to-listr.ts
213
+ var import_through = __toESM(require("through"));
214
+
215
+ // src/utils/logger/pipe/pipe-process-to-logger.ts
216
+ var import_through2 = __toESM(require("through"));
217
+
215
218
  // src/hooks/not-found.hook.ts
216
219
  var notFoundHook = /* @__PURE__ */ __name(async (opts) => {
217
220
  const logger = new Logger(opts.config.name);
@@ -34,11 +34,13 @@ module.exports = __toCommonJS(store_hook_exports);
34
34
  var import_object_path_immutable = __toESM(require("object-path-immutable"));
35
35
  var import_path2 = require("path");
36
36
 
37
- // src/utils/logger/pipe/pipe-process-to-listr.ts
38
- var import_through = __toESM(require("through"));
37
+ // src/utils/logger/listr-logger.ts
38
+ var import_listr22 = require("listr2");
39
39
 
40
- // src/utils/logger/pipe/pipe-process-to-logger.ts
41
- var import_through2 = __toESM(require("through"));
40
+ // src/utils/logger/logger.ts
41
+ var import_listr2 = require("listr2");
42
+ var import_os = require("os");
43
+ var import_winston = __toESM(require("winston"));
42
44
 
43
45
  // src/utils/logger/logger.constants.ts
44
46
  var LogLevels = /* @__PURE__ */ ((LogLevels2) => {
@@ -54,11 +56,6 @@ var LogLevels = /* @__PURE__ */ ((LogLevels2) => {
54
56
  return LogLevels2;
55
57
  })(LogLevels || {});
56
58
 
57
- // src/utils/logger/logger.ts
58
- var import_listr2 = require("listr2");
59
- var import_os = require("os");
60
- var import_winston = __toESM(require("winston"));
61
-
62
59
  // src/utils/color.ts
63
60
  var colorette = __toESM(require("colorette"));
64
61
  var color = colorette.createColors({ useColor: true });
@@ -215,6 +212,12 @@ var Logger = class {
215
212
  };
216
213
  __name(Logger, "Logger");
217
214
 
215
+ // src/utils/logger/pipe/pipe-process-to-listr.ts
216
+ var import_through = __toESM(require("through"));
217
+
218
+ // src/utils/logger/pipe/pipe-process-to-logger.ts
219
+ var import_through2 = __toESM(require("through"));
220
+
218
221
  // src/lib/parser/json-parser.service.ts
219
222
  var _JsonParser = class {
220
223
  constructor() {
@@ -277,6 +280,9 @@ var import_path = require("path");
277
280
  // src/utils/merge.ts
278
281
  var import_deepmerge = __toESM(require("deepmerge"));
279
282
 
283
+ // src/utils/index.ts
284
+ var import_core = require("@oclif/core");
285
+
280
286
  // src/lib/locker/locker.service.ts
281
287
  var import_object_path_immutable2 = __toESM(require("object-path-immutable"));
282
288
 
package/dist/index.d.ts CHANGED
@@ -1,16 +1,9 @@
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 { Command as Command$1, CliUx } from '@oclif/core';
9
- export { Flags } from '@oclif/core';
10
1
  import * as _oclif_core_lib_interfaces from '@oclif/core/lib/interfaces';
11
2
  import { InferredFlags, ArgInput } from '@oclif/core/lib/interfaces';
12
3
  export { Arg, ArgInput, Flag, FlagInput, InferredFlags } from '@oclif/core/lib/interfaces';
13
- import { ListrTaskWrapper, ListrContext, Manager, PromptOptions } from 'listr2';
4
+ import { Command as Command$1, CliUx } from '@oclif/core';
5
+ export { CliUx, Flags } from '@oclif/core';
6
+ import { Logger as Logger$2, ListrTaskWrapper, ListrContext, Manager, PromptOptions } from 'listr2';
14
7
  import { Logger as Logger$1, LeveledLogMethod } from 'winston';
15
8
  import fs from 'fs-extra';
16
9
  export { default as fs } from 'fs-extra';
@@ -25,8 +18,6 @@ import * as colorette from 'colorette';
25
18
 
26
19
  declare type ClassType<T> = new (...args: any[]) => T;
27
20
 
28
- declare function pipeProcessThroughListr(task: ListrTaskWrapper<any, any>, instance: ExecaChildProcess): ExecaChildProcess;
29
-
30
21
  declare enum LogLevels {
31
22
  SILENT = "SILENT",
32
23
  DIRECT = "DIRECT",
@@ -80,6 +71,21 @@ declare class Logger {
80
71
  private logColoring;
81
72
  }
82
73
 
74
+ declare class ListrLogger extends Logger$2 {
75
+ logger: Logger;
76
+ constructor(context?: string);
77
+ fail(message: string): void;
78
+ skip(message: string): void;
79
+ success(message: string): void;
80
+ data(message: string): void;
81
+ start(message: string): void;
82
+ title(message: string): void;
83
+ retry(message: string): void;
84
+ rollback(message: string): void;
85
+ }
86
+
87
+ declare function pipeProcessThroughListr(task: ListrTaskWrapper<any, any>, instance: ExecaChildProcess): ExecaChildProcess;
88
+
83
89
  interface PipeProcessToLoggerOptions {
84
90
  /** Will log the command when the process starts. */
85
91
  start?: LogLevels;
@@ -277,7 +283,7 @@ declare function setup(): void;
277
283
  declare type ConfigCommandChoices<T extends string> = Record<T, () => void | Promise<void>>;
278
284
  interface ConfigCommandSetup<T extends string = string, LockFile = any> {
279
285
  choices: ConfigCommandChoices<T>;
280
- locker: LockerService<LockFile>;
286
+ locker?: LockerService<LockFile>;
281
287
  }
282
288
 
283
289
  declare type InferFlags<T extends typeof Command$1> = InferredFlags<T['globalFlags'] & T['flags']>;
@@ -297,7 +303,7 @@ declare abstract class Command<Ctx extends ListrContext = ListrContext, Flags ex
297
303
  };
298
304
  static args: ArgInput;
299
305
  logger: Logger;
300
- tasks: Manager<Ctx, 'default'>;
306
+ tasks: Manager<Ctx, 'default' | 'verbose' | 'silent' | 'simple'>;
301
307
  validator: ValidatorService;
302
308
  cs: ConfigService;
303
309
  parser: ParserService;
@@ -333,12 +339,13 @@ declare abstract class Command<Ctx extends ListrContext = ListrContext, Flags ex
333
339
  abstract run(): Promise<void>;
334
340
  }
335
341
 
336
- declare abstract 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> {
342
+ 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> {
337
343
  choices: ConfigCommandChoices<CommandChoices>;
338
344
  locker: LockerService<LockFile>;
339
345
  run(): Promise<void>;
346
+ setup(): ConfigCommandSetup<CommandChoices, LockFile> | Promise<ConfigCommandSetup<CommandChoices, LockFile>>;
347
+ protected table(...options: Parameters<typeof CliUx.ux.table>): void;
340
348
  private generate;
341
- abstract setup(): ConfigCommandSetup<CommandChoices, LockFile> | Promise<ConfigCommandSetup<CommandChoices, LockFile>>;
342
349
  }
343
350
 
344
351
  declare enum FileConstants {
@@ -349,34 +356,4 @@ declare enum HelpGroups {
349
356
  CLI = "CLI"
350
357
  }
351
358
 
352
- declare const _default: {
353
- 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
- };
380
- };
381
-
382
- export { ClassType, Command, CommonLockerData, ConfigCommand, ConfigCommandChoices, ConfigCommandSetup, ConfigIterator, ConfigService, DeepPartial, FileConstants, FileSystemService, GenericParser, GlobalConfig, GlobalConfigInit, HelpGroups, InferArgs, InferFlags, JsonParser, LockData, LockableData, LockerService, LogFieldStatus, LogLevels, Logger, LoggerFormat, LoggerOptions, MergeStrategy, ParserService, PipeProcessToLoggerOptions, SetCtxAssignOptions, SetCtxDefaultsOptions, UnlockData, ValidatorService, ValidatorServiceOptions, Winston, YamlParser, color, _default as default, isDebug, isSilent, isVerbose, merge, pipeProcessThroughListr, pipeProcessToLogger, setCtxAssign, setCtxDefaults, setup };
359
+ export { ClassType, Command, CommonLockerData, ConfigCommand, ConfigCommandChoices, ConfigCommandSetup, ConfigIterator, ConfigService, DeepPartial, FileConstants, FileSystemService, GenericParser, GlobalConfig, GlobalConfigInit, HelpGroups, InferArgs, InferFlags, JsonParser, ListrLogger, LockData, LockableData, LockerService, LogFieldStatus, LogLevels, Logger, LoggerFormat, LoggerOptions, MergeStrategy, ParserService, PipeProcessToLoggerOptions, SetCtxAssignOptions, SetCtxDefaultsOptions, UnlockData, ValidatorService, ValidatorServiceOptions, Winston, YamlParser, color, isDebug, isSilent, isVerbose, merge, pipeProcessThroughListr, pipeProcessToLogger, setCtxAssign, setCtxDefaults, setup };
package/dist/index.js CHANGED
@@ -26,14 +26,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
26
26
  // src/index.ts
27
27
  var src_exports = {};
28
28
  __export(src_exports, {
29
+ CliUx: () => import_core.CliUx,
29
30
  Command: () => Command,
30
31
  ConfigCommand: () => ConfigCommand,
31
32
  ConfigService: () => ConfigService,
32
33
  FileConstants: () => FileConstants,
33
34
  FileSystemService: () => FileSystemService,
34
- Flags: () => import_core3.Flags,
35
+ Flags: () => import_core4.Flags,
35
36
  HelpGroups: () => HelpGroups,
36
37
  JsonParser: () => JsonParser,
38
+ ListrLogger: () => ListrLogger,
37
39
  LockerService: () => LockerService,
38
40
  LogFieldStatus: () => LogFieldStatus,
39
41
  LogLevels: () => LogLevels,
@@ -44,7 +46,6 @@ __export(src_exports, {
44
46
  ValidatorService: () => ValidatorService,
45
47
  YamlParser: () => YamlParser,
46
48
  color: () => color,
47
- default: () => src_default,
48
49
  fs: () => import_fs_extra.default,
49
50
  isDebug: () => isDebug,
50
51
  isSilent: () => isSilent,
@@ -60,11 +61,10 @@ __export(src_exports, {
60
61
  updateNotifierHook: () => updateNotifierHook
61
62
  });
62
63
  module.exports = __toCommonJS(src_exports);
63
- var import_core4 = require("@oclif/core");
64
64
 
65
65
  // src/commands/base.command.ts
66
- var import_core = require("@oclif/core");
67
- var import_listr22 = require("listr2");
66
+ var import_core2 = require("@oclif/core");
67
+ var import_listr23 = require("listr2");
68
68
  var import_readline = require("readline");
69
69
  var import_reflect_metadata = require("reflect-metadata");
70
70
 
@@ -84,20 +84,13 @@ var HelpGroups = /* @__PURE__ */ ((HelpGroups2) => {
84
84
  var import_object_path_immutable = __toESM(require("object-path-immutable"));
85
85
  var import_path2 = require("path");
86
86
 
87
- // src/utils/logger/pipe/pipe-process-to-listr.ts
88
- var import_through = __toESM(require("through"));
89
- function pipeProcessThroughListr(task, instance) {
90
- const logOut = (0, import_through.default)((chunk) => {
91
- task.output = chunk?.toString("utf-8").trim();
92
- });
93
- instance.stdout.pipe(logOut);
94
- instance.stderr.pipe(logOut);
95
- return instance;
96
- }
97
- __name(pipeProcessThroughListr, "pipeProcessThroughListr");
87
+ // src/utils/logger/listr-logger.ts
88
+ var import_listr22 = require("listr2");
98
89
 
99
- // src/utils/logger/pipe/pipe-process-to-logger.ts
100
- var import_through2 = __toESM(require("through"));
90
+ // src/utils/logger/logger.ts
91
+ var import_listr2 = require("listr2");
92
+ var import_os = require("os");
93
+ var import_winston = __toESM(require("winston"));
101
94
 
102
95
  // src/utils/logger/logger.constants.ts
103
96
  var LogLevels = /* @__PURE__ */ ((LogLevels2) => {
@@ -118,58 +111,6 @@ var LogFieldStatus = /* @__PURE__ */ ((LogFieldStatus2) => {
118
111
  return LogFieldStatus2;
119
112
  })(LogFieldStatus || {});
120
113
 
121
- // src/utils/logger/pipe/pipe-process-to-logger.ts
122
- function pipeProcessToLogger(logger, instance, options) {
123
- options = {
124
- start: "INFO" /* INFO */,
125
- end: "INFO" /* INFO */,
126
- stdout: "INFO" /* INFO */,
127
- stderr: "WARN" /* WARN */,
128
- ...options
129
- };
130
- if (options.start) {
131
- logger.run(instance.spawnargs.join(" "), { level: options.start });
132
- }
133
- if (instance.stdout) {
134
- instance.stdout.pipe(
135
- (0, import_through2.default)((chunk) => {
136
- logger.log(options.stdout, chunk);
137
- })
138
- );
139
- }
140
- if (instance.stderr) {
141
- instance.stderr.pipe(
142
- (0, import_through2.default)((chunk) => {
143
- logger.log(options.stderr, chunk);
144
- })
145
- );
146
- }
147
- void instance.on("exit", (code, signal) => {
148
- const message = `Process ended with code ${code}${signal ? ` and signal ${signal}` : ""}.`;
149
- logger.debug(message);
150
- if (options.end) {
151
- logger.end(instance.spawnargs.join(" "), { level: options.end });
152
- }
153
- if (options?.callback) {
154
- options.callback();
155
- }
156
- });
157
- void instance.on("error", (error) => {
158
- logger.fatal(error.message);
159
- logger.debug(error.stack);
160
- if (options?.callback) {
161
- options.callback(error);
162
- }
163
- });
164
- return instance;
165
- }
166
- __name(pipeProcessToLogger, "pipeProcessToLogger");
167
-
168
- // src/utils/logger/logger.ts
169
- var import_listr2 = require("listr2");
170
- var import_os = require("os");
171
- var import_winston = __toESM(require("winston"));
172
-
173
114
  // src/utils/color.ts
174
115
  var colorette = __toESM(require("colorette"));
175
116
  var color = colorette.createColors({ useColor: true });
@@ -326,6 +267,99 @@ var Logger = class {
326
267
  };
327
268
  __name(Logger, "Logger");
328
269
 
270
+ // src/utils/logger/listr-logger.ts
271
+ var ListrLogger = class extends import_listr22.Logger {
272
+ constructor(context) {
273
+ super();
274
+ this.logger = new Logger(context);
275
+ }
276
+ fail(message) {
277
+ this.logger.error(message);
278
+ }
279
+ skip(message) {
280
+ this.logger.warn(message, { status: "skip" });
281
+ }
282
+ success(message) {
283
+ this.logger.info(message, { status: "done" });
284
+ }
285
+ data(message) {
286
+ this.logger.info(message);
287
+ }
288
+ start(message) {
289
+ this.logger.info(message, { status: "run" });
290
+ }
291
+ title(message) {
292
+ this.logger.info(message);
293
+ }
294
+ retry(message) {
295
+ this.logger.warn(message, { status: "retry" });
296
+ }
297
+ rollback(message) {
298
+ this.logger.warn(message, { status: "rollback" });
299
+ }
300
+ };
301
+ __name(ListrLogger, "ListrLogger");
302
+
303
+ // src/utils/logger/pipe/pipe-process-to-listr.ts
304
+ var import_through = __toESM(require("through"));
305
+ function pipeProcessThroughListr(task, instance) {
306
+ const logOut = (0, import_through.default)((chunk) => {
307
+ task.output = chunk?.toString("utf-8").trim();
308
+ });
309
+ instance.stdout.pipe(logOut);
310
+ instance.stderr.pipe(logOut);
311
+ return instance;
312
+ }
313
+ __name(pipeProcessThroughListr, "pipeProcessThroughListr");
314
+
315
+ // src/utils/logger/pipe/pipe-process-to-logger.ts
316
+ var import_through2 = __toESM(require("through"));
317
+ function pipeProcessToLogger(logger, instance, options) {
318
+ options = {
319
+ start: "INFO" /* INFO */,
320
+ end: "INFO" /* INFO */,
321
+ stdout: "INFO" /* INFO */,
322
+ stderr: "WARN" /* WARN */,
323
+ ...options
324
+ };
325
+ if (options.start) {
326
+ logger.run(instance.spawnargs.join(" "), { level: options.start });
327
+ }
328
+ if (instance.stdout) {
329
+ instance.stdout.pipe(
330
+ (0, import_through2.default)((chunk) => {
331
+ logger.log(options.stdout, chunk);
332
+ })
333
+ );
334
+ }
335
+ if (instance.stderr) {
336
+ instance.stderr.pipe(
337
+ (0, import_through2.default)((chunk) => {
338
+ logger.log(options.stderr, chunk);
339
+ })
340
+ );
341
+ }
342
+ void instance.on("exit", (code, signal) => {
343
+ const message = `Process ended with code ${code}${signal ? ` and signal ${signal}` : ""}.`;
344
+ logger.debug(message);
345
+ if (options.end) {
346
+ logger.end(instance.spawnargs.join(" "), { level: options.end });
347
+ }
348
+ if (options?.callback) {
349
+ options.callback();
350
+ }
351
+ });
352
+ void instance.on("error", (error) => {
353
+ logger.fatal(error.message);
354
+ logger.debug(error.stack);
355
+ if (options?.callback) {
356
+ options.callback(error);
357
+ }
358
+ });
359
+ return instance;
360
+ }
361
+ __name(pipeProcessToLogger, "pipeProcessToLogger");
362
+
329
363
  // src/lib/parser/json-parser.service.ts
330
364
  var _JsonParser = class {
331
365
  constructor() {
@@ -592,6 +626,9 @@ function setCtxAssign(ctx, ...assigns) {
592
626
  }
593
627
  __name(setCtxAssign, "setCtxAssign");
594
628
 
629
+ // src/utils/index.ts
630
+ var import_core = require("@oclif/core");
631
+
595
632
  // src/lib/config/config.service.ts
596
633
  var ConfigService = class {
597
634
  constructor(oclif, command, config) {
@@ -938,7 +975,7 @@ function setup() {
938
975
  __name(setup, "setup");
939
976
 
940
977
  // src/commands/base.command.ts
941
- var Command = class extends import_core.Command {
978
+ var Command = class extends import_core2.Command {
942
979
  constructor() {
943
980
  super(...arguments);
944
981
  this.store = new StoreService();
@@ -959,7 +996,8 @@ var Command = class extends import_core.Command {
959
996
  ci: this.flags.ci,
960
997
  json: this.flags.json
961
998
  });
962
- this.logger = new Logger(this.cs.command.id ? this.cs.command.id : this.cs.command.name, { level: this.cs.logLevel });
999
+ const context = this.cs.command.id ? this.cs.command.id : this.cs.command.name;
1000
+ this.logger = new Logger(context, { level: this.cs.logLevel });
963
1001
  this.greet();
964
1002
  if (err) {
965
1003
  throw err;
@@ -967,10 +1005,15 @@ var Command = class extends import_core.Command {
967
1005
  this.parser = new ParserService();
968
1006
  this.fs = new FileSystemService();
969
1007
  this.validator = new ValidatorService();
970
- this.tasks = new import_listr22.Manager({
1008
+ this.tasks = new import_listr23.Manager({
971
1009
  rendererFallback: this.cs.isDebug,
972
1010
  rendererSilent: this.cs.isSilent,
973
- nonTTYRendererOptions: { logEmptyTitle: false, logTitleChange: false },
1011
+ nonTTYRendererOptions: {
1012
+ logEmptyTitle: false,
1013
+ logTitleChange: false,
1014
+ logger: ListrLogger,
1015
+ options: [context]
1016
+ },
974
1017
  ctx: {}
975
1018
  });
976
1019
  if (this.cs.oclif.windows) {
@@ -1013,7 +1056,7 @@ var Command = class extends import_core.Command {
1013
1056
  }
1014
1057
  prompt(options) {
1015
1058
  try {
1016
- return (0, import_listr22.createPrompt)(options, {
1059
+ return (0, import_listr23.createPrompt)(options, {
1017
1060
  stdout: process.stdout,
1018
1061
  cancelCallback: () => {
1019
1062
  throw new Error("Cancelled prompt.");
@@ -1047,7 +1090,7 @@ var Command = class extends import_core.Command {
1047
1090
  };
1048
1091
  __name(Command, "Command");
1049
1092
  Command.globalFlags = {
1050
- ["log-level"]: import_core.Flags.enum({
1093
+ ["log-level"]: import_core2.Flags.enum({
1051
1094
  default: "INFO" /* INFO */,
1052
1095
  env: "LOG_LEVEL",
1053
1096
  description: "Set the log level of the application.",
@@ -1055,7 +1098,7 @@ Command.globalFlags = {
1055
1098
  helpGroup: "CLI" /* CLI */,
1056
1099
  parse: async (input) => input?.toUpperCase()
1057
1100
  }),
1058
- ci: import_core.Flags.boolean({
1101
+ ci: import_core2.Flags.boolean({
1059
1102
  default: false,
1060
1103
  env: "CI",
1061
1104
  description: "Instruct whether this is running the CI/CD configuration.",
@@ -1072,6 +1115,12 @@ var ConfigCommand = class extends Command {
1072
1115
  this.locker = setup2.locker;
1073
1116
  await this.generate();
1074
1117
  }
1118
+ setup() {
1119
+ throw new Error("The command should be setup first!");
1120
+ }
1121
+ table(...options) {
1122
+ import_core.CliUx.ux.table(...options);
1123
+ }
1075
1124
  async generate() {
1076
1125
  const response = await this.prompt({
1077
1126
  type: "Select",
@@ -1084,12 +1133,12 @@ var ConfigCommand = class extends Command {
1084
1133
  __name(ConfigCommand, "ConfigCommand");
1085
1134
 
1086
1135
  // src/hooks/not-found.hook.ts
1087
- var import_core2 = require("@oclif/core");
1136
+ var import_core3 = require("@oclif/core");
1088
1137
  var notFoundHook = /* @__PURE__ */ __name(async (opts) => {
1089
1138
  const logger = new Logger(opts.config.name);
1090
1139
  logger.fatal("Command not found. Take a look at help. You can also use --[h]elp flag for subcommands.", { custom: opts.config.name });
1091
1140
  logger.direct("");
1092
- const help = new import_core2.Help(opts.config);
1141
+ const help = new import_core3.Help(opts.config);
1093
1142
  await help.showHelp(["--all"]);
1094
1143
  process.exit(127);
1095
1144
  }, "notFoundHook");
@@ -1106,14 +1155,10 @@ var storeHook = /* @__PURE__ */ __name((cb) => async (opts) => {
1106
1155
  }, "storeHook");
1107
1156
 
1108
1157
  // src/interfaces/oclif.interface.ts
1109
- var import_core3 = require("@oclif/core");
1110
-
1111
- // src/index.ts
1112
- var src_default = {
1113
- ux: import_core4.CliUx.ux
1114
- };
1158
+ var import_core4 = require("@oclif/core");
1115
1159
  // Annotate the CommonJS export names for ESM import in node:
1116
1160
  0 && (module.exports = {
1161
+ CliUx,
1117
1162
  Command,
1118
1163
  ConfigCommand,
1119
1164
  ConfigService,
@@ -1122,6 +1167,7 @@ var src_default = {
1122
1167
  Flags,
1123
1168
  HelpGroups,
1124
1169
  JsonParser,
1170
+ ListrLogger,
1125
1171
  LockerService,
1126
1172
  LogFieldStatus,
1127
1173
  LogLevels,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cenk1cenk2/oclif-common",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "description": "Oclif common package for oclif2 projects.",
5
5
  "repository": "https://gitlab.kilic.dev/libraries/oclif-tools",
6
6
  "author": {
@@ -44,7 +44,8 @@
44
44
  "enquirer": ">= 2",
45
45
  "execa": ">= 6",
46
46
  "listr2": ">= 4",
47
- "update-notifier": "^5"
47
+ "update-notifier": "^5",
48
+ "fs-extra": ">= 10"
48
49
  },
49
50
  "peerDependenciesMeta": {
50
51
  "execa": {
@@ -55,10 +56,8 @@
55
56
  }
56
57
  },
57
58
  "dependencies": {
58
- "@types/fs-extra": "^9.0.13",
59
59
  "colorette": "^2.0.19",
60
60
  "deepmerge": "^4.2.2",
61
- "fs-extra": "^10.1.0",
62
61
  "object-path-immutable": "^4.1.2",
63
62
  "reflect-metadata": "^0.1.13",
64
63
  "through": "^2.3.8",
@@ -67,6 +66,8 @@
67
66
  "yaml": "^2.1.1"
68
67
  },
69
68
  "devDependencies": {
69
+ "@types/fs-extra": "^9.0.13",
70
+ "fs-extra": "^10.1.0",
70
71
  "@oclif/core": "^1.16.1",
71
72
  "@types/through": "^0.0.30",
72
73
  "@types/update-notifier": "^5",