@h3ravel/console 11.0.7 → 11.1.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/bin/fire.cjs +2 -0
- package/bin/fire.js +2 -0
- package/dist/Utils-7OrjoB1C.d.cts +22 -0
- package/dist/Utils-B1kpj9-1.cjs +130 -0
- package/dist/Utils-B1kpj9-1.cjs.map +1 -0
- package/dist/Utils-DAJvoXlr.js +86 -0
- package/dist/Utils-DAJvoXlr.js.map +1 -0
- package/dist/Utils-DxnHOGMz.d.ts +22 -0
- package/dist/Utils.cjs +3 -217
- package/dist/Utils.d.cts +2 -0
- package/dist/Utils.d.ts +2 -0
- package/dist/Utils.js +3 -9
- package/dist/index.cjs +885 -933
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +270 -290
- package/dist/index.d.ts +270 -290
- package/dist/index.js +899 -44
- package/dist/index.js.map +1 -0
- package/package.json +35 -23
- package/bin/chunk-6Z5DP356.js +0 -1
- package/bin/lexer-DQCqS3nf-XQPNMZG6.js +0 -4
- package/bin/run.cjs +0 -26
- package/bin/run.js +0 -26
- package/dist/Commands/Command.cjs +0 -104
- package/dist/Commands/Command.js +0 -7
- package/dist/Commands/MakeCommand.cjs +0 -433
- package/dist/Commands/MakeCommand.js +0 -9
- package/dist/Commands/MigrateCommand.cjs +0 -200
- package/dist/Commands/MigrateCommand.js +0 -8
- package/dist/Commands/ServeCommand.cjs +0 -159
- package/dist/Commands/ServeCommand.js +0 -8
- package/dist/Contracts/ICommand.cjs +0 -18
- package/dist/Contracts/ICommand.js +0 -1
- package/dist/IO/app.cjs +0 -946
- package/dist/IO/app.js +0 -17
- package/dist/IO/providers.cjs +0 -930
- package/dist/IO/providers.js +0 -16
- package/dist/Kernel.cjs +0 -890
- package/dist/Kernel.js +0 -14
- package/dist/Musket.cjs +0 -835
- package/dist/Musket.js +0 -13
- package/dist/Providers/ConsoleServiceProvider.cjs +0 -912
- package/dist/Providers/ConsoleServiceProvider.js +0 -15
- package/dist/Signature.cjs +0 -172
- package/dist/Signature.js +0 -7
- package/dist/chunk-23QH5R54.js +0 -27
- package/dist/chunk-2O2AYFAG.js +0 -63
- package/dist/chunk-3ASEWMRX.js +0 -37
- package/dist/chunk-3FVPHQCH.js +0 -151
- package/dist/chunk-3RX6CLNR.js +0 -32
- package/dist/chunk-3VCNSA6P.js +0 -14
- package/dist/chunk-3WHUADTN.js +0 -6
- package/dist/chunk-6OCHCPBP.js +0 -36
- package/dist/chunk-6OIH6FS4.js +0 -32
- package/dist/chunk-7EWRZPTX.js +0 -63
- package/dist/chunk-7PUQ5ZIN.js +0 -6
- package/dist/chunk-A5AONVOH.js +0 -6
- package/dist/chunk-ADIVRUAJ.js +0 -27
- package/dist/chunk-CCEWV2BR.js +0 -39
- package/dist/chunk-CTQ6DUT2.js +0 -8
- package/dist/chunk-DXQTBFGG.js +0 -31
- package/dist/chunk-E4SSLXFT.js +0 -63
- package/dist/chunk-E5XIGIEX.js +0 -14
- package/dist/chunk-EIOQKTRM.js +0 -104
- package/dist/chunk-FOSDCKCR.js +0 -106
- package/dist/chunk-G4OE26TZ.js +0 -33
- package/dist/chunk-GVGO5OAK.js +0 -8
- package/dist/chunk-GXRCTWKL.js +0 -16
- package/dist/chunk-HVKW7JK4.js +0 -8
- package/dist/chunk-IGEFNODG.js +0 -22
- package/dist/chunk-JXL4VJHZ.js +0 -36
- package/dist/chunk-K3GOQSS3.js +0 -6
- package/dist/chunk-KCJKQP37.js +0 -133
- package/dist/chunk-KMIFCLXG.js +0 -16
- package/dist/chunk-KZA3MC77.js +0 -151
- package/dist/chunk-LLL3V7LB.js +0 -6
- package/dist/chunk-LQ6DL2HS.js +0 -68
- package/dist/chunk-M4ZRDJJ2.js +0 -68
- package/dist/chunk-MAQAT3PU.js +0 -32
- package/dist/chunk-MPXPSSLJ.js +0 -133
- package/dist/chunk-NADN2PHB.js +0 -0
- package/dist/chunk-NFRXMBRP.js +0 -24
- package/dist/chunk-NVPKTRMT.js +0 -7
- package/dist/chunk-O45AB4MX.js +0 -83
- package/dist/chunk-ORPRWIQ2.js +0 -33
- package/dist/chunk-P7M5PEDY.js +0 -18
- package/dist/chunk-PBNCVQZC.js +0 -6
- package/dist/chunk-PMV4TMFS.js +0 -151
- package/dist/chunk-POF4JGTX.js +0 -186
- package/dist/chunk-PYSJMSNM.js +0 -27
- package/dist/chunk-Q3OMG6YH.js +0 -186
- package/dist/chunk-QCNBVSFO.js +0 -68
- package/dist/chunk-QMEO4OUR.js +0 -151
- package/dist/chunk-QSQNELZQ.js +0 -83
- package/dist/chunk-RRP7K5LI.js +0 -36
- package/dist/chunk-SHUYVCID.js +0 -6
- package/dist/chunk-SP4JKAUC.js +0 -63
- package/dist/chunk-T6OOKENF.js +0 -6
- package/dist/chunk-TBDROT3I.js +0 -6356
- package/dist/chunk-TH2RWMWA.js +0 -133
- package/dist/chunk-TJZCDDEV.js +0 -36
- package/dist/chunk-TN5SV7LF.js +0 -133
- package/dist/chunk-U6TOLKGJ.js +0 -22
- package/dist/chunk-UCOXL3OM.js +0 -0
- package/dist/chunk-URLTFJET.js +0 -68
- package/dist/chunk-UWCTG2LX.js +0 -24
- package/dist/chunk-WO2BXMBQ.js +0 -6
- package/dist/chunk-XAWZUZVP.js +0 -32
- package/dist/chunk-XCOSZXAE.js +0 -133
- package/dist/chunk-XD2Q7LWE.js +0 -24
- package/dist/chunk-XSL373TG.js +0 -36
- package/dist/chunk-XUYTJO6X.js +0 -104
- package/dist/chunk-YAYU7VOK.js +0 -8
- package/dist/chunk-YRUCICBV.js +0 -24
- package/dist/chunk-Z5XE72Q5.js +0 -68
- package/dist/chunk-ZTIO25VB.js +0 -8
- package/dist/lexer-DQCqS3nf-6W2BHF4T.js +0 -68
- package/dist/run.cjs +0 -943
- package/dist/run.js +0 -14
package/dist/chunk-KZA3MC77.js
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TableGuesser,
|
|
3
|
-
Utils
|
|
4
|
-
} from "./chunk-Q3OMG6YH.js";
|
|
5
|
-
import {
|
|
6
|
-
Command
|
|
7
|
-
} from "./chunk-QSQNELZQ.js";
|
|
8
|
-
import {
|
|
9
|
-
__name
|
|
10
|
-
} from "./chunk-CCEWV2BR.js";
|
|
11
|
-
|
|
12
|
-
// src/Commands/MakeCommand.ts
|
|
13
|
-
import { readFile, writeFile } from "fs/promises";
|
|
14
|
-
import chalk from "chalk";
|
|
15
|
-
import dayjs from "dayjs";
|
|
16
|
-
import { existsSync } from "fs";
|
|
17
|
-
import nodepath from "path";
|
|
18
|
-
var MakeCommand = class extends Command {
|
|
19
|
-
static {
|
|
20
|
-
__name(this, "MakeCommand");
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* The name and signature of the console command.
|
|
24
|
-
*
|
|
25
|
-
* @var string
|
|
26
|
-
*/
|
|
27
|
-
signature = `#make:
|
|
28
|
-
{controller : Generates a new controller class. | {--a|api : Generate an API resource controller} | {--force : Overide existing controller.} }
|
|
29
|
-
{resource : Generates a new API resource class.}
|
|
30
|
-
{migration : Generates a new database migration class. | {--l|type=ts : The file type to generate} | {--t|table : The table to migrate} | {--c|create : The table to be created} }
|
|
31
|
-
{factory : Generates a new database factory class.}
|
|
32
|
-
{seeder : Generates a new database seeder class.}
|
|
33
|
-
{model : Generates a new Arquebus model class. | {--t|type=ts : The file type to generate}}
|
|
34
|
-
{^name : The name of the [name] to generate}
|
|
35
|
-
`;
|
|
36
|
-
/**
|
|
37
|
-
* The console command description.
|
|
38
|
-
*
|
|
39
|
-
* @var string
|
|
40
|
-
*/
|
|
41
|
-
description = "Generate component classes";
|
|
42
|
-
async handle() {
|
|
43
|
-
const command = this.dictionary.baseCommand;
|
|
44
|
-
const methods = {
|
|
45
|
-
controller: "makeController",
|
|
46
|
-
resource: "makeResource",
|
|
47
|
-
migration: "makeMigration",
|
|
48
|
-
factory: "makeFactory",
|
|
49
|
-
seeder: "makeSeeder",
|
|
50
|
-
model: "makeModel"
|
|
51
|
-
};
|
|
52
|
-
try {
|
|
53
|
-
await this?.[methods[command]]();
|
|
54
|
-
} catch (e) {
|
|
55
|
-
this.kernel.output.error(e);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Generate a new controller class.
|
|
60
|
-
*/
|
|
61
|
-
async makeController() {
|
|
62
|
-
const type = this.option("api") ? "-resource" : "";
|
|
63
|
-
const name = this.argument("name");
|
|
64
|
-
const force = this.option("force");
|
|
65
|
-
const path = nodepath.join(app_path("Http/Controllers"), name + ".ts");
|
|
66
|
-
const dbPath = Utils.findModulePkg("@h3ravel/http", this.kernel.cwd) ?? "";
|
|
67
|
-
const stubPath = nodepath.join(dbPath, `dist/stubs/controller${type}.stub`);
|
|
68
|
-
if (!force && existsSync(path)) {
|
|
69
|
-
this.kernel.output.error(`ERORR: ${name} controller already exists`);
|
|
70
|
-
}
|
|
71
|
-
let stub = await readFile(stubPath, "utf-8");
|
|
72
|
-
stub = stub.replace(/{{ name }}/g, name);
|
|
73
|
-
await writeFile(path, stub);
|
|
74
|
-
this.kernel.output.split(`INFO: Controller Created`, chalk.gray(nodepath.basename(path)));
|
|
75
|
-
}
|
|
76
|
-
makeResource() {
|
|
77
|
-
this.kernel.output.success(`Resource support is not yet available`);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Generate a new database migration class
|
|
81
|
-
*/
|
|
82
|
-
async makeMigration() {
|
|
83
|
-
const name = this.argument("name");
|
|
84
|
-
const datePrefix = dayjs().format("YYYY_MM_DD_HHmmss");
|
|
85
|
-
const path = nodepath.join(database_path("migrations"), `${datePrefix}_${name}.ts`);
|
|
86
|
-
const dbPath = Utils.findModulePkg("@h3ravel/database", this.kernel.cwd) ?? "";
|
|
87
|
-
let create = this.option("create", false);
|
|
88
|
-
let table = this.option("table");
|
|
89
|
-
if (!table && typeof create === "string") {
|
|
90
|
-
table = create;
|
|
91
|
-
create = true;
|
|
92
|
-
}
|
|
93
|
-
if (!table) {
|
|
94
|
-
const guessed = TableGuesser.guess(name);
|
|
95
|
-
table = guessed[0];
|
|
96
|
-
create = !!guessed[1];
|
|
97
|
-
}
|
|
98
|
-
const stubPath = nodepath.join(dbPath, this.getMigrationStubName(table, create));
|
|
99
|
-
let stub = await readFile(stubPath, "utf-8");
|
|
100
|
-
if (table !== null) {
|
|
101
|
-
stub = stub.replace(/DummyTable|{{\s*table\s*}}/g, table);
|
|
102
|
-
}
|
|
103
|
-
this.kernel.output.info("INFO: Creating Migration");
|
|
104
|
-
await this.kernel.ensureDirectoryExists(nodepath.dirname(path));
|
|
105
|
-
await writeFile(path, stub);
|
|
106
|
-
this.kernel.output.split(`INFO: Migration Created`, chalk.gray(nodepath.basename(path)));
|
|
107
|
-
}
|
|
108
|
-
makeFactory() {
|
|
109
|
-
this.kernel.output.success(`Factory support is not yet available`);
|
|
110
|
-
}
|
|
111
|
-
makeSeeder() {
|
|
112
|
-
this.kernel.output.success(`Seeder support is not yet available`);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Generate a new Arquebus model class
|
|
116
|
-
*/
|
|
117
|
-
async makeModel() {
|
|
118
|
-
const type = this.option("type", "ts");
|
|
119
|
-
const name = this.argument("name");
|
|
120
|
-
const path = nodepath.join(app_path("Models"), name.toLowerCase() + "." + type);
|
|
121
|
-
const dbPath = Utils.findModulePkg("@h3ravel/database", this.kernel.cwd) ?? "";
|
|
122
|
-
const stubPath = nodepath.join(dbPath, `dist/stubs/model-${type}.stub`);
|
|
123
|
-
let stub = await readFile(stubPath, "utf-8");
|
|
124
|
-
stub = stub.replace(/{{ name }}/g, name);
|
|
125
|
-
await writeFile(path, stub);
|
|
126
|
-
this.kernel.output.split(`INFO: Model Created`, chalk.gray(nodepath.basename(path)));
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Ge the database migration file name
|
|
130
|
-
*
|
|
131
|
-
* @param table
|
|
132
|
-
* @param create
|
|
133
|
-
* @param type
|
|
134
|
-
* @returns
|
|
135
|
-
*/
|
|
136
|
-
getMigrationStubName(table, create = false, type = "ts") {
|
|
137
|
-
let stub;
|
|
138
|
-
if (!table) {
|
|
139
|
-
stub = `migration-${type}.stub`;
|
|
140
|
-
} else if (create) {
|
|
141
|
-
stub = `migration.create-${type}.stub`;
|
|
142
|
-
} else {
|
|
143
|
-
stub = `migration.update-${type}.stub`;
|
|
144
|
-
}
|
|
145
|
-
return "dist/stubs/" + stub;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export {
|
|
150
|
-
MakeCommand
|
|
151
|
-
};
|
package/dist/chunk-LLL3V7LB.js
DELETED
package/dist/chunk-LQ6DL2HS.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Musket
|
|
3
|
-
} from "./chunk-MPXPSSLJ.js";
|
|
4
|
-
import {
|
|
5
|
-
Utils
|
|
6
|
-
} from "./chunk-POF4JGTX.js";
|
|
7
|
-
import {
|
|
8
|
-
__name
|
|
9
|
-
} from "./chunk-SHUYVCID.js";
|
|
10
|
-
|
|
11
|
-
// src/Kernel.ts
|
|
12
|
-
import { mkdir } from "fs/promises";
|
|
13
|
-
import path from "path";
|
|
14
|
-
var Kernel = class _Kernel {
|
|
15
|
-
static {
|
|
16
|
-
__name(this, "Kernel");
|
|
17
|
-
}
|
|
18
|
-
app;
|
|
19
|
-
cwd;
|
|
20
|
-
output = Utils.output();
|
|
21
|
-
basePath = "";
|
|
22
|
-
modulePath;
|
|
23
|
-
consolePath;
|
|
24
|
-
modulePackage;
|
|
25
|
-
consolePackage;
|
|
26
|
-
constructor(app, basePath) {
|
|
27
|
-
this.app = app;
|
|
28
|
-
}
|
|
29
|
-
static init(app) {
|
|
30
|
-
const instance = new _Kernel(app);
|
|
31
|
-
Promise.all([
|
|
32
|
-
instance.loadRequirements()
|
|
33
|
-
]).then(([e]) => e.run());
|
|
34
|
-
}
|
|
35
|
-
async run() {
|
|
36
|
-
await Musket.parse(this);
|
|
37
|
-
process.exit(0);
|
|
38
|
-
}
|
|
39
|
-
async ensureDirectoryExists(dir) {
|
|
40
|
-
await mkdir(dir, {
|
|
41
|
-
recursive: true
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
async loadRequirements() {
|
|
45
|
-
this.cwd = path.join(process.cwd(), this.basePath);
|
|
46
|
-
this.modulePath = Utils.findModulePkg("@h3ravel/core", this.cwd) ?? "";
|
|
47
|
-
this.consolePath = Utils.findModulePkg("@h3ravel/console", this.cwd) ?? "";
|
|
48
|
-
try {
|
|
49
|
-
this.modulePackage = await import(path.join(this.modulePath, "package.json"));
|
|
50
|
-
} catch {
|
|
51
|
-
this.modulePackage = {
|
|
52
|
-
version: "N/A"
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
try {
|
|
56
|
-
this.consolePackage = await import(path.join(this.consolePath, "package.json"));
|
|
57
|
-
} catch {
|
|
58
|
-
this.consolePackage = {
|
|
59
|
-
version: "N/A"
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
return this;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export {
|
|
67
|
-
Kernel
|
|
68
|
-
};
|
package/dist/chunk-M4ZRDJJ2.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Musket
|
|
3
|
-
} from "./chunk-XCOSZXAE.js";
|
|
4
|
-
import {
|
|
5
|
-
Utils
|
|
6
|
-
} from "./chunk-POF4JGTX.js";
|
|
7
|
-
import {
|
|
8
|
-
__name
|
|
9
|
-
} from "./chunk-SHUYVCID.js";
|
|
10
|
-
|
|
11
|
-
// src/Kernel.ts
|
|
12
|
-
import { mkdir } from "fs/promises";
|
|
13
|
-
import path from "path";
|
|
14
|
-
var Kernel = class _Kernel {
|
|
15
|
-
static {
|
|
16
|
-
__name(this, "Kernel");
|
|
17
|
-
}
|
|
18
|
-
app;
|
|
19
|
-
cwd;
|
|
20
|
-
output = Utils.output();
|
|
21
|
-
basePath = "";
|
|
22
|
-
modulePath;
|
|
23
|
-
consolePath;
|
|
24
|
-
modulePackage;
|
|
25
|
-
consolePackage;
|
|
26
|
-
constructor(app, basePath) {
|
|
27
|
-
this.app = app;
|
|
28
|
-
}
|
|
29
|
-
static init(app) {
|
|
30
|
-
const instance = new _Kernel(app);
|
|
31
|
-
Promise.all([
|
|
32
|
-
instance.loadRequirements()
|
|
33
|
-
]).then(([e]) => e.run());
|
|
34
|
-
}
|
|
35
|
-
async run() {
|
|
36
|
-
await Musket.parse(this);
|
|
37
|
-
process.exit(0);
|
|
38
|
-
}
|
|
39
|
-
async ensureDirectoryExists(dir) {
|
|
40
|
-
await mkdir(dir, {
|
|
41
|
-
recursive: true
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
async loadRequirements() {
|
|
45
|
-
this.cwd = path.join(process.cwd(), this.basePath);
|
|
46
|
-
this.modulePath = Utils.findModulePkg("@h3ravel/core", this.cwd) ?? "";
|
|
47
|
-
this.consolePath = Utils.findModulePkg("@h3ravel/console", this.cwd) ?? "";
|
|
48
|
-
try {
|
|
49
|
-
this.modulePackage = await import(path.join(this.modulePath, "package.json"));
|
|
50
|
-
} catch {
|
|
51
|
-
this.modulePackage = {
|
|
52
|
-
version: "N/A"
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
try {
|
|
56
|
-
this.consolePackage = await import(path.join(this.consolePath, "package.json"));
|
|
57
|
-
} catch {
|
|
58
|
-
this.consolePackage = {
|
|
59
|
-
version: "N/A"
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
return this;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export {
|
|
67
|
-
Kernel
|
|
68
|
-
};
|
package/dist/chunk-MAQAT3PU.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
providers_default
|
|
3
|
-
} from "./chunk-P7M5PEDY.js";
|
|
4
|
-
import {
|
|
5
|
-
__name
|
|
6
|
-
} from "./chunk-SHUYVCID.js";
|
|
7
|
-
|
|
8
|
-
// src/IO/app.ts
|
|
9
|
-
import { Application } from "@h3ravel/core";
|
|
10
|
-
import { EventEmitter } from "events";
|
|
11
|
-
var app_default = class {
|
|
12
|
-
static {
|
|
13
|
-
__name(this, "default");
|
|
14
|
-
}
|
|
15
|
-
async bootstrap() {
|
|
16
|
-
const app = new Application(process.cwd());
|
|
17
|
-
app.registerProviders(providers_default);
|
|
18
|
-
await app.registerConfiguredProviders();
|
|
19
|
-
await app.boot();
|
|
20
|
-
new EventEmitter().once("SIGINT", () => process.exit(0));
|
|
21
|
-
process.on("SIGINT", () => {
|
|
22
|
-
process.exit(0);
|
|
23
|
-
});
|
|
24
|
-
process.on("SIGTERM", () => {
|
|
25
|
-
process.exit(0);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export {
|
|
31
|
-
app_default
|
|
32
|
-
};
|
package/dist/chunk-MPXPSSLJ.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MakeCommand
|
|
3
|
-
} from "./chunk-PMV4TMFS.js";
|
|
4
|
-
import {
|
|
5
|
-
MigrateCommand
|
|
6
|
-
} from "./chunk-EIOQKTRM.js";
|
|
7
|
-
import {
|
|
8
|
-
ServeCommand
|
|
9
|
-
} from "./chunk-7EWRZPTX.js";
|
|
10
|
-
import {
|
|
11
|
-
Signature
|
|
12
|
-
} from "./chunk-3FVPHQCH.js";
|
|
13
|
-
import {
|
|
14
|
-
Utils
|
|
15
|
-
} from "./chunk-POF4JGTX.js";
|
|
16
|
-
import {
|
|
17
|
-
__name
|
|
18
|
-
} from "./chunk-SHUYVCID.js";
|
|
19
|
-
|
|
20
|
-
// src/Musket.ts
|
|
21
|
-
import chalk from "chalk";
|
|
22
|
-
import { program } from "commander";
|
|
23
|
-
var Musket = class _Musket {
|
|
24
|
-
static {
|
|
25
|
-
__name(this, "Musket");
|
|
26
|
-
}
|
|
27
|
-
app;
|
|
28
|
-
kernel;
|
|
29
|
-
output = Utils.output();
|
|
30
|
-
commands = [];
|
|
31
|
-
constructor(app, kernel) {
|
|
32
|
-
this.app = app;
|
|
33
|
-
this.kernel = kernel;
|
|
34
|
-
}
|
|
35
|
-
async build() {
|
|
36
|
-
this.loadBaseCommands();
|
|
37
|
-
await this.loadDiscoveredCommands();
|
|
38
|
-
return this.initialize();
|
|
39
|
-
}
|
|
40
|
-
loadBaseCommands() {
|
|
41
|
-
const commands = [
|
|
42
|
-
new ServeCommand(this.app, this.kernel),
|
|
43
|
-
new MakeCommand(this.app, this.kernel),
|
|
44
|
-
new MigrateCommand(this.app, this.kernel)
|
|
45
|
-
];
|
|
46
|
-
commands.forEach((e) => this.addCommand(e));
|
|
47
|
-
}
|
|
48
|
-
async loadDiscoveredCommands() {
|
|
49
|
-
const commands = [];
|
|
50
|
-
commands.forEach((e) => this.addCommand(e));
|
|
51
|
-
}
|
|
52
|
-
addCommand(command) {
|
|
53
|
-
this.commands.push(Signature.parseSignature(command.getSignature(), command));
|
|
54
|
-
}
|
|
55
|
-
initialize() {
|
|
56
|
-
const cliVersion = [
|
|
57
|
-
"H3ravel Version:",
|
|
58
|
-
chalk.green(this.kernel.consolePackage.version)
|
|
59
|
-
].join(" ");
|
|
60
|
-
const localVersion = [
|
|
61
|
-
"Musket Version:",
|
|
62
|
-
chalk.green(this.kernel.modulePackage.version || "None")
|
|
63
|
-
].join(" ");
|
|
64
|
-
program.name("musket").version(`${cliVersion}
|
|
65
|
-
${localVersion}`);
|
|
66
|
-
program.command("init").description("Initialize H3ravel.").action(async () => {
|
|
67
|
-
this.output.success(`Initialized: H3ravel has been initialized!`);
|
|
68
|
-
});
|
|
69
|
-
for (let i = 0; i < this.commands.length; i++) {
|
|
70
|
-
const command = this.commands[i];
|
|
71
|
-
const instance = command.commandClass;
|
|
72
|
-
if (command.isNamespaceCommand && command.subCommands) {
|
|
73
|
-
const cmd = command.isHidden ? program : program.command(command.baseCommand).description(command.description ?? "").action(async () => {
|
|
74
|
-
instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command);
|
|
75
|
-
await instance.handle();
|
|
76
|
-
});
|
|
77
|
-
if ((command.options?.length ?? 0) > 0) {
|
|
78
|
-
command.options?.filter((v, i2, a) => a.findIndex((t) => t.name === v.name) === i2).forEach((opt) => {
|
|
79
|
-
this.makeOption(opt, cmd);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
command.subCommands.filter((v, i2, a) => !v.shared && a.findIndex((t) => t.name === v.name) === i2).forEach((sub) => {
|
|
83
|
-
const cmd2 = program.command(`${command.baseCommand}:${sub.name}`).description(sub.description || "").action(async () => {
|
|
84
|
-
instance.setInput(cmd2.opts(), cmd2.args, cmd2.registeredArguments, sub);
|
|
85
|
-
await instance.handle();
|
|
86
|
-
});
|
|
87
|
-
command.subCommands?.filter((e) => e.shared).forEach((opt) => {
|
|
88
|
-
this.makeOption(opt, cmd2, false, sub);
|
|
89
|
-
});
|
|
90
|
-
command.options?.filter((e) => e.shared).forEach((opt) => {
|
|
91
|
-
this.makeOption(opt, cmd2, false, sub);
|
|
92
|
-
});
|
|
93
|
-
if (sub.nestedOptions) {
|
|
94
|
-
sub.nestedOptions.filter((v, i2, a) => a.findIndex((t) => t.name === v.name) === i2).forEach((opt) => {
|
|
95
|
-
this.makeOption(opt, cmd2);
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
} else {
|
|
100
|
-
const cmd = program.command(command.baseCommand).description(command.description ?? "");
|
|
101
|
-
command?.options?.filter((v, i2, a) => a.findIndex((t) => t.name === v.name) === i2).forEach((opt) => {
|
|
102
|
-
this.makeOption(opt, cmd, true);
|
|
103
|
-
});
|
|
104
|
-
cmd.action(async () => {
|
|
105
|
-
instance.setInput(cmd.opts(), cmd.args, cmd.registeredArguments, command);
|
|
106
|
-
await instance.handle();
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return program;
|
|
111
|
-
}
|
|
112
|
-
makeOption(opt, cmd, parse, parent) {
|
|
113
|
-
const description = opt.description?.replace(/\[(\w+)\]/g, (_, k) => parent?.[k] ?? `[${k}]`) ?? "";
|
|
114
|
-
const type = opt.name.replaceAll("-", "");
|
|
115
|
-
if (opt.isFlag) {
|
|
116
|
-
if (parse) {
|
|
117
|
-
const flags = opt.flags?.map((f) => f.length === 1 ? `-${f}` : `--${f}`).join(", ");
|
|
118
|
-
cmd.option(flags || "", description, String(opt.defaultValue) || void 0);
|
|
119
|
-
} else {
|
|
120
|
-
cmd.option(opt.flags?.join(", ") + (opt.required ? ` <${type}>` : ""), description, opt.defaultValue);
|
|
121
|
-
}
|
|
122
|
-
} else {
|
|
123
|
-
cmd.argument(opt.required ? `<${opt.name}>` : `[${opt.name}]`, description, opt.defaultValue);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
static async parse(kernel) {
|
|
127
|
-
return (await new _Musket(kernel.app, kernel).build()).parseAsync();
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export {
|
|
132
|
-
Musket
|
|
133
|
-
};
|
package/dist/chunk-NADN2PHB.js
DELETED
|
File without changes
|
package/dist/chunk-NFRXMBRP.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
providers_default
|
|
3
|
-
} from "./chunk-PYSJMSNM.js";
|
|
4
|
-
import {
|
|
5
|
-
__name
|
|
6
|
-
} from "./chunk-SHUYVCID.js";
|
|
7
|
-
|
|
8
|
-
// src/IO/app.ts
|
|
9
|
-
import { Application } from "@h3ravel/core";
|
|
10
|
-
var app_default = class {
|
|
11
|
-
static {
|
|
12
|
-
__name(this, "default");
|
|
13
|
-
}
|
|
14
|
-
async bootstrap() {
|
|
15
|
-
const app = new Application(process.cwd());
|
|
16
|
-
app.registerProviders(providers_default);
|
|
17
|
-
await app.registerConfiguredProviders();
|
|
18
|
-
await app.boot();
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
app_default
|
|
24
|
-
};
|
package/dist/chunk-NVPKTRMT.js
DELETED
package/dist/chunk-O45AB4MX.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__name
|
|
3
|
-
} from "./chunk-SHUYVCID.js";
|
|
4
|
-
|
|
5
|
-
// src/Commands/Command.ts
|
|
6
|
-
var Command = class {
|
|
7
|
-
static {
|
|
8
|
-
__name(this, "Command");
|
|
9
|
-
}
|
|
10
|
-
app;
|
|
11
|
-
kernel;
|
|
12
|
-
constructor(app, kernel) {
|
|
13
|
-
this.app = app;
|
|
14
|
-
this.kernel = kernel;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* The name and signature of the console command.
|
|
18
|
-
*
|
|
19
|
-
* @var string
|
|
20
|
-
*/
|
|
21
|
-
signature;
|
|
22
|
-
/**
|
|
23
|
-
* A dictionary of signatures or what not.
|
|
24
|
-
*
|
|
25
|
-
* @var object
|
|
26
|
-
*/
|
|
27
|
-
dictionary = {};
|
|
28
|
-
/**
|
|
29
|
-
* The console command description.
|
|
30
|
-
*
|
|
31
|
-
* @var string
|
|
32
|
-
*/
|
|
33
|
-
description;
|
|
34
|
-
/**
|
|
35
|
-
* The console command input.
|
|
36
|
-
*
|
|
37
|
-
* @var object
|
|
38
|
-
*/
|
|
39
|
-
input = {
|
|
40
|
-
options: {},
|
|
41
|
-
arguments: {}
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Execute the console command.
|
|
45
|
-
*/
|
|
46
|
-
async handle(..._args) {
|
|
47
|
-
}
|
|
48
|
-
setApplication(app) {
|
|
49
|
-
this.app = app;
|
|
50
|
-
}
|
|
51
|
-
setInput(options, args, regArgs, dictionary) {
|
|
52
|
-
this.dictionary = dictionary;
|
|
53
|
-
this.input.options = options;
|
|
54
|
-
this.input.arguments = regArgs.map((e, i) => ({
|
|
55
|
-
[e.name()]: args[i]
|
|
56
|
-
})).reduce((e, x) => Object.assign(e, x), {});
|
|
57
|
-
}
|
|
58
|
-
getSignature() {
|
|
59
|
-
return this.signature;
|
|
60
|
-
}
|
|
61
|
-
getDescription() {
|
|
62
|
-
return this.description;
|
|
63
|
-
}
|
|
64
|
-
option(key, def) {
|
|
65
|
-
return this.input.options[key] ?? def;
|
|
66
|
-
}
|
|
67
|
-
options(key) {
|
|
68
|
-
if (key) {
|
|
69
|
-
return this.input.options[key];
|
|
70
|
-
}
|
|
71
|
-
return this.input.options;
|
|
72
|
-
}
|
|
73
|
-
argument(key, def) {
|
|
74
|
-
return this.input.arguments[key] ?? def;
|
|
75
|
-
}
|
|
76
|
-
arguments() {
|
|
77
|
-
return this.input.arguments;
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export {
|
|
82
|
-
Command
|
|
83
|
-
};
|
package/dist/chunk-ORPRWIQ2.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
providers_default
|
|
3
|
-
} from "./chunk-P7M5PEDY.js";
|
|
4
|
-
import {
|
|
5
|
-
__name
|
|
6
|
-
} from "./chunk-SHUYVCID.js";
|
|
7
|
-
|
|
8
|
-
// src/IO/app.ts
|
|
9
|
-
import { Application } from "@h3ravel/core";
|
|
10
|
-
import { EventEmitter } from "events";
|
|
11
|
-
var app_default = class {
|
|
12
|
-
static {
|
|
13
|
-
__name(this, "default");
|
|
14
|
-
}
|
|
15
|
-
async bootstrap() {
|
|
16
|
-
const app = new Application(process.cwd());
|
|
17
|
-
app.registerProviders(providers_default);
|
|
18
|
-
await app.registerConfiguredProviders();
|
|
19
|
-
await app.boot();
|
|
20
|
-
dd("app");
|
|
21
|
-
new EventEmitter().once("SIGINT", () => process.exit(0));
|
|
22
|
-
process.on("SIGINT", () => {
|
|
23
|
-
process.exit(0);
|
|
24
|
-
});
|
|
25
|
-
process.on("SIGTERM", () => {
|
|
26
|
-
process.exit(0);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export {
|
|
32
|
-
app_default
|
|
33
|
-
};
|
package/dist/chunk-P7M5PEDY.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConsoleServiceProvider
|
|
3
|
-
} from "./chunk-U6TOLKGJ.js";
|
|
4
|
-
|
|
5
|
-
// src/IO/providers.ts
|
|
6
|
-
import { ConfigServiceProvider } from "@h3ravel/config";
|
|
7
|
-
import { DatabaseServiceProvider } from "@h3ravel/database";
|
|
8
|
-
import { HttpServiceProvider } from "@h3ravel/http";
|
|
9
|
-
var providers_default = [
|
|
10
|
-
HttpServiceProvider,
|
|
11
|
-
ConfigServiceProvider,
|
|
12
|
-
DatabaseServiceProvider,
|
|
13
|
-
ConsoleServiceProvider
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
providers_default
|
|
18
|
-
};
|