@cenk1cenk2/oclif-common 3.4.3 → 3.5.1
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.d.ts +1 -1
- package/dist/hooks/index.js +29 -3
- package/dist/hooks/not-found.hook.js +1 -2
- package/dist/hooks/store.hook.d.ts +1 -1
- package/dist/hooks/store.hook.js +29 -3
- package/dist/index.d.ts +15 -17
- package/dist/index.js +56 -38
- package/dist/{store.hook-06894aa2.d.ts → store.hook-d02c3547.d.ts} +1 -1
- package/package.json +1 -1
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -66,7 +66,7 @@ var Logger = class {
|
|
|
66
66
|
constructor(context, options) {
|
|
67
67
|
this.context = context;
|
|
68
68
|
this.options = options;
|
|
69
|
-
const parsed = process.env.LOG_LEVEL ?? options?.level ?? "INFO" /* INFO
|
|
69
|
+
const parsed = (process.env.LOG_LEVEL ?? options?.level ?? "INFO" /* INFO */).toUpperCase();
|
|
70
70
|
const level = Object.values(LogLevels).includes(parsed) ? parsed : "INFO" /* INFO */;
|
|
71
71
|
this.options = {
|
|
72
72
|
useIcons: true,
|
|
@@ -74,7 +74,6 @@ var Logger = class {
|
|
|
74
74
|
level
|
|
75
75
|
};
|
|
76
76
|
if (Logger.instance) {
|
|
77
|
-
Logger.instance.level = level;
|
|
78
77
|
this.logger = Logger.instance;
|
|
79
78
|
} else {
|
|
80
79
|
this.logger = this.initiateLogger();
|
|
@@ -241,6 +240,33 @@ var updateNotifierHook = /* @__PURE__ */ __name(async (opts) => {
|
|
|
241
240
|
var import_object_path_immutable = __toESM(require("object-path-immutable"));
|
|
242
241
|
var import_path2 = require("path");
|
|
243
242
|
|
|
243
|
+
// src/interfaces/oclif.interface.ts
|
|
244
|
+
var import_core2 = require("@oclif/core");
|
|
245
|
+
|
|
246
|
+
// src/constants/global-flags.constants.ts
|
|
247
|
+
var CLI_FLAGS = {
|
|
248
|
+
["log-level"]: import_core2.Flags.enum({
|
|
249
|
+
default: "INFO" /* INFO */,
|
|
250
|
+
env: "LOG_LEVEL",
|
|
251
|
+
description: "Set the log level of the application.",
|
|
252
|
+
options: [...Object.values(LogLevels), ...Object.values(LogLevels).map((level) => level.toLowerCase())],
|
|
253
|
+
helpGroup: "CLI" /* CLI */,
|
|
254
|
+
parse: async (input) => input?.toUpperCase()
|
|
255
|
+
}),
|
|
256
|
+
ci: import_core2.Flags.boolean({
|
|
257
|
+
default: false,
|
|
258
|
+
env: "CI",
|
|
259
|
+
description: "Instruct whether this is running the CI/CD configuration.",
|
|
260
|
+
helpGroup: "CLI" /* CLI */
|
|
261
|
+
}),
|
|
262
|
+
json: import_core2.Flags.boolean({
|
|
263
|
+
default: false,
|
|
264
|
+
env: "JSON",
|
|
265
|
+
description: "Put the CLI to respond in JSON.",
|
|
266
|
+
helpGroup: "CLI" /* CLI */
|
|
267
|
+
})
|
|
268
|
+
};
|
|
269
|
+
|
|
244
270
|
// src/lib/parser/json-parser.service.ts
|
|
245
271
|
var _JsonParser = class {
|
|
246
272
|
constructor() {
|
|
@@ -304,7 +330,7 @@ var import_path = require("path");
|
|
|
304
330
|
var import_deepmerge = __toESM(require("deepmerge"));
|
|
305
331
|
|
|
306
332
|
// src/utils/index.ts
|
|
307
|
-
var
|
|
333
|
+
var import_core3 = require("@oclif/core");
|
|
308
334
|
|
|
309
335
|
// src/lib/locker/locker.service.ts
|
|
310
336
|
var import_object_path_immutable2 = __toESM(require("object-path-immutable"));
|
|
@@ -62,7 +62,7 @@ var Logger = class {
|
|
|
62
62
|
constructor(context, options) {
|
|
63
63
|
this.context = context;
|
|
64
64
|
this.options = options;
|
|
65
|
-
const parsed = process.env.LOG_LEVEL ?? options?.level ?? "INFO" /* INFO
|
|
65
|
+
const parsed = (process.env.LOG_LEVEL ?? options?.level ?? "INFO" /* INFO */).toUpperCase();
|
|
66
66
|
const level = Object.values(LogLevels).includes(parsed) ? parsed : "INFO" /* INFO */;
|
|
67
67
|
this.options = {
|
|
68
68
|
useIcons: true,
|
|
@@ -70,7 +70,6 @@ var Logger = class {
|
|
|
70
70
|
level
|
|
71
71
|
};
|
|
72
72
|
if (Logger.instance) {
|
|
73
|
-
Logger.instance.level = level;
|
|
74
73
|
this.logger = Logger.instance;
|
|
75
74
|
} else {
|
|
76
75
|
this.logger = this.initiateLogger();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '@oclif/core';
|
|
2
|
-
export { s as storeHook } from '../store.hook-
|
|
2
|
+
export { s as storeHook } from '../store.hook-d02c3547.js';
|
package/dist/hooks/store.hook.js
CHANGED
|
@@ -34,6 +34,9 @@ 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/interfaces/oclif.interface.ts
|
|
38
|
+
var import_core = require("@oclif/core");
|
|
39
|
+
|
|
37
40
|
// src/utils/logger/listr-logger.ts
|
|
38
41
|
var import_listr22 = require("listr2");
|
|
39
42
|
|
|
@@ -65,7 +68,7 @@ var Logger = class {
|
|
|
65
68
|
constructor(context, options) {
|
|
66
69
|
this.context = context;
|
|
67
70
|
this.options = options;
|
|
68
|
-
const parsed = process.env.LOG_LEVEL ?? options?.level ?? "INFO" /* INFO
|
|
71
|
+
const parsed = (process.env.LOG_LEVEL ?? options?.level ?? "INFO" /* INFO */).toUpperCase();
|
|
69
72
|
const level = Object.values(LogLevels).includes(parsed) ? parsed : "INFO" /* INFO */;
|
|
70
73
|
this.options = {
|
|
71
74
|
useIcons: true,
|
|
@@ -73,7 +76,6 @@ var Logger = class {
|
|
|
73
76
|
level
|
|
74
77
|
};
|
|
75
78
|
if (Logger.instance) {
|
|
76
|
-
Logger.instance.level = level;
|
|
77
79
|
this.logger = Logger.instance;
|
|
78
80
|
} else {
|
|
79
81
|
this.logger = this.initiateLogger();
|
|
@@ -220,6 +222,30 @@ var import_through = __toESM(require("through"));
|
|
|
220
222
|
// src/utils/logger/pipe/pipe-process-to-logger.ts
|
|
221
223
|
var import_through2 = __toESM(require("through"));
|
|
222
224
|
|
|
225
|
+
// src/constants/global-flags.constants.ts
|
|
226
|
+
var CLI_FLAGS = {
|
|
227
|
+
["log-level"]: import_core.Flags.enum({
|
|
228
|
+
default: "INFO" /* INFO */,
|
|
229
|
+
env: "LOG_LEVEL",
|
|
230
|
+
description: "Set the log level of the application.",
|
|
231
|
+
options: [...Object.values(LogLevels), ...Object.values(LogLevels).map((level) => level.toLowerCase())],
|
|
232
|
+
helpGroup: "CLI" /* CLI */,
|
|
233
|
+
parse: async (input) => input?.toUpperCase()
|
|
234
|
+
}),
|
|
235
|
+
ci: import_core.Flags.boolean({
|
|
236
|
+
default: false,
|
|
237
|
+
env: "CI",
|
|
238
|
+
description: "Instruct whether this is running the CI/CD configuration.",
|
|
239
|
+
helpGroup: "CLI" /* CLI */
|
|
240
|
+
}),
|
|
241
|
+
json: import_core.Flags.boolean({
|
|
242
|
+
default: false,
|
|
243
|
+
env: "JSON",
|
|
244
|
+
description: "Put the CLI to respond in JSON.",
|
|
245
|
+
helpGroup: "CLI" /* CLI */
|
|
246
|
+
})
|
|
247
|
+
};
|
|
248
|
+
|
|
223
249
|
// src/lib/parser/json-parser.service.ts
|
|
224
250
|
var _JsonParser = class {
|
|
225
251
|
constructor() {
|
|
@@ -283,7 +309,7 @@ var import_path = require("path");
|
|
|
283
309
|
var import_deepmerge = __toESM(require("deepmerge"));
|
|
284
310
|
|
|
285
311
|
// src/utils/index.ts
|
|
286
|
-
var
|
|
312
|
+
var import_core2 = require("@oclif/core");
|
|
287
313
|
|
|
288
314
|
// src/lib/locker/locker.service.ts
|
|
289
315
|
var import_object_path_immutable2 = __toESM(require("object-path-immutable"));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import * as _oclif_core_lib_interfaces from '@oclif/core/lib/interfaces';
|
|
2
|
-
import { InferredFlags, ArgInput } from '@oclif/core/lib/interfaces';
|
|
3
|
-
export { Arg, ArgInput, Flag, FlagInput, InferredFlags } from '@oclif/core/lib/interfaces';
|
|
4
1
|
import { Command as Command$1, CliUx } from '@oclif/core';
|
|
5
2
|
export { CliUx, Flags } from '@oclif/core';
|
|
6
3
|
import { Logger as Logger$2, ListrTaskWrapper, ListrContext, Manager, PromptOptions } from 'listr2';
|
|
7
4
|
import { Logger as Logger$1, LeveledLogMethod } from 'winston';
|
|
8
5
|
import fs from 'fs-extra';
|
|
9
6
|
export { default as fs } from 'fs-extra';
|
|
10
|
-
import { S as StoreService } from './store.hook-
|
|
11
|
-
export { D as DataStore, S as StoreService, s as storeHook } from './store.hook-
|
|
7
|
+
import { S as StoreService } from './store.hook-d02c3547.js';
|
|
8
|
+
export { D as DataStore, S as StoreService, s as storeHook } from './store.hook-d02c3547.js';
|
|
12
9
|
import { ClassTransformOptions } from 'class-transformer';
|
|
13
10
|
import { ValidatorOptions } from 'class-validator';
|
|
11
|
+
import { InferredFlags, FlagInput } from '@oclif/core/lib/interfaces';
|
|
12
|
+
export { Arg, ArgInput, Flag, FlagInput, InferredFlags } from '@oclif/core/lib/interfaces';
|
|
14
13
|
export { notFoundHook } from './hooks/not-found.hook.js';
|
|
15
14
|
export { updateNotifierHook } from './hooks/update-notifier.hook.js';
|
|
16
15
|
import { ExecaChildProcess } from 'execa';
|
|
@@ -52,7 +51,7 @@ declare type Winston = Logger$1 & Record<keyof typeof LogLevels, LeveledLogMetho
|
|
|
52
51
|
declare class Logger {
|
|
53
52
|
private context?;
|
|
54
53
|
private options?;
|
|
55
|
-
static instance
|
|
54
|
+
private static instance;
|
|
56
55
|
private logger;
|
|
57
56
|
constructor(context?: string, options?: LoggerOptions);
|
|
58
57
|
log(level: LogLevels, data: string | Buffer, ...args: any): void;
|
|
@@ -189,7 +188,7 @@ declare class LockerService<LockFile extends LockableData = LockableData> {
|
|
|
189
188
|
}
|
|
190
189
|
|
|
191
190
|
declare class ParserService {
|
|
192
|
-
static instance
|
|
191
|
+
private static instance;
|
|
193
192
|
parsers: ClassType<GenericParser>[];
|
|
194
193
|
private readonly logger;
|
|
195
194
|
private readonly fs;
|
|
@@ -206,7 +205,7 @@ declare class ParserService {
|
|
|
206
205
|
declare class ConfigService implements GlobalConfig {
|
|
207
206
|
oclif: Command['config'];
|
|
208
207
|
command: Command['ctor'];
|
|
209
|
-
static instance
|
|
208
|
+
private static instance;
|
|
210
209
|
defaults: string;
|
|
211
210
|
root: string;
|
|
212
211
|
parser: ParserService;
|
|
@@ -227,7 +226,7 @@ declare class ConfigService implements GlobalConfig {
|
|
|
227
226
|
}
|
|
228
227
|
|
|
229
228
|
declare class FileSystemService {
|
|
230
|
-
static instance
|
|
229
|
+
private static instance;
|
|
231
230
|
private readonly logger;
|
|
232
231
|
constructor();
|
|
233
232
|
exists(path: string): boolean;
|
|
@@ -250,7 +249,7 @@ declare class FileSystemService {
|
|
|
250
249
|
|
|
251
250
|
declare class YamlParser implements GenericParser {
|
|
252
251
|
static extensions: string[];
|
|
253
|
-
static instance
|
|
252
|
+
private static instance;
|
|
254
253
|
private readonly logger;
|
|
255
254
|
constructor();
|
|
256
255
|
parse<T = unknown>(data: string | Buffer): T;
|
|
@@ -259,7 +258,7 @@ declare class YamlParser implements GenericParser {
|
|
|
259
258
|
|
|
260
259
|
declare class JsonParser implements GenericParser {
|
|
261
260
|
static extensions: string[];
|
|
262
|
-
static instance
|
|
261
|
+
private static instance;
|
|
263
262
|
private readonly logger;
|
|
264
263
|
constructor();
|
|
265
264
|
parse<T = unknown>(data: string | Buffer): T;
|
|
@@ -299,11 +298,7 @@ declare type DeepPartial<T> = {
|
|
|
299
298
|
};
|
|
300
299
|
|
|
301
300
|
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 {
|
|
302
|
-
static globalFlags:
|
|
303
|
-
"log-level": _oclif_core_lib_interfaces.OptionFlag<string>;
|
|
304
|
-
ci: _oclif_core_lib_interfaces.BooleanFlag<boolean>;
|
|
305
|
-
};
|
|
306
|
-
static args: ArgInput;
|
|
301
|
+
static globalFlags: FlagInput;
|
|
307
302
|
logger: Logger;
|
|
308
303
|
tasks: Manager<Ctx, 'default' | 'verbose' | 'silent' | 'simple'>;
|
|
309
304
|
validator: ValidatorService;
|
|
@@ -341,6 +336,7 @@ declare class Command<Ctx extends ListrContext = ListrContext, Flags extends Rec
|
|
|
341
336
|
}
|
|
342
337
|
|
|
343
338
|
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> {
|
|
339
|
+
static globalFlags: FlagInput;
|
|
344
340
|
choices: ConfigCommandChoices<CommandChoices>;
|
|
345
341
|
locker: LockerService<LockFile>;
|
|
346
342
|
run(): Promise<void>;
|
|
@@ -353,8 +349,10 @@ declare enum FileConstants {
|
|
|
353
349
|
CONFIG_SERVICE_DEFAULTS_DIR = "config"
|
|
354
350
|
}
|
|
355
351
|
|
|
352
|
+
declare const CLI_FLAGS: FlagInput;
|
|
353
|
+
|
|
356
354
|
declare enum HelpGroups {
|
|
357
355
|
CLI = "CLI"
|
|
358
356
|
}
|
|
359
357
|
|
|
360
|
-
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 };
|
|
358
|
+
export { CLI_FLAGS, 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,13 +26,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
26
26
|
// src/index.ts
|
|
27
27
|
var src_exports = {};
|
|
28
28
|
__export(src_exports, {
|
|
29
|
-
|
|
29
|
+
CLI_FLAGS: () => CLI_FLAGS,
|
|
30
|
+
CliUx: () => import_core2.CliUx,
|
|
30
31
|
Command: () => Command,
|
|
31
32
|
ConfigCommand: () => ConfigCommand,
|
|
32
33
|
ConfigService: () => ConfigService,
|
|
33
34
|
FileConstants: () => FileConstants,
|
|
34
35
|
FileSystemService: () => FileSystemService,
|
|
35
|
-
Flags: () =>
|
|
36
|
+
Flags: () => import_core.Flags,
|
|
36
37
|
HelpGroups: () => HelpGroups,
|
|
37
38
|
JsonParser: () => JsonParser,
|
|
38
39
|
ListrLogger: () => ListrLogger,
|
|
@@ -63,7 +64,7 @@ __export(src_exports, {
|
|
|
63
64
|
module.exports = __toCommonJS(src_exports);
|
|
64
65
|
|
|
65
66
|
// src/commands/base.command.ts
|
|
66
|
-
var
|
|
67
|
+
var import_core3 = require("@oclif/core");
|
|
67
68
|
var import_listr23 = require("listr2");
|
|
68
69
|
var import_readline = require("readline");
|
|
69
70
|
var import_reflect_metadata = require("reflect-metadata");
|
|
@@ -80,9 +81,8 @@ var HelpGroups = /* @__PURE__ */ ((HelpGroups2) => {
|
|
|
80
81
|
return HelpGroups2;
|
|
81
82
|
})(HelpGroups || {});
|
|
82
83
|
|
|
83
|
-
// src/
|
|
84
|
-
var
|
|
85
|
-
var import_path2 = require("path");
|
|
84
|
+
// src/interfaces/oclif.interface.ts
|
|
85
|
+
var import_core = require("@oclif/core");
|
|
86
86
|
|
|
87
87
|
// src/utils/logger/listr-logger.ts
|
|
88
88
|
var import_listr22 = require("listr2");
|
|
@@ -120,7 +120,7 @@ var Logger = class {
|
|
|
120
120
|
constructor(context, options) {
|
|
121
121
|
this.context = context;
|
|
122
122
|
this.options = options;
|
|
123
|
-
const parsed = process.env.LOG_LEVEL ?? options?.level ?? "INFO" /* INFO
|
|
123
|
+
const parsed = (process.env.LOG_LEVEL ?? options?.level ?? "INFO" /* INFO */).toUpperCase();
|
|
124
124
|
const level = Object.values(LogLevels).includes(parsed) ? parsed : "INFO" /* INFO */;
|
|
125
125
|
this.options = {
|
|
126
126
|
useIcons: true,
|
|
@@ -128,7 +128,6 @@ var Logger = class {
|
|
|
128
128
|
level
|
|
129
129
|
};
|
|
130
130
|
if (Logger.instance) {
|
|
131
|
-
Logger.instance.level = level;
|
|
132
131
|
this.logger = Logger.instance;
|
|
133
132
|
} else {
|
|
134
133
|
this.logger = this.initiateLogger();
|
|
@@ -297,7 +296,7 @@ var ListrLogger = class extends import_listr22.Logger {
|
|
|
297
296
|
this.logger.warn(message, { status: "retry" });
|
|
298
297
|
}
|
|
299
298
|
rollback(message) {
|
|
300
|
-
this.logger.
|
|
299
|
+
this.logger.error(message, { status: "rollback" });
|
|
301
300
|
}
|
|
302
301
|
};
|
|
303
302
|
__name(ListrLogger, "ListrLogger");
|
|
@@ -362,6 +361,34 @@ function pipeProcessToLogger(logger, instance, options) {
|
|
|
362
361
|
}
|
|
363
362
|
__name(pipeProcessToLogger, "pipeProcessToLogger");
|
|
364
363
|
|
|
364
|
+
// src/constants/global-flags.constants.ts
|
|
365
|
+
var CLI_FLAGS = {
|
|
366
|
+
["log-level"]: import_core.Flags.enum({
|
|
367
|
+
default: "INFO" /* INFO */,
|
|
368
|
+
env: "LOG_LEVEL",
|
|
369
|
+
description: "Set the log level of the application.",
|
|
370
|
+
options: [...Object.values(LogLevels), ...Object.values(LogLevels).map((level) => level.toLowerCase())],
|
|
371
|
+
helpGroup: "CLI" /* CLI */,
|
|
372
|
+
parse: async (input) => input?.toUpperCase()
|
|
373
|
+
}),
|
|
374
|
+
ci: import_core.Flags.boolean({
|
|
375
|
+
default: false,
|
|
376
|
+
env: "CI",
|
|
377
|
+
description: "Instruct whether this is running the CI/CD configuration.",
|
|
378
|
+
helpGroup: "CLI" /* CLI */
|
|
379
|
+
}),
|
|
380
|
+
json: import_core.Flags.boolean({
|
|
381
|
+
default: false,
|
|
382
|
+
env: "JSON",
|
|
383
|
+
description: "Put the CLI to respond in JSON.",
|
|
384
|
+
helpGroup: "CLI" /* CLI */
|
|
385
|
+
})
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
// src/lib/config/config.service.ts
|
|
389
|
+
var import_object_path_immutable = __toESM(require("object-path-immutable"));
|
|
390
|
+
var import_path2 = require("path");
|
|
391
|
+
|
|
365
392
|
// src/lib/parser/json-parser.service.ts
|
|
366
393
|
var _JsonParser = class {
|
|
367
394
|
constructor() {
|
|
@@ -613,7 +640,9 @@ __name(merge, "merge");
|
|
|
613
640
|
// src/utils/defaults.ts
|
|
614
641
|
function setCtxDefaults(ctx, ...defaults) {
|
|
615
642
|
defaults?.forEach((i) => {
|
|
616
|
-
|
|
643
|
+
if (typeof i === "object" && !Array.isArray(i)) {
|
|
644
|
+
Object.assign(ctx, i);
|
|
645
|
+
}
|
|
617
646
|
});
|
|
618
647
|
}
|
|
619
648
|
__name(setCtxDefaults, "setCtxDefaults");
|
|
@@ -629,7 +658,7 @@ function setCtxAssign(ctx, ...assigns) {
|
|
|
629
658
|
__name(setCtxAssign, "setCtxAssign");
|
|
630
659
|
|
|
631
660
|
// src/utils/index.ts
|
|
632
|
-
var
|
|
661
|
+
var import_core2 = require("@oclif/core");
|
|
633
662
|
|
|
634
663
|
// src/lib/config/config.service.ts
|
|
635
664
|
var ConfigService = class {
|
|
@@ -993,7 +1022,7 @@ function setup() {
|
|
|
993
1022
|
__name(setup, "setup");
|
|
994
1023
|
|
|
995
1024
|
// src/commands/base.command.ts
|
|
996
|
-
var Command = class extends
|
|
1025
|
+
var Command = class extends import_core3.Command {
|
|
997
1026
|
constructor() {
|
|
998
1027
|
super(...arguments);
|
|
999
1028
|
this.store = new StoreService();
|
|
@@ -1003,7 +1032,7 @@ var Command = class extends import_core2.Command {
|
|
|
1003
1032
|
async init() {
|
|
1004
1033
|
let err;
|
|
1005
1034
|
try {
|
|
1006
|
-
const { flags, args } = await this.parse(
|
|
1035
|
+
const { flags, args } = await this.parse();
|
|
1007
1036
|
this.flags = flags;
|
|
1008
1037
|
this.args = args;
|
|
1009
1038
|
} catch (e) {
|
|
@@ -1020,6 +1049,7 @@ var Command = class extends import_core2.Command {
|
|
|
1020
1049
|
if (err) {
|
|
1021
1050
|
throw err;
|
|
1022
1051
|
}
|
|
1052
|
+
this.logger.trace("init", { status: "stage" });
|
|
1023
1053
|
this.parser = new ParserService();
|
|
1024
1054
|
this.fs = new FileSystemService();
|
|
1025
1055
|
this.validator = new ValidatorService();
|
|
@@ -1046,6 +1076,7 @@ var Command = class extends import_core2.Command {
|
|
|
1046
1076
|
this.logger.fatal("Caught terminate signal.", { context: "exit" });
|
|
1047
1077
|
process.exit(1);
|
|
1048
1078
|
});
|
|
1079
|
+
this.logger.trace("should run before", { status: "stage" });
|
|
1049
1080
|
await this.shouldRunBefore();
|
|
1050
1081
|
}
|
|
1051
1082
|
shouldRunBefore() {
|
|
@@ -1056,7 +1087,9 @@ var Command = class extends import_core2.Command {
|
|
|
1056
1087
|
return;
|
|
1057
1088
|
}
|
|
1058
1089
|
async finally() {
|
|
1090
|
+
this.logger.trace("tasks", { status: "stage" });
|
|
1059
1091
|
const ctx = await this.runTasks();
|
|
1092
|
+
this.logger.trace("should run after", { status: "stage" });
|
|
1060
1093
|
await this.shouldRunAfter(ctx);
|
|
1061
1094
|
return { ctx };
|
|
1062
1095
|
}
|
|
@@ -1082,10 +1115,12 @@ var Command = class extends import_core2.Command {
|
|
|
1082
1115
|
});
|
|
1083
1116
|
}
|
|
1084
1117
|
setCtxDefaults(...defaults) {
|
|
1085
|
-
|
|
1118
|
+
setCtxDefaults(this.tasks.options.ctx, ...defaults);
|
|
1119
|
+
this.logger.trace("updated with defaults: %o", this.tasks.options.ctx, { status: "ctx" });
|
|
1086
1120
|
}
|
|
1087
1121
|
setCtxAssign(...assigns) {
|
|
1088
|
-
|
|
1122
|
+
setCtxAssign(this.tasks.options.ctx, ...assigns);
|
|
1123
|
+
this.logger.trace("updated with assign: %o", this.tasks.options.ctx, { status: "ctx" });
|
|
1089
1124
|
}
|
|
1090
1125
|
greet() {
|
|
1091
1126
|
if (this.cs.isSilent || this.cs.json) {
|
|
@@ -1099,23 +1134,7 @@ var Command = class extends import_core2.Command {
|
|
|
1099
1134
|
}
|
|
1100
1135
|
};
|
|
1101
1136
|
__name(Command, "Command");
|
|
1102
|
-
Command.globalFlags =
|
|
1103
|
-
["log-level"]: import_core2.Flags.enum({
|
|
1104
|
-
default: "INFO" /* INFO */,
|
|
1105
|
-
env: "LOG_LEVEL",
|
|
1106
|
-
description: "Set the log level of the application.",
|
|
1107
|
-
options: [...Object.values(LogLevels), ...Object.values(LogLevels).map((level) => level.toLowerCase())],
|
|
1108
|
-
helpGroup: "CLI" /* CLI */,
|
|
1109
|
-
parse: async (input) => input?.toUpperCase()
|
|
1110
|
-
}),
|
|
1111
|
-
ci: import_core2.Flags.boolean({
|
|
1112
|
-
default: false,
|
|
1113
|
-
env: "CI",
|
|
1114
|
-
description: "Instruct whether this is running the CI/CD configuration.",
|
|
1115
|
-
helpGroup: "CLI" /* CLI */
|
|
1116
|
-
})
|
|
1117
|
-
};
|
|
1118
|
-
Command.args = [];
|
|
1137
|
+
Command.globalFlags = CLI_FLAGS;
|
|
1119
1138
|
|
|
1120
1139
|
// src/commands/config.command.ts
|
|
1121
1140
|
var ConfigCommand = class extends Command {
|
|
@@ -1129,7 +1148,7 @@ var ConfigCommand = class extends Command {
|
|
|
1129
1148
|
throw new Error("The command should be setup first!");
|
|
1130
1149
|
}
|
|
1131
1150
|
table(...options) {
|
|
1132
|
-
|
|
1151
|
+
import_core2.CliUx.ux.table(...options);
|
|
1133
1152
|
}
|
|
1134
1153
|
async generate() {
|
|
1135
1154
|
const response = await this.prompt({
|
|
@@ -1141,14 +1160,15 @@ var ConfigCommand = class extends Command {
|
|
|
1141
1160
|
}
|
|
1142
1161
|
};
|
|
1143
1162
|
__name(ConfigCommand, "ConfigCommand");
|
|
1163
|
+
ConfigCommand.globalFlags = CLI_FLAGS;
|
|
1144
1164
|
|
|
1145
1165
|
// src/hooks/not-found.hook.ts
|
|
1146
|
-
var
|
|
1166
|
+
var import_core4 = require("@oclif/core");
|
|
1147
1167
|
var notFoundHook = /* @__PURE__ */ __name(async (opts) => {
|
|
1148
1168
|
const logger = new Logger(opts.config.name);
|
|
1149
1169
|
logger.fatal("Command not found. Take a look at help. You can also use --[h]elp flag for subcommands.", { custom: opts.config.name });
|
|
1150
1170
|
logger.direct("");
|
|
1151
|
-
const help = new
|
|
1171
|
+
const help = new import_core4.Help(opts.config);
|
|
1152
1172
|
await help.showHelp(["--all"]);
|
|
1153
1173
|
process.exit(127);
|
|
1154
1174
|
}, "notFoundHook");
|
|
@@ -1163,11 +1183,9 @@ var updateNotifierHook = /* @__PURE__ */ __name(async (opts) => {
|
|
|
1163
1183
|
var storeHook = /* @__PURE__ */ __name((cb) => async (opts) => {
|
|
1164
1184
|
cb(opts, new StoreService());
|
|
1165
1185
|
}, "storeHook");
|
|
1166
|
-
|
|
1167
|
-
// src/interfaces/oclif.interface.ts
|
|
1168
|
-
var import_core4 = require("@oclif/core");
|
|
1169
1186
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1170
1187
|
0 && (module.exports = {
|
|
1188
|
+
CLI_FLAGS,
|
|
1171
1189
|
CliUx,
|
|
1172
1190
|
Command,
|
|
1173
1191
|
ConfigCommand,
|
|
@@ -5,7 +5,7 @@ declare type DataStore<T extends Record<PropertyKey, any> = Record<PropertyKey,
|
|
|
5
5
|
} & T;
|
|
6
6
|
|
|
7
7
|
declare class StoreService<T extends Record<PropertyKey, any> = Record<PropertyKey, any>> {
|
|
8
|
-
static instance
|
|
8
|
+
private static instance;
|
|
9
9
|
private store;
|
|
10
10
|
constructor();
|
|
11
11
|
has<K extends keyof DataStore<T>>(key: K): boolean;
|