@h3ravel/console 11.0.0 → 11.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/README.md +13 -1
- package/dist/Commands/Command.cjs +104 -0
- package/dist/Commands/Command.js +7 -0
- package/dist/Commands/MakeCommand.cjs +433 -0
- package/dist/Commands/MakeCommand.js +9 -0
- package/dist/Commands/MigrateCommand.cjs +202 -0
- package/dist/Commands/MigrateCommand.js +8 -0
- package/dist/Commands/ServeCommand.cjs +159 -0
- package/dist/Commands/ServeCommand.js +8 -0
- package/dist/Contracts/ICommand.cjs +18 -0
- package/dist/Contracts/ICommand.js +1 -0
- package/dist/IO/app.cjs +934 -0
- package/dist/IO/app.js +17 -0
- package/dist/IO/providers.cjs +909 -0
- package/dist/IO/providers.js +16 -0
- package/dist/Kernel.cjs +892 -0
- package/dist/Kernel.js +14 -0
- package/dist/Musket.cjs +837 -0
- package/dist/Musket.js +13 -0
- package/dist/Providers/ConsoleServiceProvider.cjs +904 -0
- package/dist/Providers/ConsoleServiceProvider.js +15 -0
- package/dist/Signature.cjs +172 -0
- package/dist/Signature.js +7 -0
- package/dist/Utils.cjs +218 -0
- package/dist/Utils.js +9 -0
- package/dist/chunk-3FVPHQCH.js +151 -0
- package/dist/chunk-FOSDCKCR.js +106 -0
- package/dist/chunk-IGEFNODG.js +22 -0
- package/dist/chunk-KMIFCLXG.js +16 -0
- package/dist/chunk-NADN2PHB.js +0 -0
- package/dist/chunk-O45AB4MX.js +83 -0
- package/dist/chunk-PMV4TMFS.js +151 -0
- package/dist/chunk-POF4JGTX.js +186 -0
- package/dist/chunk-SHUYVCID.js +6 -0
- package/dist/chunk-SP4JKAUC.js +63 -0
- package/dist/chunk-TN5SV7LF.js +133 -0
- package/dist/chunk-UCOXL3OM.js +0 -0
- package/dist/chunk-URLTFJET.js +68 -0
- package/dist/chunk-XSL373TG.js +36 -0
- package/dist/index.cjs +889 -3
- package/dist/index.d.cts +306 -2
- package/dist/index.d.ts +306 -2
- package/dist/index.js +43 -15
- package/dist/run.cjs +1 -0
- package/dist/run.js +1 -0
- package/package.json +21 -4
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,249 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as commander from 'commander';
|
|
2
|
+
import { Argument, program } from 'commander';
|
|
3
|
+
import { Application, ServiceProvider } from '@h3ravel/core';
|
|
4
|
+
import { XGeneric } from '@h3ravel/support';
|
|
5
|
+
|
|
6
|
+
declare class Kernel {
|
|
7
|
+
app: Application;
|
|
8
|
+
cwd: string;
|
|
9
|
+
output: {
|
|
10
|
+
success: (msg: any, exit?: boolean) => void;
|
|
11
|
+
info: (msg: any, exit?: boolean) => void;
|
|
12
|
+
error: (msg: string | string[] | (Error & {
|
|
13
|
+
detail?: string;
|
|
14
|
+
}), exit?: boolean) => void;
|
|
15
|
+
split: (name: string, value: string, status?: "success" | "info" | "error", exit?: boolean) => void;
|
|
16
|
+
quiet: () => never;
|
|
17
|
+
};
|
|
18
|
+
basePath: string;
|
|
19
|
+
modulePath: string;
|
|
20
|
+
consolePath: string;
|
|
21
|
+
modulePackage: XGeneric<{
|
|
22
|
+
version: string;
|
|
23
|
+
}>;
|
|
24
|
+
consolePackage: XGeneric<{
|
|
25
|
+
version: string;
|
|
26
|
+
}>;
|
|
27
|
+
constructor(app: Application, basePath?: string);
|
|
28
|
+
static init(app: Application): void;
|
|
29
|
+
private run;
|
|
30
|
+
ensureDirectoryExists(dir: string): Promise<void>;
|
|
31
|
+
private loadRequirements;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare class Command {
|
|
35
|
+
protected app: Application;
|
|
36
|
+
protected kernel: Kernel;
|
|
37
|
+
constructor(app: Application, kernel: Kernel);
|
|
38
|
+
/**
|
|
39
|
+
* The name and signature of the console command.
|
|
40
|
+
*
|
|
41
|
+
* @var string
|
|
42
|
+
*/
|
|
43
|
+
protected signature: string;
|
|
44
|
+
/**
|
|
45
|
+
* A dictionary of signatures or what not.
|
|
46
|
+
*
|
|
47
|
+
* @var object
|
|
48
|
+
*/
|
|
49
|
+
protected dictionary: Record<string, any>;
|
|
50
|
+
/**
|
|
51
|
+
* The console command description.
|
|
52
|
+
*
|
|
53
|
+
* @var string
|
|
54
|
+
*/
|
|
55
|
+
protected description?: string;
|
|
56
|
+
/**
|
|
57
|
+
* The console command input.
|
|
58
|
+
*
|
|
59
|
+
* @var object
|
|
60
|
+
*/
|
|
61
|
+
private input;
|
|
62
|
+
/**
|
|
63
|
+
* Execute the console command.
|
|
64
|
+
*/
|
|
65
|
+
handle(..._args: any[]): Promise<void>;
|
|
66
|
+
setApplication(app: Application): void;
|
|
67
|
+
setInput(options: XGeneric, args: string[], regArgs: readonly Argument[], dictionary: Record<string, any>): void;
|
|
68
|
+
getSignature(): string;
|
|
69
|
+
getDescription(): string | undefined;
|
|
70
|
+
option(key: string, def?: any): any;
|
|
71
|
+
options(key?: string): any;
|
|
72
|
+
argument(key: string, def?: any): any;
|
|
73
|
+
arguments(): Record<string, any>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare class MakeCommand extends Command {
|
|
77
|
+
/**
|
|
78
|
+
* The name and signature of the console command.
|
|
79
|
+
*
|
|
80
|
+
* @var string
|
|
81
|
+
*/
|
|
82
|
+
protected signature: string;
|
|
83
|
+
/**
|
|
84
|
+
* The console command description.
|
|
85
|
+
*
|
|
86
|
+
* @var string
|
|
87
|
+
*/
|
|
88
|
+
protected description: string;
|
|
89
|
+
handle(): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Generate a new controller class.
|
|
92
|
+
*/
|
|
93
|
+
protected makeController(): Promise<void>;
|
|
94
|
+
protected makeResource(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Generate a new database migration class
|
|
97
|
+
*/
|
|
98
|
+
protected makeMigration(): Promise<void>;
|
|
99
|
+
protected makeFactory(): void;
|
|
100
|
+
protected makeSeeder(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Generate a new Arquebus model class
|
|
103
|
+
*/
|
|
104
|
+
protected makeModel(): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Ge the database migration file name
|
|
107
|
+
*
|
|
108
|
+
* @param table
|
|
109
|
+
* @param create
|
|
110
|
+
* @param type
|
|
111
|
+
* @returns
|
|
112
|
+
*/
|
|
113
|
+
getMigrationStubName(table?: string, create?: boolean, type?: 'ts' | 'js'): string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare class MigrateCommand extends Command {
|
|
117
|
+
/**
|
|
118
|
+
* The name and signature of the console command.
|
|
119
|
+
*
|
|
120
|
+
* @var string
|
|
121
|
+
*/
|
|
122
|
+
protected signature: string;
|
|
123
|
+
/**
|
|
124
|
+
* The console command description.
|
|
125
|
+
*
|
|
126
|
+
* @var string
|
|
127
|
+
*/
|
|
128
|
+
protected description: string;
|
|
129
|
+
/**
|
|
130
|
+
* Execute the console command.
|
|
131
|
+
*/
|
|
132
|
+
handle(): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Run all pending migrations.
|
|
135
|
+
*/
|
|
136
|
+
protected migrateRun(): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Drop all tables and re-run all migrations.
|
|
139
|
+
*/
|
|
140
|
+
protected migrateFresh(): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Create the migration repository.
|
|
143
|
+
*/
|
|
144
|
+
protected migrateInstall(): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Reset and re-run all migrations.
|
|
147
|
+
*/
|
|
148
|
+
protected migrateRefresh(): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Rollback all database migrations.
|
|
151
|
+
*/
|
|
152
|
+
protected migrateReset(): Promise<void>;
|
|
153
|
+
/**
|
|
154
|
+
* Rollback the last database migration.
|
|
155
|
+
*/
|
|
156
|
+
protected migrateRollback(): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Show the status of each migration.
|
|
159
|
+
*/
|
|
160
|
+
protected migrateStatus(): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Publish any migration files from installed packages.
|
|
163
|
+
*/
|
|
164
|
+
protected migratePublish(): Promise<void>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
declare class ServeCommand extends Command {
|
|
168
|
+
/**
|
|
169
|
+
* The name and signature of the console command.
|
|
170
|
+
*
|
|
171
|
+
* @var string
|
|
172
|
+
*/
|
|
173
|
+
protected signature: string;
|
|
174
|
+
/**
|
|
175
|
+
* The console command description.
|
|
176
|
+
*
|
|
177
|
+
* @var string
|
|
178
|
+
*/
|
|
179
|
+
protected description: string;
|
|
180
|
+
handle(): Promise<void>;
|
|
181
|
+
protected serve(): Promise<void>;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
type CommandOption = {
|
|
185
|
+
name: string;
|
|
186
|
+
required?: boolean;
|
|
187
|
+
multiple?: boolean;
|
|
188
|
+
defaultValue?: string | number | boolean | undefined | string[];
|
|
189
|
+
shared?: boolean;
|
|
190
|
+
description?: string;
|
|
191
|
+
/**
|
|
192
|
+
* for options like --Q|queue
|
|
193
|
+
*/
|
|
194
|
+
flags?: string[];
|
|
195
|
+
/**
|
|
196
|
+
* true if it's a flag option
|
|
197
|
+
*/
|
|
198
|
+
isFlag?: boolean;
|
|
199
|
+
/**
|
|
200
|
+
* true if name begins with '#' or '^'
|
|
201
|
+
*/
|
|
202
|
+
isHidden?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* for nested options
|
|
205
|
+
*/
|
|
206
|
+
nestedOptions?: CommandOption[];
|
|
207
|
+
};
|
|
208
|
+
type ParsedCommand = {
|
|
209
|
+
commandClass: Command;
|
|
210
|
+
baseCommand: string;
|
|
211
|
+
description?: string;
|
|
212
|
+
/**
|
|
213
|
+
* true if baseCommand begins with '#' or '^'
|
|
214
|
+
*/
|
|
215
|
+
isHidden?: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* true if baseCommand ends with ':'
|
|
218
|
+
*/
|
|
219
|
+
isNamespaceCommand: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* for colon-ended commands
|
|
222
|
+
*/
|
|
223
|
+
subCommands?: CommandOption[];
|
|
224
|
+
/**
|
|
225
|
+
* for normal commands
|
|
226
|
+
*/
|
|
227
|
+
options?: CommandOption[];
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Musket is H3ravel's CLI tool
|
|
232
|
+
*/
|
|
233
|
+
declare class Musket {
|
|
234
|
+
private app;
|
|
235
|
+
private kernel;
|
|
236
|
+
private output;
|
|
237
|
+
private commands;
|
|
238
|
+
constructor(app: Application, kernel: Kernel);
|
|
239
|
+
build(): Promise<commander.Command>;
|
|
240
|
+
private loadBaseCommands;
|
|
241
|
+
private loadDiscoveredCommands;
|
|
242
|
+
addCommand(command: Command): void;
|
|
243
|
+
private initialize;
|
|
244
|
+
makeOption(opt: CommandOption, cmd: typeof program, parse?: boolean, parent?: any): void;
|
|
245
|
+
static parse(kernel: Kernel): Promise<commander.Command>;
|
|
246
|
+
}
|
|
2
247
|
|
|
3
248
|
/**
|
|
4
249
|
* Handles CLI commands and tooling.
|
|
@@ -14,4 +259,63 @@ declare class ConsoleServiceProvider extends ServiceProvider {
|
|
|
14
259
|
register(): void;
|
|
15
260
|
}
|
|
16
261
|
|
|
17
|
-
|
|
262
|
+
declare class Signature {
|
|
263
|
+
/**
|
|
264
|
+
* Helper to parse options inside a block of text
|
|
265
|
+
*
|
|
266
|
+
* @param block
|
|
267
|
+
* @returns
|
|
268
|
+
*/
|
|
269
|
+
static parseOptions(block: string): CommandOption[];
|
|
270
|
+
/**
|
|
271
|
+
* Helper to parse a command's signature
|
|
272
|
+
*
|
|
273
|
+
* @param signature
|
|
274
|
+
* @param commandClass
|
|
275
|
+
* @returns
|
|
276
|
+
*/
|
|
277
|
+
static parseSignature(signature: string, commandClass: Command): ParsedCommand;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
declare class Utils {
|
|
281
|
+
/**
|
|
282
|
+
* Wraps text with chalk
|
|
283
|
+
*
|
|
284
|
+
* @param txt
|
|
285
|
+
* @param color
|
|
286
|
+
* @returns
|
|
287
|
+
*/
|
|
288
|
+
static textFormat(txt: any, color: (txt: string) => string): string;
|
|
289
|
+
/**
|
|
290
|
+
* Ouput formater object
|
|
291
|
+
*
|
|
292
|
+
* @returns
|
|
293
|
+
*/
|
|
294
|
+
static output(): {
|
|
295
|
+
success: (msg: any, exit?: boolean) => void;
|
|
296
|
+
info: (msg: any, exit?: boolean) => void;
|
|
297
|
+
error: (msg: string | string[] | (Error & {
|
|
298
|
+
detail?: string;
|
|
299
|
+
}), exit?: boolean) => void;
|
|
300
|
+
split: (name: string, value: string, status?: "success" | "info" | "error", exit?: boolean) => void;
|
|
301
|
+
quiet: () => never;
|
|
302
|
+
};
|
|
303
|
+
static findModulePkg(moduleId: string, cwd?: string): string | undefined;
|
|
304
|
+
static getMigrationPaths(cwd: string, migrator: any, defaultPath: string, path: string): Promise<any[]>;
|
|
305
|
+
static twoColumnDetail(name: string, value: string): void;
|
|
306
|
+
/**
|
|
307
|
+
* Check if file exists
|
|
308
|
+
*
|
|
309
|
+
* @param path
|
|
310
|
+
* @returns
|
|
311
|
+
*/
|
|
312
|
+
static fileExists(path: string): Promise<boolean>;
|
|
313
|
+
static findUpConfig(cwd: string, name: string, extensions: string[]): string | void;
|
|
314
|
+
}
|
|
315
|
+
declare class TableGuesser {
|
|
316
|
+
static CREATE_PATTERNS: RegExp[];
|
|
317
|
+
static CHANGE_PATTERNS: RegExp[];
|
|
318
|
+
static guess(migration: string): (string | boolean)[];
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export { Command, type CommandOption, ConsoleServiceProvider, Kernel, MakeCommand, MigrateCommand, Musket, type ParsedCommand, ServeCommand, Signature, TableGuesser, Utils };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,249 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as commander from 'commander';
|
|
2
|
+
import { Argument, program } from 'commander';
|
|
3
|
+
import { Application, ServiceProvider } from '@h3ravel/core';
|
|
4
|
+
import { XGeneric } from '@h3ravel/support';
|
|
5
|
+
|
|
6
|
+
declare class Kernel {
|
|
7
|
+
app: Application;
|
|
8
|
+
cwd: string;
|
|
9
|
+
output: {
|
|
10
|
+
success: (msg: any, exit?: boolean) => void;
|
|
11
|
+
info: (msg: any, exit?: boolean) => void;
|
|
12
|
+
error: (msg: string | string[] | (Error & {
|
|
13
|
+
detail?: string;
|
|
14
|
+
}), exit?: boolean) => void;
|
|
15
|
+
split: (name: string, value: string, status?: "success" | "info" | "error", exit?: boolean) => void;
|
|
16
|
+
quiet: () => never;
|
|
17
|
+
};
|
|
18
|
+
basePath: string;
|
|
19
|
+
modulePath: string;
|
|
20
|
+
consolePath: string;
|
|
21
|
+
modulePackage: XGeneric<{
|
|
22
|
+
version: string;
|
|
23
|
+
}>;
|
|
24
|
+
consolePackage: XGeneric<{
|
|
25
|
+
version: string;
|
|
26
|
+
}>;
|
|
27
|
+
constructor(app: Application, basePath?: string);
|
|
28
|
+
static init(app: Application): void;
|
|
29
|
+
private run;
|
|
30
|
+
ensureDirectoryExists(dir: string): Promise<void>;
|
|
31
|
+
private loadRequirements;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare class Command {
|
|
35
|
+
protected app: Application;
|
|
36
|
+
protected kernel: Kernel;
|
|
37
|
+
constructor(app: Application, kernel: Kernel);
|
|
38
|
+
/**
|
|
39
|
+
* The name and signature of the console command.
|
|
40
|
+
*
|
|
41
|
+
* @var string
|
|
42
|
+
*/
|
|
43
|
+
protected signature: string;
|
|
44
|
+
/**
|
|
45
|
+
* A dictionary of signatures or what not.
|
|
46
|
+
*
|
|
47
|
+
* @var object
|
|
48
|
+
*/
|
|
49
|
+
protected dictionary: Record<string, any>;
|
|
50
|
+
/**
|
|
51
|
+
* The console command description.
|
|
52
|
+
*
|
|
53
|
+
* @var string
|
|
54
|
+
*/
|
|
55
|
+
protected description?: string;
|
|
56
|
+
/**
|
|
57
|
+
* The console command input.
|
|
58
|
+
*
|
|
59
|
+
* @var object
|
|
60
|
+
*/
|
|
61
|
+
private input;
|
|
62
|
+
/**
|
|
63
|
+
* Execute the console command.
|
|
64
|
+
*/
|
|
65
|
+
handle(..._args: any[]): Promise<void>;
|
|
66
|
+
setApplication(app: Application): void;
|
|
67
|
+
setInput(options: XGeneric, args: string[], regArgs: readonly Argument[], dictionary: Record<string, any>): void;
|
|
68
|
+
getSignature(): string;
|
|
69
|
+
getDescription(): string | undefined;
|
|
70
|
+
option(key: string, def?: any): any;
|
|
71
|
+
options(key?: string): any;
|
|
72
|
+
argument(key: string, def?: any): any;
|
|
73
|
+
arguments(): Record<string, any>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare class MakeCommand extends Command {
|
|
77
|
+
/**
|
|
78
|
+
* The name and signature of the console command.
|
|
79
|
+
*
|
|
80
|
+
* @var string
|
|
81
|
+
*/
|
|
82
|
+
protected signature: string;
|
|
83
|
+
/**
|
|
84
|
+
* The console command description.
|
|
85
|
+
*
|
|
86
|
+
* @var string
|
|
87
|
+
*/
|
|
88
|
+
protected description: string;
|
|
89
|
+
handle(): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Generate a new controller class.
|
|
92
|
+
*/
|
|
93
|
+
protected makeController(): Promise<void>;
|
|
94
|
+
protected makeResource(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Generate a new database migration class
|
|
97
|
+
*/
|
|
98
|
+
protected makeMigration(): Promise<void>;
|
|
99
|
+
protected makeFactory(): void;
|
|
100
|
+
protected makeSeeder(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Generate a new Arquebus model class
|
|
103
|
+
*/
|
|
104
|
+
protected makeModel(): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Ge the database migration file name
|
|
107
|
+
*
|
|
108
|
+
* @param table
|
|
109
|
+
* @param create
|
|
110
|
+
* @param type
|
|
111
|
+
* @returns
|
|
112
|
+
*/
|
|
113
|
+
getMigrationStubName(table?: string, create?: boolean, type?: 'ts' | 'js'): string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
declare class MigrateCommand extends Command {
|
|
117
|
+
/**
|
|
118
|
+
* The name and signature of the console command.
|
|
119
|
+
*
|
|
120
|
+
* @var string
|
|
121
|
+
*/
|
|
122
|
+
protected signature: string;
|
|
123
|
+
/**
|
|
124
|
+
* The console command description.
|
|
125
|
+
*
|
|
126
|
+
* @var string
|
|
127
|
+
*/
|
|
128
|
+
protected description: string;
|
|
129
|
+
/**
|
|
130
|
+
* Execute the console command.
|
|
131
|
+
*/
|
|
132
|
+
handle(): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Run all pending migrations.
|
|
135
|
+
*/
|
|
136
|
+
protected migrateRun(): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Drop all tables and re-run all migrations.
|
|
139
|
+
*/
|
|
140
|
+
protected migrateFresh(): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Create the migration repository.
|
|
143
|
+
*/
|
|
144
|
+
protected migrateInstall(): Promise<void>;
|
|
145
|
+
/**
|
|
146
|
+
* Reset and re-run all migrations.
|
|
147
|
+
*/
|
|
148
|
+
protected migrateRefresh(): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Rollback all database migrations.
|
|
151
|
+
*/
|
|
152
|
+
protected migrateReset(): Promise<void>;
|
|
153
|
+
/**
|
|
154
|
+
* Rollback the last database migration.
|
|
155
|
+
*/
|
|
156
|
+
protected migrateRollback(): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Show the status of each migration.
|
|
159
|
+
*/
|
|
160
|
+
protected migrateStatus(): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Publish any migration files from installed packages.
|
|
163
|
+
*/
|
|
164
|
+
protected migratePublish(): Promise<void>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
declare class ServeCommand extends Command {
|
|
168
|
+
/**
|
|
169
|
+
* The name and signature of the console command.
|
|
170
|
+
*
|
|
171
|
+
* @var string
|
|
172
|
+
*/
|
|
173
|
+
protected signature: string;
|
|
174
|
+
/**
|
|
175
|
+
* The console command description.
|
|
176
|
+
*
|
|
177
|
+
* @var string
|
|
178
|
+
*/
|
|
179
|
+
protected description: string;
|
|
180
|
+
handle(): Promise<void>;
|
|
181
|
+
protected serve(): Promise<void>;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
type CommandOption = {
|
|
185
|
+
name: string;
|
|
186
|
+
required?: boolean;
|
|
187
|
+
multiple?: boolean;
|
|
188
|
+
defaultValue?: string | number | boolean | undefined | string[];
|
|
189
|
+
shared?: boolean;
|
|
190
|
+
description?: string;
|
|
191
|
+
/**
|
|
192
|
+
* for options like --Q|queue
|
|
193
|
+
*/
|
|
194
|
+
flags?: string[];
|
|
195
|
+
/**
|
|
196
|
+
* true if it's a flag option
|
|
197
|
+
*/
|
|
198
|
+
isFlag?: boolean;
|
|
199
|
+
/**
|
|
200
|
+
* true if name begins with '#' or '^'
|
|
201
|
+
*/
|
|
202
|
+
isHidden?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* for nested options
|
|
205
|
+
*/
|
|
206
|
+
nestedOptions?: CommandOption[];
|
|
207
|
+
};
|
|
208
|
+
type ParsedCommand = {
|
|
209
|
+
commandClass: Command;
|
|
210
|
+
baseCommand: string;
|
|
211
|
+
description?: string;
|
|
212
|
+
/**
|
|
213
|
+
* true if baseCommand begins with '#' or '^'
|
|
214
|
+
*/
|
|
215
|
+
isHidden?: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* true if baseCommand ends with ':'
|
|
218
|
+
*/
|
|
219
|
+
isNamespaceCommand: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* for colon-ended commands
|
|
222
|
+
*/
|
|
223
|
+
subCommands?: CommandOption[];
|
|
224
|
+
/**
|
|
225
|
+
* for normal commands
|
|
226
|
+
*/
|
|
227
|
+
options?: CommandOption[];
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Musket is H3ravel's CLI tool
|
|
232
|
+
*/
|
|
233
|
+
declare class Musket {
|
|
234
|
+
private app;
|
|
235
|
+
private kernel;
|
|
236
|
+
private output;
|
|
237
|
+
private commands;
|
|
238
|
+
constructor(app: Application, kernel: Kernel);
|
|
239
|
+
build(): Promise<commander.Command>;
|
|
240
|
+
private loadBaseCommands;
|
|
241
|
+
private loadDiscoveredCommands;
|
|
242
|
+
addCommand(command: Command): void;
|
|
243
|
+
private initialize;
|
|
244
|
+
makeOption(opt: CommandOption, cmd: typeof program, parse?: boolean, parent?: any): void;
|
|
245
|
+
static parse(kernel: Kernel): Promise<commander.Command>;
|
|
246
|
+
}
|
|
2
247
|
|
|
3
248
|
/**
|
|
4
249
|
* Handles CLI commands and tooling.
|
|
@@ -14,4 +259,63 @@ declare class ConsoleServiceProvider extends ServiceProvider {
|
|
|
14
259
|
register(): void;
|
|
15
260
|
}
|
|
16
261
|
|
|
17
|
-
|
|
262
|
+
declare class Signature {
|
|
263
|
+
/**
|
|
264
|
+
* Helper to parse options inside a block of text
|
|
265
|
+
*
|
|
266
|
+
* @param block
|
|
267
|
+
* @returns
|
|
268
|
+
*/
|
|
269
|
+
static parseOptions(block: string): CommandOption[];
|
|
270
|
+
/**
|
|
271
|
+
* Helper to parse a command's signature
|
|
272
|
+
*
|
|
273
|
+
* @param signature
|
|
274
|
+
* @param commandClass
|
|
275
|
+
* @returns
|
|
276
|
+
*/
|
|
277
|
+
static parseSignature(signature: string, commandClass: Command): ParsedCommand;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
declare class Utils {
|
|
281
|
+
/**
|
|
282
|
+
* Wraps text with chalk
|
|
283
|
+
*
|
|
284
|
+
* @param txt
|
|
285
|
+
* @param color
|
|
286
|
+
* @returns
|
|
287
|
+
*/
|
|
288
|
+
static textFormat(txt: any, color: (txt: string) => string): string;
|
|
289
|
+
/**
|
|
290
|
+
* Ouput formater object
|
|
291
|
+
*
|
|
292
|
+
* @returns
|
|
293
|
+
*/
|
|
294
|
+
static output(): {
|
|
295
|
+
success: (msg: any, exit?: boolean) => void;
|
|
296
|
+
info: (msg: any, exit?: boolean) => void;
|
|
297
|
+
error: (msg: string | string[] | (Error & {
|
|
298
|
+
detail?: string;
|
|
299
|
+
}), exit?: boolean) => void;
|
|
300
|
+
split: (name: string, value: string, status?: "success" | "info" | "error", exit?: boolean) => void;
|
|
301
|
+
quiet: () => never;
|
|
302
|
+
};
|
|
303
|
+
static findModulePkg(moduleId: string, cwd?: string): string | undefined;
|
|
304
|
+
static getMigrationPaths(cwd: string, migrator: any, defaultPath: string, path: string): Promise<any[]>;
|
|
305
|
+
static twoColumnDetail(name: string, value: string): void;
|
|
306
|
+
/**
|
|
307
|
+
* Check if file exists
|
|
308
|
+
*
|
|
309
|
+
* @param path
|
|
310
|
+
* @returns
|
|
311
|
+
*/
|
|
312
|
+
static fileExists(path: string): Promise<boolean>;
|
|
313
|
+
static findUpConfig(cwd: string, name: string, extensions: string[]): string | void;
|
|
314
|
+
}
|
|
315
|
+
declare class TableGuesser {
|
|
316
|
+
static CREATE_PATTERNS: RegExp[];
|
|
317
|
+
static CHANGE_PATTERNS: RegExp[];
|
|
318
|
+
static guess(migration: string): (string | boolean)[];
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export { Command, type CommandOption, ConsoleServiceProvider, Kernel, MakeCommand, MigrateCommand, Musket, type ParsedCommand, ServeCommand, Signature, TableGuesser, Utils };
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { ServiceProvider } from "@h3ravel/core";
|
|
6
|
-
var ConsoleServiceProvider = class extends ServiceProvider {
|
|
7
|
-
static {
|
|
8
|
-
__name(this, "ConsoleServiceProvider");
|
|
9
|
-
}
|
|
10
|
-
static priority = 992;
|
|
11
|
-
register() {
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
1
|
+
import "./chunk-NADN2PHB.js";
|
|
2
|
+
import "./chunk-XSL373TG.js";
|
|
3
|
+
import "./chunk-KMIFCLXG.js";
|
|
4
|
+
import {
|
|
15
5
|
ConsoleServiceProvider
|
|
6
|
+
} from "./chunk-IGEFNODG.js";
|
|
7
|
+
import {
|
|
8
|
+
Kernel
|
|
9
|
+
} from "./chunk-URLTFJET.js";
|
|
10
|
+
import {
|
|
11
|
+
Musket
|
|
12
|
+
} from "./chunk-TN5SV7LF.js";
|
|
13
|
+
import {
|
|
14
|
+
MigrateCommand
|
|
15
|
+
} from "./chunk-FOSDCKCR.js";
|
|
16
|
+
import {
|
|
17
|
+
ServeCommand
|
|
18
|
+
} from "./chunk-SP4JKAUC.js";
|
|
19
|
+
import {
|
|
20
|
+
Signature
|
|
21
|
+
} from "./chunk-3FVPHQCH.js";
|
|
22
|
+
import "./chunk-UCOXL3OM.js";
|
|
23
|
+
import {
|
|
24
|
+
MakeCommand
|
|
25
|
+
} from "./chunk-PMV4TMFS.js";
|
|
26
|
+
import {
|
|
27
|
+
TableGuesser,
|
|
28
|
+
Utils
|
|
29
|
+
} from "./chunk-POF4JGTX.js";
|
|
30
|
+
import {
|
|
31
|
+
Command
|
|
32
|
+
} from "./chunk-O45AB4MX.js";
|
|
33
|
+
import "./chunk-SHUYVCID.js";
|
|
34
|
+
export {
|
|
35
|
+
Command,
|
|
36
|
+
ConsoleServiceProvider,
|
|
37
|
+
Kernel,
|
|
38
|
+
MakeCommand,
|
|
39
|
+
MigrateCommand,
|
|
40
|
+
Musket,
|
|
41
|
+
ServeCommand,
|
|
42
|
+
Signature,
|
|
43
|
+
TableGuesser,
|
|
44
|
+
Utils
|
|
16
45
|
};
|
|
17
|
-
//# sourceMappingURL=index.js.map
|
package/dist/run.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/run.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./chunk-UCOXL3OM.js";
|