@cenk1cenk2/oclif-common 5.0.8 → 6.0.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.
- package/dist/index.d.ts +212 -188
- package/dist/index.js +1168 -714
- package/package.json +22 -18
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,47 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InjectionToken, DynamicModule, INestApplicationContext } from '@nestjs/common';
|
|
2
|
+
export { DynamicModule, Inject } from '@nestjs/common';
|
|
3
|
+
import * as _oclif_core_lib_interfaces from '@oclif/core/lib/interfaces';
|
|
4
|
+
export { Flag, InferredFlags } from '@oclif/core/lib/interfaces';
|
|
5
|
+
import { Manager } from '@listr2/manager';
|
|
6
|
+
import { Config, Command as Command$1, Interfaces, Hook } from '@oclif/core';
|
|
2
7
|
export { Args, Flags, ux } from '@oclif/core';
|
|
3
8
|
import { ExecaChildProcess } from 'execa';
|
|
4
|
-
import { ListrTaskWrapper, splat, ListrContext
|
|
5
|
-
import { Logger
|
|
9
|
+
import { ListrTaskWrapper, splat, ListrContext } from 'listr2';
|
|
10
|
+
import { Logger, LeveledLogMethod } from 'winston';
|
|
11
|
+
import { ModuleRef } from '@nestjs/core';
|
|
6
12
|
import fs from 'fs-extra';
|
|
7
|
-
|
|
13
|
+
import op from 'object-path-immutable';
|
|
8
14
|
import { ClassTransformOptions } from 'class-transformer';
|
|
9
15
|
import { ValidatorOptions } from 'class-validator';
|
|
10
|
-
import { InferredFlags } from '@oclif/core/lib/interfaces';
|
|
11
|
-
export { Flag, InferredFlags } from '@oclif/core/lib/interfaces';
|
|
12
|
-
import { FlagInput } from '@oclif/core/lib/interfaces/parser';
|
|
13
16
|
export { Arg, ArgInput, FlagInput } from '@oclif/core/lib/interfaces/parser';
|
|
14
17
|
|
|
15
18
|
type ClassType<T> = new (...args: any[]) => T;
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
interface GlobalConfig {
|
|
21
|
+
logLevel: LogLevels;
|
|
22
|
+
isJson: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface ConfigIterator {
|
|
25
|
+
key: (string | number)[];
|
|
26
|
+
env: string;
|
|
27
|
+
parser?: string;
|
|
28
|
+
extensions?: ConfigIterator[];
|
|
29
|
+
}
|
|
30
|
+
interface ConfigModuleOptions {
|
|
31
|
+
oclif?: Config;
|
|
32
|
+
command?: typeof Command$1;
|
|
33
|
+
config: GlobalConfig;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare const INSTANCE_LOCKER_SERVICE: InjectionToken;
|
|
37
|
+
|
|
38
|
+
declare class GenericParser {
|
|
39
|
+
static extensions: string[];
|
|
40
|
+
parse<T = unknown>(data: string | Buffer): T | Promise<T>;
|
|
41
|
+
stringify<T = any>(data: T): string | Promise<string>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
declare function pipeProcessThroughListr(task: ListrTaskWrapper<any, any, any>, instance: ExecaChildProcess): ExecaChildProcess;
|
|
18
45
|
|
|
19
46
|
declare enum LogLevels {
|
|
20
47
|
SILENT = "SILENT",
|
|
@@ -50,66 +77,140 @@ interface PipeProcessToLoggerOptions {
|
|
|
50
77
|
context?: string;
|
|
51
78
|
}
|
|
52
79
|
|
|
53
|
-
interface LoggerOptions {
|
|
54
|
-
useIcons?: boolean;
|
|
55
|
-
level?: LogLevels;
|
|
56
|
-
}
|
|
57
80
|
interface LoggerFormat {
|
|
58
81
|
level: LogLevels;
|
|
59
82
|
message: string;
|
|
60
83
|
context: string;
|
|
61
84
|
status: string;
|
|
62
85
|
}
|
|
63
|
-
type Winston = Logger
|
|
86
|
+
type Winston = Logger & Record<keyof typeof LogLevels, LeveledLogMethod>;
|
|
87
|
+
|
|
88
|
+
declare class WinstonService {
|
|
89
|
+
private readonly options;
|
|
90
|
+
readonly instance: Winston;
|
|
91
|
+
constructor(options: ConfigModuleOptions);
|
|
92
|
+
private initiateLogger;
|
|
93
|
+
private logColoring;
|
|
94
|
+
}
|
|
64
95
|
|
|
65
96
|
/**
|
|
66
97
|
* A general logger for the the CLI applications.
|
|
67
98
|
*/
|
|
68
|
-
declare class
|
|
69
|
-
private
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
constructor(context?: string, options?: LoggerOptions);
|
|
99
|
+
declare class LoggerService {
|
|
100
|
+
private readonly winston;
|
|
101
|
+
context: string;
|
|
102
|
+
constructor(winston: WinstonService);
|
|
103
|
+
setup(context: string): LoggerService;
|
|
74
104
|
log(level: LogLevels, data: string | Buffer, ...args: any): void;
|
|
75
105
|
direct(data: string | Buffer, ...args: any): void;
|
|
76
106
|
fatal(data: string | Buffer, ...args: any): void;
|
|
77
107
|
error(data: string | Buffer, ...args: any): void;
|
|
78
108
|
warn(data: string | Buffer, ...args: any): void;
|
|
79
109
|
info(data: string | Buffer, ...args: any): void;
|
|
80
|
-
debug(data: string | Buffer, ...args: any): void;
|
|
81
110
|
verbose(data: string | Buffer, ...args: any): void;
|
|
111
|
+
debug(data: string | Buffer, ...args: any): void;
|
|
82
112
|
trace(data: string | Buffer, ...args: any): void;
|
|
83
113
|
run(data: string | Buffer, ...args: any): void;
|
|
84
114
|
end(data: string | Buffer, ...args: any): void;
|
|
85
115
|
stage(data: string | Buffer, ...args: any): void;
|
|
86
116
|
splat(...args: Parameters<typeof splat>): ReturnType<typeof splat>;
|
|
87
|
-
private initiateLogger;
|
|
88
117
|
private parseMessage;
|
|
89
|
-
private logColoring;
|
|
90
118
|
}
|
|
91
119
|
|
|
92
120
|
/**
|
|
93
121
|
* Given the instance it will pipe process output through the logger to append prefixes such as the application name.
|
|
94
122
|
*/
|
|
95
|
-
declare function pipeProcessToLogger(logger:
|
|
123
|
+
declare function pipeProcessToLogger(logger: LoggerService, instance: ExecaChildProcess, options?: PipeProcessToLoggerOptions): ExecaChildProcess;
|
|
96
124
|
|
|
97
|
-
|
|
98
|
-
logLevel: LogLevels;
|
|
99
|
-
ci: boolean;
|
|
100
|
-
json: boolean;
|
|
125
|
+
declare class LoggerModule {
|
|
101
126
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
127
|
+
|
|
128
|
+
declare class EnvironmentVariableParser implements GenericParser {
|
|
129
|
+
private readonly logger;
|
|
130
|
+
static extensions: string[];
|
|
131
|
+
private readonly LINE;
|
|
132
|
+
constructor(logger: LoggerService);
|
|
133
|
+
parse<T = unknown>(data: string | Buffer): T;
|
|
134
|
+
stringify<T = any>(data: T): string;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
declare class JsonParser implements GenericParser {
|
|
138
|
+
private readonly logger;
|
|
139
|
+
static extensions: string[];
|
|
140
|
+
constructor(logger: LoggerService);
|
|
141
|
+
parse<T = unknown>(data: string | Buffer): T;
|
|
142
|
+
stringify<T = any>(data: T): string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
declare class YamlParser implements GenericParser {
|
|
146
|
+
private readonly logger;
|
|
147
|
+
static extensions: string[];
|
|
148
|
+
constructor(logger: LoggerService);
|
|
149
|
+
parse<T = unknown>(data: string | Buffer): T;
|
|
150
|
+
stringify<T = any>(data: T): string;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
declare class ParserModule {
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
declare class FileSystemService {
|
|
157
|
+
private readonly logger;
|
|
158
|
+
readonly fs: typeof fs;
|
|
159
|
+
constructor(logger: LoggerService);
|
|
160
|
+
exists(path: string): boolean;
|
|
161
|
+
stats(path: string): fs.Stats;
|
|
162
|
+
dirname(path: string): string;
|
|
163
|
+
extname(path: string): string;
|
|
164
|
+
read(file: string): Promise<string>;
|
|
165
|
+
readSync(file: string): string;
|
|
166
|
+
write(file: string, data: string | Buffer, options?: fs.WriteFileOptions): Promise<void>;
|
|
167
|
+
writeSync(file: string, data: string | Buffer, options?: fs.WriteFileOptions): void;
|
|
168
|
+
append(file: string, data: string | Buffer, options?: fs.WriteFileOptions): Promise<void>;
|
|
169
|
+
appendSync(file: string, data: string | Buffer): void;
|
|
170
|
+
remove(file: string, options?: fs.RmOptions): Promise<void>;
|
|
171
|
+
removeSync(file: string, options?: fs.RmOptions): void;
|
|
172
|
+
emptyDir(directory: string): Promise<void>;
|
|
173
|
+
emptyDirSync(directory: string): void;
|
|
174
|
+
removeDir(directory: string): Promise<void>;
|
|
175
|
+
removeDirSync(directory: string): void;
|
|
176
|
+
mkdir(directory: string): Promise<void>;
|
|
177
|
+
mkdirSync(directory: string): void;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
declare class FilesystemModule {
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
declare class ParserService {
|
|
184
|
+
private moduleRef;
|
|
185
|
+
private fs;
|
|
186
|
+
private readonly logger;
|
|
187
|
+
parsers: ClassType<GenericParser>[];
|
|
188
|
+
constructor(moduleRef: ModuleRef, fs: FileSystemService, logger: LoggerService);
|
|
189
|
+
getParser(file: string): Promise<GenericParser>;
|
|
190
|
+
setParsers(...parsers: ClassType<GenericParser>[]): void;
|
|
191
|
+
addParsers(...parsers: ClassType<GenericParser>[]): void;
|
|
192
|
+
read<T = unknown>(file: string): Promise<T>;
|
|
193
|
+
write<T = LockableData>(file: string, data: T): Promise<void>;
|
|
194
|
+
parse<T = unknown>(file: string, data: string | Buffer): Promise<T>;
|
|
195
|
+
stringify<T = any>(file: string, data: T): Promise<string>;
|
|
107
196
|
}
|
|
108
197
|
|
|
198
|
+
type SetCtxDefaultsOptions<T extends ListrContext = ListrContext> = Partial<T>;
|
|
199
|
+
interface SetCtxAssignOptions<K = Record<PropertyKey, any>> {
|
|
200
|
+
from: K;
|
|
201
|
+
keys: (keyof K)[];
|
|
202
|
+
}
|
|
203
|
+
declare function setCtxDefaults<T extends ListrContext = ListrContext>(ctx: T, ...defaults: SetCtxDefaultsOptions<T>[]): void;
|
|
204
|
+
declare function setCtxAssign<T extends ListrContext = ListrContext, K = Record<PropertyKey, any>>(ctx: T, ...assigns: SetCtxAssignOptions<K>[]): void;
|
|
205
|
+
|
|
109
206
|
declare function isVerbose(logLevel: LogLevels): boolean;
|
|
110
207
|
declare function isDebug(logLevel: LogLevels): boolean;
|
|
111
208
|
declare function isSilent(logLevel: LogLevels): boolean;
|
|
112
209
|
|
|
210
|
+
declare function isHookedWithShouldRunBefore<T extends Command$1 = Command$1>(command: T): command is T & ShouldRunBeforeHook;
|
|
211
|
+
declare function isHookedWithShouldRunAfter<T extends Command$1 = Command$1>(command: T): command is T & ShouldRunAfterHook<any>;
|
|
212
|
+
declare function isHookedWithRegister<T extends Command$1 = Command$1>(command: T): command is T & RegisterHook;
|
|
213
|
+
|
|
113
214
|
declare enum MergeStrategy {
|
|
114
215
|
OVERWRITE = "OVERWRITE",
|
|
115
216
|
EXTEND = "EXTEND"
|
|
@@ -118,15 +219,7 @@ declare enum MergeStrategy {
|
|
|
118
219
|
/** Merge objects deep from overwriting the properties from source to target.
|
|
119
220
|
* Does not mutate the object */
|
|
120
221
|
declare function merge<T extends Record<PropertyKey, any> | any[]>(strategy: MergeStrategy, ...source: Partial<T>[]): T;
|
|
121
|
-
declare function
|
|
122
|
-
|
|
123
|
-
type SetCtxDefaultsOptions<T extends ListrContext = ListrContext> = Partial<T>;
|
|
124
|
-
interface SetCtxAssignOptions<K = Record<PropertyKey, any>> {
|
|
125
|
-
from: K;
|
|
126
|
-
keys: (keyof K)[];
|
|
127
|
-
}
|
|
128
|
-
declare function setCtxDefaults<T extends ListrContext = ListrContext>(ctx: T, ...defaults: SetCtxDefaultsOptions<T>[]): void;
|
|
129
|
-
declare function setCtxAssign<T extends ListrContext = ListrContext, K = Record<PropertyKey, any>>(ctx: T, ...assigns: SetCtxAssignOptions<K>[]): void;
|
|
222
|
+
declare function uniqueArrayFilter(value: any, index: any, self: string | any[]): boolean;
|
|
130
223
|
|
|
131
224
|
interface CommonLockerData {
|
|
132
225
|
path?: string | string[];
|
|
@@ -141,22 +234,22 @@ interface LockData<T extends LockableData = LockableData> extends Partial<Common
|
|
|
141
234
|
interface UnlockData extends CommonLockerData {
|
|
142
235
|
path: string | string[];
|
|
143
236
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
237
|
+
interface LockerServiceOptions {
|
|
238
|
+
file: string;
|
|
239
|
+
parser: GenericParser;
|
|
240
|
+
root?: string[];
|
|
241
|
+
context?: string;
|
|
242
|
+
token?: InjectionToken;
|
|
149
243
|
}
|
|
150
244
|
|
|
151
245
|
declare class LockerService<LockFile extends LockableData = LockableData> {
|
|
152
|
-
private
|
|
153
|
-
private
|
|
154
|
-
private
|
|
246
|
+
private readonly logger;
|
|
247
|
+
private readonly fs;
|
|
248
|
+
private readonly options;
|
|
249
|
+
readonly op: typeof op;
|
|
155
250
|
private toLock;
|
|
156
251
|
private toUnlock;
|
|
157
|
-
|
|
158
|
-
private fs;
|
|
159
|
-
constructor(file: string, parser?: GenericParser, root?: string[], context?: string);
|
|
252
|
+
constructor(logger: LoggerService, fs: FileSystemService, options: LockerServiceOptions);
|
|
160
253
|
hasLock(): boolean;
|
|
161
254
|
hasUnlock(): boolean;
|
|
162
255
|
addLock<T extends LockableData = LockableData>(...data: LockData<T>[]): void;
|
|
@@ -173,119 +266,63 @@ declare class LockerService<LockFile extends LockableData = LockableData> {
|
|
|
173
266
|
private normalizePath;
|
|
174
267
|
}
|
|
175
268
|
|
|
176
|
-
declare class
|
|
177
|
-
|
|
178
|
-
parsers: ClassType<GenericParser>[];
|
|
179
|
-
private logger;
|
|
180
|
-
private fs;
|
|
181
|
-
constructor(parsers?: ClassType<GenericParser>[]);
|
|
182
|
-
getParser(file: string): GenericParser;
|
|
183
|
-
setParsers(...parsers: ClassType<GenericParser>[]): void;
|
|
184
|
-
addParsers(...parsers: ClassType<GenericParser>[]): void;
|
|
185
|
-
read<T = unknown>(file: string): Promise<T>;
|
|
186
|
-
write<T = LockableData>(file: string, data: T): Promise<void>;
|
|
187
|
-
parse<T = unknown>(file: string, data: string | Buffer): T;
|
|
188
|
-
stringify<T = any>(file: string, data: T): string | Promise<string>;
|
|
269
|
+
declare class LockerModule {
|
|
270
|
+
static forFeature(options: LockerServiceOptions): DynamicModule;
|
|
189
271
|
}
|
|
190
272
|
|
|
191
|
-
declare class ConfigService
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
private static instance;
|
|
273
|
+
declare class ConfigService {
|
|
274
|
+
private readonly parser;
|
|
275
|
+
private readonly logger;
|
|
195
276
|
defaults: string;
|
|
196
277
|
root: string;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
constructor(oclif: Command['config'], command: Command['ctor'], config: GlobalConfig);
|
|
278
|
+
config: GlobalConfig;
|
|
279
|
+
oclif: Config;
|
|
280
|
+
command: typeof Command$1;
|
|
281
|
+
constructor(parser: ParserService, logger: LoggerService, options: ConfigModuleOptions);
|
|
282
|
+
get isVerbose(): boolean;
|
|
283
|
+
get isDebug(): boolean;
|
|
284
|
+
get isSilent(): boolean;
|
|
285
|
+
get isJson(): boolean;
|
|
206
286
|
read<T extends LockableData = LockableData>(path: string): Promise<T>;
|
|
207
287
|
extend<T extends LockableData = LockableData>(paths: (string | Partial<T>)[], strategy?: MergeStrategy): Promise<T>;
|
|
208
288
|
merge<T extends LockableData = LockableData>(configs: Partial<T>[], strategy?: MergeStrategy): T;
|
|
209
289
|
env<T extends LockableData = LockableData>(definition: string | Record<PropertyKey, any>, config: T): Promise<T>;
|
|
210
290
|
write<T extends LockableData = LockableData>(path: string, data: T): Promise<void>;
|
|
211
|
-
private recalculate;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
declare class FileSystemService {
|
|
215
|
-
private static instance;
|
|
216
|
-
private logger;
|
|
217
|
-
constructor();
|
|
218
|
-
exists(path: string): boolean;
|
|
219
|
-
stats(path: string): fs.Stats;
|
|
220
|
-
dirname(path: string): string;
|
|
221
|
-
extname(path: string): string;
|
|
222
|
-
read(file: string): Promise<string>;
|
|
223
|
-
readSync(file: string): string;
|
|
224
|
-
write(file: string, data: string | Buffer, options?: fs.WriteFileOptions): Promise<void>;
|
|
225
|
-
writeSync(file: string, data: string | Buffer, options?: fs.WriteFileOptions): void;
|
|
226
|
-
append(file: string, data: string | Buffer, options?: fs.WriteFileOptions): Promise<void>;
|
|
227
|
-
appendSync(file: string, data: string | Buffer): void;
|
|
228
|
-
remove(file: string, options?: fs.RmOptions): Promise<void>;
|
|
229
|
-
removeSync(file: string, options?: fs.RmOptions): void;
|
|
230
|
-
emptyDir(directory: string): Promise<void>;
|
|
231
|
-
emptyDirSync(directory: string): void;
|
|
232
|
-
removeDir(directory: string): Promise<void>;
|
|
233
|
-
removeDirSync(directory: string): void;
|
|
234
|
-
mkdir(directory: string): Promise<void>;
|
|
235
|
-
mkdirSync(directory: string): void;
|
|
236
291
|
}
|
|
237
292
|
|
|
238
|
-
declare class
|
|
239
|
-
static extensions: string[];
|
|
240
|
-
private static instance;
|
|
241
|
-
private logger;
|
|
242
|
-
private LINE;
|
|
243
|
-
constructor();
|
|
244
|
-
parse<T = unknown>(data: string | Buffer): T;
|
|
245
|
-
stringify<T = any>(data: T): string;
|
|
293
|
+
declare class ConfigModule {
|
|
246
294
|
}
|
|
247
295
|
|
|
248
|
-
declare
|
|
249
|
-
static extensions: string[];
|
|
250
|
-
private static instance;
|
|
251
|
-
private logger;
|
|
252
|
-
constructor();
|
|
253
|
-
parse<T = unknown>(data: string | Buffer): T;
|
|
254
|
-
stringify<T = any>(data: T): string;
|
|
255
|
-
}
|
|
296
|
+
declare const TOKEN_LOGO_GENERATOR: InjectionToken;
|
|
256
297
|
|
|
257
|
-
declare class
|
|
258
|
-
|
|
259
|
-
private
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
298
|
+
declare class LogoService {
|
|
299
|
+
readonly cs: ConfigService;
|
|
300
|
+
private generator;
|
|
301
|
+
constructor(cs: ConfigService, moduleRef: ModuleRef);
|
|
302
|
+
generate(): void;
|
|
303
|
+
shouldBeSilent(): boolean;
|
|
304
|
+
write(...data: string[]): void;
|
|
264
305
|
}
|
|
265
306
|
|
|
266
|
-
type
|
|
267
|
-
logo?: string;
|
|
268
|
-
} & T;
|
|
307
|
+
type LogoGeneratorFn = (this: LogoService) => void;
|
|
269
308
|
|
|
270
|
-
declare class
|
|
271
|
-
private static instance;
|
|
272
|
-
private store;
|
|
273
|
-
constructor();
|
|
274
|
-
has<K extends keyof DataStore<T>>(key: K): boolean;
|
|
275
|
-
get<K extends keyof DataStore<T>>(key: K): DataStore<T>[K];
|
|
276
|
-
set<K extends keyof DataStore<T>>(key: K, data: DataStore<T>[K]): DataStore<T>[K];
|
|
309
|
+
declare class LogoModule {
|
|
277
310
|
}
|
|
278
311
|
|
|
312
|
+
declare const TOKEN_VALIDATOR_SERVICE_OPTIONS: InjectionToken;
|
|
313
|
+
|
|
279
314
|
interface ValidatorServiceOptions {
|
|
280
315
|
validator?: ValidatorOptions;
|
|
281
316
|
transformer?: ClassTransformOptions;
|
|
282
317
|
}
|
|
283
318
|
|
|
319
|
+
declare class ValidatorModule {
|
|
320
|
+
}
|
|
321
|
+
|
|
284
322
|
declare class ValidatorService {
|
|
285
|
-
|
|
286
|
-
private
|
|
287
|
-
|
|
288
|
-
constructor(options?: ValidatorServiceOptions);
|
|
323
|
+
private readonly logger;
|
|
324
|
+
private options;
|
|
325
|
+
constructor(logger: LoggerService, moduleRef: ModuleRef);
|
|
289
326
|
validate<T extends Record<PropertyKey, any>>(classType: ClassType<T>, object: T, options?: ValidatorServiceOptions): Promise<T>;
|
|
290
327
|
validateSync<T extends Record<PropertyKey, any>>(classType: ClassType<T>, object: T, options?: ValidatorServiceOptions): T;
|
|
291
328
|
private logValidationError;
|
|
@@ -293,14 +330,28 @@ declare class ValidatorService {
|
|
|
293
330
|
|
|
294
331
|
declare function setup(): void;
|
|
295
332
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
choices: ConfigCommandChoices<T>;
|
|
299
|
-
locker?: LockerService<LockFile>;
|
|
333
|
+
interface CliModuleOptions {
|
|
334
|
+
config: ConfigModuleOptions;
|
|
300
335
|
}
|
|
301
336
|
|
|
302
|
-
|
|
303
|
-
|
|
337
|
+
declare class CliModule {
|
|
338
|
+
static forRoot(options: CliModuleOptions): DynamicModule;
|
|
339
|
+
static forMinimum(): DynamicModule;
|
|
340
|
+
static create(cls: DynamicModule): Promise<INestApplicationContext>;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
declare class ShouldRunBeforeHook {
|
|
344
|
+
shouldRunBefore(): void | Promise<void>;
|
|
345
|
+
}
|
|
346
|
+
declare class ShouldRunAfterHook<Ctx> {
|
|
347
|
+
shouldRunAfter(ctx: Ctx): void | Promise<void>;
|
|
348
|
+
}
|
|
349
|
+
declare class RegisterHook {
|
|
350
|
+
register(cli: DynamicModule, options: CliModuleOptions): DynamicModule;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
type InferFlags<T extends typeof Command$1> = Interfaces.InferredFlags<(typeof Command$1)['baseFlags'] & T['flags']>;
|
|
354
|
+
type InferArgs<T extends typeof Command$1> = Interfaces.InferredArgs<T['args']>;
|
|
304
355
|
|
|
305
356
|
/**
|
|
306
357
|
* Makes the object deep partial.
|
|
@@ -309,38 +360,24 @@ type DeepPartial<T> = {
|
|
|
309
360
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
310
361
|
};
|
|
311
362
|
|
|
312
|
-
declare class Command<
|
|
313
|
-
static
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
args: Args;
|
|
325
|
-
/**
|
|
326
|
-
* Construct the class if you dont want to extend init or constructor.
|
|
327
|
-
*/
|
|
328
|
-
shouldRunBefore(): void | Promise<void>;
|
|
329
|
-
/**
|
|
330
|
-
* Deconstruct the class if you dont want to extend finally or catch.
|
|
331
|
-
*/
|
|
332
|
-
shouldRunAfter(_ctx?: Ctx): void | Promise<void>;
|
|
333
|
-
run(): Promise<any>;
|
|
334
|
-
_run<T>(): Promise<T | undefined>;
|
|
335
|
-
exit(code?: number): void;
|
|
363
|
+
declare abstract class Command<T extends typeof Command$1 = typeof Command$1, Ctx extends ListrContext = ListrContext> extends Command$1 {
|
|
364
|
+
static baseFlags: {
|
|
365
|
+
"log-level": _oclif_core_lib_interfaces.OptionFlag<string, _oclif_core_lib_interfaces.CustomOptions>;
|
|
366
|
+
ci: _oclif_core_lib_interfaces.BooleanFlag<boolean>;
|
|
367
|
+
json: _oclif_core_lib_interfaces.BooleanFlag<boolean>;
|
|
368
|
+
};
|
|
369
|
+
logger: LoggerService;
|
|
370
|
+
tasks: Manager<Ctx>;
|
|
371
|
+
app: INestApplicationContext;
|
|
372
|
+
flags: InferFlags<T>;
|
|
373
|
+
args: InferArgs<T>;
|
|
374
|
+
exit(code?: number): never;
|
|
336
375
|
/** Run all tasks from task manager. */
|
|
337
376
|
runTasks<C extends Ctx = Ctx>(): Promise<C>;
|
|
338
|
-
/** Gets prompt from user. */
|
|
339
|
-
prompt<T = any>(options: PromptOptions): Promise<T>;
|
|
340
377
|
protected setCtxDefaults<T extends Ctx = Ctx>(...defaults: SetCtxDefaultsOptions<T>[]): void;
|
|
341
378
|
protected setCtxAssign<K = Record<PropertyKey, any>>(...assigns: SetCtxAssignOptions<K>[]): void;
|
|
342
379
|
protected pipeProcessToLogger(instance: ExecaChildProcess, options?: PipeProcessToLoggerOptions): ExecaChildProcess;
|
|
343
|
-
protected pipeProcessThroughListr(task: ListrTaskWrapper<any, any
|
|
380
|
+
protected pipeProcessThroughListr(instance: ExecaChildProcess, task: ListrTaskWrapper<any, any, any>): ExecaChildProcess;
|
|
344
381
|
/** Initial functions / constructor */
|
|
345
382
|
protected init(): Promise<void>;
|
|
346
383
|
/** Tasks to run before end of the command. */
|
|
@@ -349,24 +386,13 @@ declare class Command<Ctx extends ListrContext = ListrContext, Flags extends Rec
|
|
|
349
386
|
}>;
|
|
350
387
|
/** Catch any error occurred during command. */
|
|
351
388
|
protected catch(e: Error, exit?: number): Promise<void>;
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
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> {
|
|
356
|
-
choices: ConfigCommandChoices<CommandChoices>;
|
|
357
|
-
locker: LockerService<LockFile>;
|
|
358
|
-
run(): Promise<any>;
|
|
359
|
-
setup(): ConfigCommandSetup<CommandChoices, LockFile> | Promise<ConfigCommandSetup<CommandChoices, LockFile>>;
|
|
360
|
-
protected table(...options: Parameters<typeof ux.table>): void;
|
|
361
|
-
protected select(): Promise<CommandChoices>;
|
|
389
|
+
abstract run(): Promise<any>;
|
|
362
390
|
}
|
|
363
391
|
|
|
364
392
|
declare enum FileConstants {
|
|
365
393
|
CONFIG_SERVICE_DEFAULTS_DIR = "config"
|
|
366
394
|
}
|
|
367
395
|
|
|
368
|
-
declare const CLI_FLAGS: FlagInput;
|
|
369
|
-
|
|
370
396
|
declare enum HelpGroups {
|
|
371
397
|
CLI = "CLI"
|
|
372
398
|
}
|
|
@@ -375,6 +401,4 @@ declare const notFoundHook: Hook<'command_not_found'>;
|
|
|
375
401
|
|
|
376
402
|
declare const updateNotifierHook: Hook<'init'>;
|
|
377
403
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
export { CLI_FLAGS, ClassType, Command, CommonLockerData, ConfigCommand, ConfigCommandChoices, ConfigCommandSetup, ConfigIterator, ConfigService, DataStore, DeepPartial, EnvironmentVariableParser, FileConstants, FileSystemService, GenericParser, GlobalConfig, HelpGroups, InferArgs, InferFlags, JsonParser, LockData, LockableData, LockerService, LogFieldStatus, LogLevels, Logger, LoggerFormat, LoggerOptions, MergeStrategy, ParserService, PipeProcessToLoggerOptions, SetCtxAssignOptions, SetCtxDefaultsOptions, StoreService, UnlockData, ValidatorService, ValidatorServiceOptions, Winston, YamlParser, isDebug, isSilent, isVerbose, merge, notFoundHook, pipeProcessThroughListr, pipeProcessToLogger, setCtxAssign, setCtxDefaults, setup, storeHook, uniqueFilter, updateNotifierHook };
|
|
404
|
+
export { ClassType, CliModule, CliModuleOptions, Command, CommonLockerData, ConfigIterator, ConfigModule, ConfigModuleOptions, ConfigService, DeepPartial, EnvironmentVariableParser, FileConstants, FileSystemService, FilesystemModule, GenericParser, GlobalConfig, HelpGroups, INSTANCE_LOCKER_SERVICE, InferArgs, InferFlags, JsonParser, LockData, LockableData, LockerModule, LockerService, LockerServiceOptions, LogFieldStatus, LogLevels, LoggerFormat, LoggerModule, LoggerService, LogoGeneratorFn, LogoModule, LogoService, MergeStrategy, ParserModule, ParserService, PipeProcessToLoggerOptions, RegisterHook, SetCtxAssignOptions, SetCtxDefaultsOptions, ShouldRunAfterHook, ShouldRunBeforeHook, TOKEN_LOGO_GENERATOR, TOKEN_VALIDATOR_SERVICE_OPTIONS, UnlockData, ValidatorModule, ValidatorService, ValidatorServiceOptions, Winston, WinstonService, YamlParser, isDebug, isHookedWithRegister, isHookedWithShouldRunAfter, isHookedWithShouldRunBefore, isSilent, isVerbose, merge, notFoundHook, pipeProcessThroughListr, pipeProcessToLogger, setCtxAssign, setCtxDefaults, setup, uniqueArrayFilter, updateNotifierHook };
|