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