@h3ravel/console 11.0.0 → 11.0.2

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.
Files changed (49) hide show
  1. package/README.md +13 -1
  2. package/dist/Commands/Command.cjs +104 -0
  3. package/dist/Commands/Command.js +7 -0
  4. package/dist/Commands/MakeCommand.cjs +433 -0
  5. package/dist/Commands/MakeCommand.js +9 -0
  6. package/dist/Commands/MigrateCommand.cjs +202 -0
  7. package/dist/Commands/MigrateCommand.js +8 -0
  8. package/dist/Commands/ServeCommand.cjs +159 -0
  9. package/dist/Commands/ServeCommand.js +8 -0
  10. package/dist/Contracts/ICommand.cjs +18 -0
  11. package/dist/Contracts/ICommand.js +1 -0
  12. package/dist/IO/app.cjs +934 -0
  13. package/dist/IO/app.js +17 -0
  14. package/dist/IO/providers.cjs +909 -0
  15. package/dist/IO/providers.js +16 -0
  16. package/dist/Kernel.cjs +892 -0
  17. package/dist/Kernel.js +14 -0
  18. package/dist/Musket.cjs +837 -0
  19. package/dist/Musket.js +13 -0
  20. package/dist/Providers/ConsoleServiceProvider.cjs +904 -0
  21. package/dist/Providers/ConsoleServiceProvider.js +15 -0
  22. package/dist/Signature.cjs +172 -0
  23. package/dist/Signature.js +7 -0
  24. package/dist/Utils.cjs +218 -0
  25. package/dist/Utils.js +9 -0
  26. package/dist/chunk-3FVPHQCH.js +151 -0
  27. package/dist/chunk-CTQ6DUT2.js +8 -0
  28. package/dist/chunk-FOSDCKCR.js +106 -0
  29. package/dist/chunk-IGEFNODG.js +22 -0
  30. package/dist/chunk-KMIFCLXG.js +16 -0
  31. package/dist/chunk-NADN2PHB.js +0 -0
  32. package/dist/chunk-O45AB4MX.js +83 -0
  33. package/dist/chunk-PMV4TMFS.js +151 -0
  34. package/dist/chunk-POF4JGTX.js +186 -0
  35. package/dist/chunk-SHUYVCID.js +6 -0
  36. package/dist/chunk-SP4JKAUC.js +63 -0
  37. package/dist/chunk-TN5SV7LF.js +133 -0
  38. package/dist/chunk-UCOXL3OM.js +0 -0
  39. package/dist/chunk-URLTFJET.js +68 -0
  40. package/dist/chunk-XSL373TG.js +36 -0
  41. package/dist/index.cjs +922 -3
  42. package/dist/index.d.cts +306 -2
  43. package/dist/index.d.ts +306 -2
  44. package/dist/index.js +43 -15
  45. package/dist/run.cjs +931 -0
  46. package/dist/run.js +909 -0
  47. package/package.json +21 -4
  48. package/dist/index.cjs.map +0 -1
  49. package/dist/index.js.map +0 -1
package/README.md CHANGED
@@ -1,8 +1,16 @@
1
- <p align="center"><a href="https://h3ravel.toneflix.net" target="_blank"><img src="https://raw.githubusercontent.com/h3ravel/assets/refs/heads/main/logo-full.svg" width="400" alt="H3ravel Logo"></a></p>
1
+ <div align="center">
2
+ <a href="https://h3ravel.toneflix.net" target="_blank">
3
+ <img src="https://raw.githubusercontent.com/h3ravel/assets/refs/heads/main/logo-full.svg" width="200" alt="H3ravel Logo">
4
+ </a>
5
+ <h1 align="center"><a href="https://h3ravel.toneflix.net/arquebus">H3ravel Console</a></h1>
2
6
 
3
7
  [![Framework][ix]][lx]
4
8
  [![Console Package Version][i1]][l1]
5
9
  [![Downloads][d1]][d1]
10
+ [![Tests][tei]][tel]
11
+ [![License][lini]][linl]
12
+
13
+ </div>
6
14
 
7
15
  # About H3ravel/Console
8
16
 
@@ -29,3 +37,7 @@ The H3ravel framework is open-sourced software licensed under the [MIT license](
29
37
  [i1]: https://img.shields.io/npm/v/%40h3ravel%2Fconsole?style=flat-square&label=@h3ravel/console&color=%230970ce
30
38
  [l1]: https://www.npmjs.com/package/@h3ravel/console
31
39
  [d1]: https://img.shields.io/npm/dt/%40h3ravel%2Fconsole?style=flat-square&label=Downloads&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2F%40h3ravel%2Fconsole
40
+ [linl]: https://github.com/h3ravel/framework/blob/main/LICENSE
41
+ [lini]: https://img.shields.io/github/license/h3ravel/framework
42
+ [tel]: https://github.com/h3ravel/framework/actions/workflows/test.yml
43
+ [tei]: https://github.com/h3ravel/framework/actions/workflows/test.yml/badge.svg
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/Commands/Command.ts
22
+ var Command_exports = {};
23
+ __export(Command_exports, {
24
+ Command: () => Command
25
+ });
26
+ module.exports = __toCommonJS(Command_exports);
27
+ var Command = class {
28
+ static {
29
+ __name(this, "Command");
30
+ }
31
+ app;
32
+ kernel;
33
+ constructor(app, kernel) {
34
+ this.app = app;
35
+ this.kernel = kernel;
36
+ }
37
+ /**
38
+ * The name and signature of the console command.
39
+ *
40
+ * @var string
41
+ */
42
+ signature;
43
+ /**
44
+ * A dictionary of signatures or what not.
45
+ *
46
+ * @var object
47
+ */
48
+ dictionary = {};
49
+ /**
50
+ * The console command description.
51
+ *
52
+ * @var string
53
+ */
54
+ description;
55
+ /**
56
+ * The console command input.
57
+ *
58
+ * @var object
59
+ */
60
+ input = {
61
+ options: {},
62
+ arguments: {}
63
+ };
64
+ /**
65
+ * Execute the console command.
66
+ */
67
+ async handle(..._args) {
68
+ }
69
+ setApplication(app) {
70
+ this.app = app;
71
+ }
72
+ setInput(options, args, regArgs, dictionary) {
73
+ this.dictionary = dictionary;
74
+ this.input.options = options;
75
+ this.input.arguments = regArgs.map((e, i) => ({
76
+ [e.name()]: args[i]
77
+ })).reduce((e, x) => Object.assign(e, x), {});
78
+ }
79
+ getSignature() {
80
+ return this.signature;
81
+ }
82
+ getDescription() {
83
+ return this.description;
84
+ }
85
+ option(key, def) {
86
+ return this.input.options[key] ?? def;
87
+ }
88
+ options(key) {
89
+ if (key) {
90
+ return this.input.options[key];
91
+ }
92
+ return this.input.options;
93
+ }
94
+ argument(key, def) {
95
+ return this.input.arguments[key] ?? def;
96
+ }
97
+ arguments() {
98
+ return this.input.arguments;
99
+ }
100
+ };
101
+ // Annotate the CommonJS export names for ESM import in node:
102
+ 0 && (module.exports = {
103
+ Command
104
+ });
@@ -0,0 +1,7 @@
1
+ import {
2
+ Command
3
+ } from "../chunk-O45AB4MX.js";
4
+ import "../chunk-SHUYVCID.js";
5
+ export {
6
+ Command
7
+ };
@@ -0,0 +1,433 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/Commands/MakeCommand.ts
32
+ var MakeCommand_exports = {};
33
+ __export(MakeCommand_exports, {
34
+ MakeCommand: () => MakeCommand
35
+ });
36
+ module.exports = __toCommonJS(MakeCommand_exports);
37
+
38
+ // src/Utils.ts
39
+ var import_promises = require("fs/promises");
40
+ var import_chalk = __toESM(require("chalk"), 1);
41
+
42
+ // ../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs
43
+ var import_path = require("path");
44
+ var import_fs = require("fs");
45
+ function sync_default(start, callback) {
46
+ let dir = (0, import_path.resolve)(".", start);
47
+ let tmp, stats = (0, import_fs.statSync)(dir);
48
+ if (!stats.isDirectory()) {
49
+ dir = (0, import_path.dirname)(dir);
50
+ }
51
+ while (true) {
52
+ tmp = callback(dir, (0, import_fs.readdirSync)(dir));
53
+ if (tmp) return (0, import_path.resolve)(dir, tmp);
54
+ dir = (0, import_path.dirname)(tmp = dir);
55
+ if (tmp === dir) break;
56
+ }
57
+ }
58
+ __name(sync_default, "default");
59
+
60
+ // src/Utils.ts
61
+ var import_path2 = __toESM(require("path"), 1);
62
+ var join = import_path2.default.join;
63
+ var Utils = class {
64
+ static {
65
+ __name(this, "Utils");
66
+ }
67
+ /**
68
+ * Wraps text with chalk
69
+ *
70
+ * @param txt
71
+ * @param color
72
+ * @returns
73
+ */
74
+ static textFormat(txt, color) {
75
+ return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color(" " + e + ": ") : e).join("");
76
+ }
77
+ /**
78
+ * Ouput formater object
79
+ *
80
+ * @returns
81
+ */
82
+ static output() {
83
+ return {
84
+ success: /* @__PURE__ */ __name((msg, exit = false) => {
85
+ console.log(import_chalk.default.green("\u2713"), this.textFormat(msg, import_chalk.default.bgGreen), "\n");
86
+ if (exit) process.exit(0);
87
+ }, "success"),
88
+ info: /* @__PURE__ */ __name((msg, exit = false) => {
89
+ console.log(import_chalk.default.blue("\u2139"), this.textFormat(msg, import_chalk.default.bgBlue), "\n");
90
+ if (exit) process.exit(0);
91
+ }, "info"),
92
+ error: /* @__PURE__ */ __name((msg, exit = true) => {
93
+ if (msg instanceof Error) {
94
+ if (msg.message) {
95
+ console.error(import_chalk.default.red("\u2716"), this.textFormat("ERROR:" + msg.message, import_chalk.default.bgRed));
96
+ }
97
+ console.error(import_chalk.default.red(`${msg.detail ? `${msg.detail}
98
+ ` : ""}${msg.stack}`), "\n");
99
+ } else {
100
+ console.error(import_chalk.default.red("\u2716"), this.textFormat(msg, import_chalk.default.bgRed), "\n");
101
+ }
102
+ if (exit) process.exit(1);
103
+ }, "error"),
104
+ split: /* @__PURE__ */ __name((name, value, status, exit = false) => {
105
+ status ??= "info";
106
+ const color = {
107
+ success: import_chalk.default.bgGreen,
108
+ info: import_chalk.default.bgBlue,
109
+ error: import_chalk.default.bgRed
110
+ };
111
+ const regex = /\x1b\[\d+m/g;
112
+ const width = Math.min(process.stdout.columns, 100);
113
+ const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
114
+ console.log(this.textFormat(name, color[status]), import_chalk.default.gray(".".repeat(dots)), value);
115
+ if (exit) process.exit(0);
116
+ }, "split"),
117
+ quiet: /* @__PURE__ */ __name(() => {
118
+ process.exit(0);
119
+ }, "quiet")
120
+ };
121
+ }
122
+ static findModulePkg(moduleId, cwd) {
123
+ const parts = moduleId.replace(/\\/g, "/").split("/");
124
+ let packageName = "";
125
+ if (parts.length > 0 && parts[0][0] === "@") {
126
+ packageName += parts.shift() + "/";
127
+ }
128
+ packageName += parts.shift();
129
+ const packageJson = import_path2.default.join(cwd ?? process.cwd(), "node_modules", packageName);
130
+ const resolved = this.findUpConfig(packageJson, "package", [
131
+ "json"
132
+ ]);
133
+ if (!resolved) {
134
+ return;
135
+ }
136
+ return import_path2.default.join(import_path2.default.dirname(resolved), parts.join("/"));
137
+ }
138
+ static async getMigrationPaths(cwd, migrator, defaultPath, path2) {
139
+ if (path2) {
140
+ return [
141
+ join(cwd, path2)
142
+ ];
143
+ }
144
+ return [
145
+ ...migrator.getPaths(),
146
+ join(cwd, defaultPath)
147
+ ];
148
+ }
149
+ static twoColumnDetail(name, value) {
150
+ const regex = /\x1b\[\d+m/g;
151
+ const width = Math.min(process.stdout.columns, 100);
152
+ const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
153
+ return console.log(name, import_chalk.default.gray(".".repeat(dots)), value);
154
+ }
155
+ /**
156
+ * Check if file exists
157
+ *
158
+ * @param path
159
+ * @returns
160
+ */
161
+ static async fileExists(path2) {
162
+ try {
163
+ await (0, import_promises.access)(path2);
164
+ return true;
165
+ } catch {
166
+ return false;
167
+ }
168
+ }
169
+ static findUpConfig(cwd, name, extensions) {
170
+ return sync_default(cwd, (_dir, names) => {
171
+ for (const ext of extensions) {
172
+ const filename = `${name}.${ext}`;
173
+ if (names.includes(filename)) {
174
+ return filename;
175
+ }
176
+ }
177
+ return false;
178
+ });
179
+ }
180
+ };
181
+ var TableGuesser = class TableGuesser2 {
182
+ static {
183
+ __name(this, "TableGuesser");
184
+ }
185
+ static CREATE_PATTERNS = [
186
+ /^create_(\w+)_table$/,
187
+ /^create_(\w+)$/
188
+ ];
189
+ static CHANGE_PATTERNS = [
190
+ /.+_(to|from|in)_(\w+)_table$/,
191
+ /.+_(to|from|in)_(\w+)$/
192
+ ];
193
+ static guess(migration) {
194
+ for (const pattern of TableGuesser2.CREATE_PATTERNS) {
195
+ const matches = migration.match(pattern);
196
+ if (matches) {
197
+ return [
198
+ matches[1],
199
+ true
200
+ ];
201
+ }
202
+ }
203
+ for (const pattern of TableGuesser2.CHANGE_PATTERNS) {
204
+ const matches = migration.match(pattern);
205
+ if (matches) {
206
+ return [
207
+ matches[2],
208
+ false
209
+ ];
210
+ }
211
+ }
212
+ return [];
213
+ }
214
+ };
215
+
216
+ // src/Commands/MakeCommand.ts
217
+ var import_promises2 = require("fs/promises");
218
+
219
+ // src/Commands/Command.ts
220
+ var Command = class {
221
+ static {
222
+ __name(this, "Command");
223
+ }
224
+ app;
225
+ kernel;
226
+ constructor(app, kernel) {
227
+ this.app = app;
228
+ this.kernel = kernel;
229
+ }
230
+ /**
231
+ * The name and signature of the console command.
232
+ *
233
+ * @var string
234
+ */
235
+ signature;
236
+ /**
237
+ * A dictionary of signatures or what not.
238
+ *
239
+ * @var object
240
+ */
241
+ dictionary = {};
242
+ /**
243
+ * The console command description.
244
+ *
245
+ * @var string
246
+ */
247
+ description;
248
+ /**
249
+ * The console command input.
250
+ *
251
+ * @var object
252
+ */
253
+ input = {
254
+ options: {},
255
+ arguments: {}
256
+ };
257
+ /**
258
+ * Execute the console command.
259
+ */
260
+ async handle(..._args) {
261
+ }
262
+ setApplication(app) {
263
+ this.app = app;
264
+ }
265
+ setInput(options, args, regArgs, dictionary) {
266
+ this.dictionary = dictionary;
267
+ this.input.options = options;
268
+ this.input.arguments = regArgs.map((e, i) => ({
269
+ [e.name()]: args[i]
270
+ })).reduce((e, x) => Object.assign(e, x), {});
271
+ }
272
+ getSignature() {
273
+ return this.signature;
274
+ }
275
+ getDescription() {
276
+ return this.description;
277
+ }
278
+ option(key, def) {
279
+ return this.input.options[key] ?? def;
280
+ }
281
+ options(key) {
282
+ if (key) {
283
+ return this.input.options[key];
284
+ }
285
+ return this.input.options;
286
+ }
287
+ argument(key, def) {
288
+ return this.input.arguments[key] ?? def;
289
+ }
290
+ arguments() {
291
+ return this.input.arguments;
292
+ }
293
+ };
294
+
295
+ // src/Commands/MakeCommand.ts
296
+ var import_chalk2 = __toESM(require("chalk"), 1);
297
+ var import_dayjs = __toESM(require("dayjs"), 1);
298
+ var import_node_fs = require("fs");
299
+ var import_node_path = __toESM(require("path"), 1);
300
+ var MakeCommand = class extends Command {
301
+ static {
302
+ __name(this, "MakeCommand");
303
+ }
304
+ /**
305
+ * The name and signature of the console command.
306
+ *
307
+ * @var string
308
+ */
309
+ signature = `#make:
310
+ {controller : Generates a new controller class. | {--a|api : Generate an API resource controller} | {--force : Overide existing controller.} }
311
+ {resource : Generates a new API resource class.}
312
+ {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} }
313
+ {factory : Generates a new database factory class.}
314
+ {seeder : Generates a new database seeder class.}
315
+ {model : Generates a new Arquebus model class. | {--t|type=ts : The file type to generate}}
316
+ {^name : The name of the [name] to generate}
317
+ `;
318
+ /**
319
+ * The console command description.
320
+ *
321
+ * @var string
322
+ */
323
+ description = "Generate component classes";
324
+ async handle() {
325
+ const command = this.dictionary.baseCommand;
326
+ const methods = {
327
+ controller: "makeController",
328
+ resource: "makeResource",
329
+ migration: "makeMigration",
330
+ factory: "makeFactory",
331
+ seeder: "makeSeeder",
332
+ model: "makeModel"
333
+ };
334
+ try {
335
+ await this?.[methods[command]]();
336
+ } catch (e) {
337
+ this.kernel.output.error(e);
338
+ }
339
+ }
340
+ /**
341
+ * Generate a new controller class.
342
+ */
343
+ async makeController() {
344
+ const type = this.option("api") ? "-resource" : "";
345
+ const name = this.argument("name");
346
+ const force = this.option("force");
347
+ const path2 = import_node_path.default.join(app_path("Http/Controllers"), name + ".ts");
348
+ const dbPath = Utils.findModulePkg("@h3ravel/http", this.kernel.cwd) ?? "";
349
+ const stubPath = import_node_path.default.join(dbPath, `dist/stubs/controller${type}.stub`);
350
+ if (!force && (0, import_node_fs.existsSync)(path2)) {
351
+ this.kernel.output.error(`ERORR: ${name} controller already exists`);
352
+ }
353
+ let stub = await (0, import_promises2.readFile)(stubPath, "utf-8");
354
+ stub = stub.replace(/{{ name }}/g, name);
355
+ await (0, import_promises2.writeFile)(path2, stub);
356
+ this.kernel.output.split(`INFO: Controller Created`, import_chalk2.default.gray(import_node_path.default.basename(path2)));
357
+ }
358
+ makeResource() {
359
+ this.kernel.output.success(`Resource support is not yet available`);
360
+ }
361
+ /**
362
+ * Generate a new database migration class
363
+ */
364
+ async makeMigration() {
365
+ const name = this.argument("name");
366
+ const datePrefix = (0, import_dayjs.default)().format("YYYY_MM_DD_HHmmss");
367
+ const path2 = import_node_path.default.join(database_path("migrations"), `${datePrefix}_${name}.ts`);
368
+ const dbPath = Utils.findModulePkg("@h3ravel/database", this.kernel.cwd) ?? "";
369
+ let create = this.option("create", false);
370
+ let table = this.option("table");
371
+ if (!table && typeof create === "string") {
372
+ table = create;
373
+ create = true;
374
+ }
375
+ if (!table) {
376
+ const guessed = TableGuesser.guess(name);
377
+ table = guessed[0];
378
+ create = !!guessed[1];
379
+ }
380
+ const stubPath = import_node_path.default.join(dbPath, this.getMigrationStubName(table, create));
381
+ let stub = await (0, import_promises2.readFile)(stubPath, "utf-8");
382
+ if (table !== null) {
383
+ stub = stub.replace(/DummyTable|{{\s*table\s*}}/g, table);
384
+ }
385
+ this.kernel.output.info("INFO: Creating Migration");
386
+ await this.kernel.ensureDirectoryExists(import_node_path.default.dirname(path2));
387
+ await (0, import_promises2.writeFile)(path2, stub);
388
+ this.kernel.output.split(`INFO: Migration Created`, import_chalk2.default.gray(import_node_path.default.basename(path2)));
389
+ }
390
+ makeFactory() {
391
+ this.kernel.output.success(`Factory support is not yet available`);
392
+ }
393
+ makeSeeder() {
394
+ this.kernel.output.success(`Seeder support is not yet available`);
395
+ }
396
+ /**
397
+ * Generate a new Arquebus model class
398
+ */
399
+ async makeModel() {
400
+ const type = this.option("type", "ts");
401
+ const name = this.argument("name");
402
+ const path2 = import_node_path.default.join(app_path("Models"), name.toLowerCase() + "." + type);
403
+ const dbPath = Utils.findModulePkg("@h3ravel/database", this.kernel.cwd) ?? "";
404
+ const stubPath = import_node_path.default.join(dbPath, `dist/stubs/model-${type}.stub`);
405
+ let stub = await (0, import_promises2.readFile)(stubPath, "utf-8");
406
+ stub = stub.replace(/{{ name }}/g, name);
407
+ await (0, import_promises2.writeFile)(path2, stub);
408
+ this.kernel.output.split(`INFO: Model Created`, import_chalk2.default.gray(import_node_path.default.basename(path2)));
409
+ }
410
+ /**
411
+ * Ge the database migration file name
412
+ *
413
+ * @param table
414
+ * @param create
415
+ * @param type
416
+ * @returns
417
+ */
418
+ getMigrationStubName(table, create = false, type = "ts") {
419
+ let stub;
420
+ if (!table) {
421
+ stub = `migration-${type}.stub`;
422
+ } else if (create) {
423
+ stub = `migration.create-${type}.stub`;
424
+ } else {
425
+ stub = `migration.update-${type}.stub`;
426
+ }
427
+ return "dist/stubs/" + stub;
428
+ }
429
+ };
430
+ // Annotate the CommonJS export names for ESM import in node:
431
+ 0 && (module.exports = {
432
+ MakeCommand
433
+ });
@@ -0,0 +1,9 @@
1
+ import {
2
+ MakeCommand
3
+ } from "../chunk-PMV4TMFS.js";
4
+ import "../chunk-POF4JGTX.js";
5
+ import "../chunk-O45AB4MX.js";
6
+ import "../chunk-SHUYVCID.js";
7
+ export {
8
+ MakeCommand
9
+ };