@cenk1cenk2/oclif-common 3.2.0 → 3.2.2

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/index.d.ts CHANGED
@@ -296,7 +296,7 @@ declare type DeepPartial<T> = {
296
296
  [P in keyof T]?: DeepPartial<T[P]>;
297
297
  };
298
298
 
299
- declare abstract 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 {
299
+ 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 {
300
300
  static globalFlags: {
301
301
  "log-level": _oclif_core_lib_interfaces.OptionFlag<string>;
302
302
  ci: _oclif_core_lib_interfaces.BooleanFlag<boolean>;
@@ -321,22 +321,21 @@ declare abstract class Command<Ctx extends ListrContext = ListrContext, Flags ex
321
321
  * Deconstruct the class if you dont want to extend finally or catch.
322
322
  */
323
323
  shouldRunAfter(_ctx?: Ctx): void | Promise<void>;
324
- /** Run all tasks from task manager. */
325
- runTasks<C extends Ctx = Ctx>(): Promise<C>;
324
+ run(): Promise<void>;
326
325
  /** Tasks to run before end of the command. */
327
326
  finally<C extends Ctx = Ctx>(): Promise<{
328
327
  ctx: C;
329
328
  }>;
330
329
  /** Catch any error occurred during command. */
331
330
  catch(e: Error): Promise<void>;
331
+ exit(code?: number): void;
332
+ /** Run all tasks from task manager. */
333
+ runTasks<C extends Ctx = Ctx>(): Promise<C>;
332
334
  /** Gets prompt from user. */
333
335
  prompt<T = any>(options: PromptOptions): Promise<T>;
334
336
  setCtxDefaults(...defaults: SetCtxDefaultsOptions<Ctx>[]): void;
335
337
  setCtxAssign<K = Record<PropertyKey, any>>(...assigns: SetCtxAssignOptions<K>[]): void;
336
- exit(code?: number): void;
337
338
  private greet;
338
- /** Every command needs to implement run for running the command itself. */
339
- abstract run(): Promise<void>;
340
339
  }
341
340
 
342
341
  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> {
package/dist/index.js CHANGED
@@ -1034,15 +1034,8 @@ var Command = class extends import_core2.Command {
1034
1034
  }
1035
1035
  shouldRunAfter(_ctx) {
1036
1036
  }
1037
- async runTasks() {
1038
- try {
1039
- const ctx = await this.tasks.runAll();
1040
- return ctx;
1041
- } catch (e) {
1042
- this.logger.fatal(e.message);
1043
- this.logger.debug(e.stack, { context: "crash" });
1044
- process.exit(126);
1045
- }
1037
+ run() {
1038
+ return;
1046
1039
  }
1047
1040
  async finally() {
1048
1041
  const ctx = await this.runTasks();
@@ -1052,7 +1045,15 @@ var Command = class extends import_core2.Command {
1052
1045
  catch(e) {
1053
1046
  this.logger.fatal(e.message);
1054
1047
  this.logger.debug(e.stack, { context: "crash" });
1055
- process.exit(127);
1048
+ this.exit(127);
1049
+ return;
1050
+ }
1051
+ exit(code) {
1052
+ this.logger.trace("Exitting with code: %d", code);
1053
+ process.exit(code ?? 0);
1054
+ }
1055
+ runTasks() {
1056
+ return this.tasks.runAll();
1056
1057
  }
1057
1058
  prompt(options) {
1058
1059
  try {
@@ -1073,10 +1074,6 @@ var Command = class extends import_core2.Command {
1073
1074
  setCtxAssign(...assigns) {
1074
1075
  return setCtxAssign(this.tasks.options.ctx, ...assigns);
1075
1076
  }
1076
- exit(code) {
1077
- this.logger.trace("Exitting with code: %d", code);
1078
- process.exit(code ?? 0);
1079
- }
1080
1077
  greet() {
1081
1078
  if (this.cs.isSilent || this.cs.json) {
1082
1079
  return;
@@ -1127,7 +1124,7 @@ var ConfigCommand = class extends Command {
1127
1124
  message: "Please select what to do with the configuration.",
1128
1125
  choices: Object.keys(this.choices)
1129
1126
  });
1130
- return this.choices[response]();
1127
+ return this.choices[response].bind(this)();
1131
1128
  }
1132
1129
  };
1133
1130
  __name(ConfigCommand, "ConfigCommand");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cenk1cenk2/oclif-common",
3
- "version": "3.2.0",
3
+ "version": "3.2.2",
4
4
  "description": "Oclif common package for oclif2 projects.",
5
5
  "repository": "https://gitlab.kilic.dev/libraries/oclif-tools",
6
6
  "author": {