@h3ravel/console 10.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.
Files changed (48) 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-FOSDCKCR.js +106 -0
  28. package/dist/chunk-IGEFNODG.js +22 -0
  29. package/dist/chunk-KMIFCLXG.js +16 -0
  30. package/dist/chunk-NADN2PHB.js +0 -0
  31. package/dist/chunk-O45AB4MX.js +83 -0
  32. package/dist/chunk-PMV4TMFS.js +151 -0
  33. package/dist/chunk-POF4JGTX.js +186 -0
  34. package/dist/chunk-SHUYVCID.js +6 -0
  35. package/dist/chunk-SP4JKAUC.js +63 -0
  36. package/dist/chunk-TN5SV7LF.js +133 -0
  37. package/dist/chunk-UCOXL3OM.js +0 -0
  38. package/dist/chunk-URLTFJET.js +68 -0
  39. package/dist/chunk-XSL373TG.js +36 -0
  40. package/dist/index.cjs +892 -6
  41. package/dist/index.d.cts +306 -2
  42. package/dist/index.d.ts +306 -2
  43. package/dist/index.js +43 -15
  44. package/dist/run.cjs +1 -0
  45. package/dist/run.js +1 -0
  46. package/package.json +23 -6
  47. package/dist/index.cjs.map +0 -1
  48. package/dist/index.js.map +0 -1
@@ -0,0 +1,15 @@
1
+ import {
2
+ ConsoleServiceProvider
3
+ } from "../chunk-IGEFNODG.js";
4
+ import "../chunk-URLTFJET.js";
5
+ import "../chunk-TN5SV7LF.js";
6
+ import "../chunk-FOSDCKCR.js";
7
+ import "../chunk-SP4JKAUC.js";
8
+ import "../chunk-3FVPHQCH.js";
9
+ import "../chunk-PMV4TMFS.js";
10
+ import "../chunk-POF4JGTX.js";
11
+ import "../chunk-O45AB4MX.js";
12
+ import "../chunk-SHUYVCID.js";
13
+ export {
14
+ ConsoleServiceProvider
15
+ };
@@ -0,0 +1,172 @@
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/Signature.ts
22
+ var Signature_exports = {};
23
+ __export(Signature_exports, {
24
+ Signature: () => Signature
25
+ });
26
+ module.exports = __toCommonJS(Signature_exports);
27
+ var Signature = class _Signature {
28
+ static {
29
+ __name(this, "Signature");
30
+ }
31
+ /**
32
+ * Helper to parse options inside a block of text
33
+ *
34
+ * @param block
35
+ * @returns
36
+ */
37
+ static parseOptions(block) {
38
+ const options = [];
39
+ const regex = /\{([^{}]+(?:\{[^{}]*\}[^{}]*)*)\}/g;
40
+ let match;
41
+ while ((match = regex.exec(block)) !== null) {
42
+ const shared = "^" === match[1][0] || /:[#^]/.test(match[1]);
43
+ const isHidden = ([
44
+ "#",
45
+ "^"
46
+ ].includes(match[1][0]) || /:[#^]/.test(match[1])) && !shared;
47
+ const content = match[1].trim().replace(/[#^]/, "");
48
+ const colonIndex = content.indexOf(":");
49
+ if (colonIndex === -1) {
50
+ options.push({
51
+ name: content
52
+ });
53
+ continue;
54
+ }
55
+ const namePart = content.substring(0, colonIndex).trim();
56
+ let rest = content.substring(colonIndex + 1).trim();
57
+ let description = rest;
58
+ let nestedOptions;
59
+ const pipeIndex = rest.indexOf("|");
60
+ if (pipeIndex !== -1) {
61
+ description = rest.substring(0, pipeIndex).trim();
62
+ const nestedText = rest.substring(pipeIndex + 1).trim();
63
+ const cleanedNestedText = nestedText.replace(/^\{/, "").trim();
64
+ nestedOptions = _Signature.parseOptions("{" + cleanedNestedText + "}");
65
+ } else {
66
+ description = description.trim();
67
+ }
68
+ let name = namePart;
69
+ let required = /[^a-zA-Z0-9_|-]/.test(name);
70
+ let multiple = false;
71
+ if (name.endsWith("?*")) {
72
+ required = false;
73
+ multiple = true;
74
+ name = name.slice(0, -2);
75
+ } else if (name.endsWith("*")) {
76
+ multiple = true;
77
+ name = name.slice(0, -1);
78
+ } else if (name.endsWith("?")) {
79
+ required = false;
80
+ name = name.slice(0, -1);
81
+ }
82
+ const isFlag = name.startsWith("--");
83
+ let flags;
84
+ let defaultValue;
85
+ if (isFlag) {
86
+ const flagParts = name.split("|").map((s) => s.trim());
87
+ flags = [];
88
+ for (let part of flagParts) {
89
+ if (part.startsWith("--") && part.slice(2).length === 1) {
90
+ part = "-" + part.slice(2);
91
+ } else if (part.startsWith("-") && !part.startsWith("--") && part.slice(1).length > 1) {
92
+ part = "--" + part.slice(1);
93
+ } else if (!part.startsWith("-") && part.slice(1).length > 1) {
94
+ part = "--" + part;
95
+ }
96
+ const eqIndex = part.indexOf("=");
97
+ if (eqIndex !== -1) {
98
+ flags.push(part.substring(0, eqIndex));
99
+ const val = part.substring(eqIndex + 1);
100
+ if (val === "*") {
101
+ defaultValue = [];
102
+ } else if (val === "true" || val === "false" || !val && !required) {
103
+ defaultValue = val === "true";
104
+ } else if (!isNaN(Number(val))) {
105
+ defaultValue = Number(val);
106
+ } else {
107
+ defaultValue = val;
108
+ }
109
+ } else {
110
+ flags.push(part);
111
+ }
112
+ }
113
+ }
114
+ options.push({
115
+ name: isFlag ? flags[flags.length - 1] : name,
116
+ required,
117
+ multiple,
118
+ description,
119
+ flags,
120
+ shared,
121
+ isFlag,
122
+ isHidden,
123
+ defaultValue,
124
+ nestedOptions
125
+ });
126
+ }
127
+ return options;
128
+ }
129
+ /**
130
+ * Helper to parse a command's signature
131
+ *
132
+ * @param signature
133
+ * @param commandClass
134
+ * @returns
135
+ */
136
+ static parseSignature(signature, commandClass) {
137
+ const lines = signature.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
138
+ const isHidden = [
139
+ "#",
140
+ "^"
141
+ ].includes(lines[0][0]) || /:[#^]/.test(lines[0]);
142
+ const baseCommand = lines[0].replace(/[^\w=:-]/g, "");
143
+ const description = commandClass.getDescription();
144
+ const isNamespaceCommand = baseCommand.endsWith(":");
145
+ const rest = lines.slice(1).join(" ");
146
+ const allOptions = _Signature.parseOptions(rest);
147
+ if (isNamespaceCommand) {
148
+ return {
149
+ baseCommand: baseCommand.slice(0, -1),
150
+ isNamespaceCommand,
151
+ subCommands: allOptions.filter((e) => !e.flags && !e.isHidden),
152
+ description,
153
+ commandClass,
154
+ options: allOptions.filter((e) => !!e.flags),
155
+ isHidden
156
+ };
157
+ } else {
158
+ return {
159
+ baseCommand,
160
+ isNamespaceCommand,
161
+ options: allOptions,
162
+ description,
163
+ commandClass,
164
+ isHidden
165
+ };
166
+ }
167
+ }
168
+ };
169
+ // Annotate the CommonJS export names for ESM import in node:
170
+ 0 && (module.exports = {
171
+ Signature
172
+ });
@@ -0,0 +1,7 @@
1
+ import {
2
+ Signature
3
+ } from "./chunk-3FVPHQCH.js";
4
+ import "./chunk-SHUYVCID.js";
5
+ export {
6
+ Signature
7
+ };
package/dist/Utils.cjs ADDED
@@ -0,0 +1,218 @@
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/Utils.ts
32
+ var Utils_exports = {};
33
+ __export(Utils_exports, {
34
+ TableGuesser: () => TableGuesser,
35
+ Utils: () => Utils
36
+ });
37
+ module.exports = __toCommonJS(Utils_exports);
38
+ var import_promises = require("fs/promises");
39
+ var import_chalk = __toESM(require("chalk"), 1);
40
+
41
+ // ../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs
42
+ var import_path = require("path");
43
+ var import_fs = require("fs");
44
+ function sync_default(start, callback) {
45
+ let dir = (0, import_path.resolve)(".", start);
46
+ let tmp, stats = (0, import_fs.statSync)(dir);
47
+ if (!stats.isDirectory()) {
48
+ dir = (0, import_path.dirname)(dir);
49
+ }
50
+ while (true) {
51
+ tmp = callback(dir, (0, import_fs.readdirSync)(dir));
52
+ if (tmp) return (0, import_path.resolve)(dir, tmp);
53
+ dir = (0, import_path.dirname)(tmp = dir);
54
+ if (tmp === dir) break;
55
+ }
56
+ }
57
+ __name(sync_default, "default");
58
+
59
+ // src/Utils.ts
60
+ var import_path2 = __toESM(require("path"), 1);
61
+ var join = import_path2.default.join;
62
+ var Utils = class {
63
+ static {
64
+ __name(this, "Utils");
65
+ }
66
+ /**
67
+ * Wraps text with chalk
68
+ *
69
+ * @param txt
70
+ * @param color
71
+ * @returns
72
+ */
73
+ static textFormat(txt, color) {
74
+ return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color(" " + e + ": ") : e).join("");
75
+ }
76
+ /**
77
+ * Ouput formater object
78
+ *
79
+ * @returns
80
+ */
81
+ static output() {
82
+ return {
83
+ success: /* @__PURE__ */ __name((msg, exit = false) => {
84
+ console.log(import_chalk.default.green("\u2713"), this.textFormat(msg, import_chalk.default.bgGreen), "\n");
85
+ if (exit) process.exit(0);
86
+ }, "success"),
87
+ info: /* @__PURE__ */ __name((msg, exit = false) => {
88
+ console.log(import_chalk.default.blue("\u2139"), this.textFormat(msg, import_chalk.default.bgBlue), "\n");
89
+ if (exit) process.exit(0);
90
+ }, "info"),
91
+ error: /* @__PURE__ */ __name((msg, exit = true) => {
92
+ if (msg instanceof Error) {
93
+ if (msg.message) {
94
+ console.error(import_chalk.default.red("\u2716"), this.textFormat("ERROR:" + msg.message, import_chalk.default.bgRed));
95
+ }
96
+ console.error(import_chalk.default.red(`${msg.detail ? `${msg.detail}
97
+ ` : ""}${msg.stack}`), "\n");
98
+ } else {
99
+ console.error(import_chalk.default.red("\u2716"), this.textFormat(msg, import_chalk.default.bgRed), "\n");
100
+ }
101
+ if (exit) process.exit(1);
102
+ }, "error"),
103
+ split: /* @__PURE__ */ __name((name, value, status, exit = false) => {
104
+ status ??= "info";
105
+ const color = {
106
+ success: import_chalk.default.bgGreen,
107
+ info: import_chalk.default.bgBlue,
108
+ error: import_chalk.default.bgRed
109
+ };
110
+ const regex = /\x1b\[\d+m/g;
111
+ const width = Math.min(process.stdout.columns, 100);
112
+ const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
113
+ console.log(this.textFormat(name, color[status]), import_chalk.default.gray(".".repeat(dots)), value);
114
+ if (exit) process.exit(0);
115
+ }, "split"),
116
+ quiet: /* @__PURE__ */ __name(() => {
117
+ process.exit(0);
118
+ }, "quiet")
119
+ };
120
+ }
121
+ static findModulePkg(moduleId, cwd) {
122
+ const parts = moduleId.replace(/\\/g, "/").split("/");
123
+ let packageName = "";
124
+ if (parts.length > 0 && parts[0][0] === "@") {
125
+ packageName += parts.shift() + "/";
126
+ }
127
+ packageName += parts.shift();
128
+ const packageJson = import_path2.default.join(cwd ?? process.cwd(), "node_modules", packageName);
129
+ const resolved = this.findUpConfig(packageJson, "package", [
130
+ "json"
131
+ ]);
132
+ if (!resolved) {
133
+ return;
134
+ }
135
+ return import_path2.default.join(import_path2.default.dirname(resolved), parts.join("/"));
136
+ }
137
+ static async getMigrationPaths(cwd, migrator, defaultPath, path2) {
138
+ if (path2) {
139
+ return [
140
+ join(cwd, path2)
141
+ ];
142
+ }
143
+ return [
144
+ ...migrator.getPaths(),
145
+ join(cwd, defaultPath)
146
+ ];
147
+ }
148
+ static twoColumnDetail(name, value) {
149
+ const regex = /\x1b\[\d+m/g;
150
+ const width = Math.min(process.stdout.columns, 100);
151
+ const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
152
+ return console.log(name, import_chalk.default.gray(".".repeat(dots)), value);
153
+ }
154
+ /**
155
+ * Check if file exists
156
+ *
157
+ * @param path
158
+ * @returns
159
+ */
160
+ static async fileExists(path2) {
161
+ try {
162
+ await (0, import_promises.access)(path2);
163
+ return true;
164
+ } catch {
165
+ return false;
166
+ }
167
+ }
168
+ static findUpConfig(cwd, name, extensions) {
169
+ return sync_default(cwd, (_dir, names) => {
170
+ for (const ext of extensions) {
171
+ const filename = `${name}.${ext}`;
172
+ if (names.includes(filename)) {
173
+ return filename;
174
+ }
175
+ }
176
+ return false;
177
+ });
178
+ }
179
+ };
180
+ var TableGuesser = class TableGuesser2 {
181
+ static {
182
+ __name(this, "TableGuesser");
183
+ }
184
+ static CREATE_PATTERNS = [
185
+ /^create_(\w+)_table$/,
186
+ /^create_(\w+)$/
187
+ ];
188
+ static CHANGE_PATTERNS = [
189
+ /.+_(to|from|in)_(\w+)_table$/,
190
+ /.+_(to|from|in)_(\w+)$/
191
+ ];
192
+ static guess(migration) {
193
+ for (const pattern of TableGuesser2.CREATE_PATTERNS) {
194
+ const matches = migration.match(pattern);
195
+ if (matches) {
196
+ return [
197
+ matches[1],
198
+ true
199
+ ];
200
+ }
201
+ }
202
+ for (const pattern of TableGuesser2.CHANGE_PATTERNS) {
203
+ const matches = migration.match(pattern);
204
+ if (matches) {
205
+ return [
206
+ matches[2],
207
+ false
208
+ ];
209
+ }
210
+ }
211
+ return [];
212
+ }
213
+ };
214
+ // Annotate the CommonJS export names for ESM import in node:
215
+ 0 && (module.exports = {
216
+ TableGuesser,
217
+ Utils
218
+ });
package/dist/Utils.js ADDED
@@ -0,0 +1,9 @@
1
+ import {
2
+ TableGuesser,
3
+ Utils
4
+ } from "./chunk-POF4JGTX.js";
5
+ import "./chunk-SHUYVCID.js";
6
+ export {
7
+ TableGuesser,
8
+ Utils
9
+ };
@@ -0,0 +1,151 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-SHUYVCID.js";
4
+
5
+ // src/Signature.ts
6
+ var Signature = class _Signature {
7
+ static {
8
+ __name(this, "Signature");
9
+ }
10
+ /**
11
+ * Helper to parse options inside a block of text
12
+ *
13
+ * @param block
14
+ * @returns
15
+ */
16
+ static parseOptions(block) {
17
+ const options = [];
18
+ const regex = /\{([^{}]+(?:\{[^{}]*\}[^{}]*)*)\}/g;
19
+ let match;
20
+ while ((match = regex.exec(block)) !== null) {
21
+ const shared = "^" === match[1][0] || /:[#^]/.test(match[1]);
22
+ const isHidden = ([
23
+ "#",
24
+ "^"
25
+ ].includes(match[1][0]) || /:[#^]/.test(match[1])) && !shared;
26
+ const content = match[1].trim().replace(/[#^]/, "");
27
+ const colonIndex = content.indexOf(":");
28
+ if (colonIndex === -1) {
29
+ options.push({
30
+ name: content
31
+ });
32
+ continue;
33
+ }
34
+ const namePart = content.substring(0, colonIndex).trim();
35
+ let rest = content.substring(colonIndex + 1).trim();
36
+ let description = rest;
37
+ let nestedOptions;
38
+ const pipeIndex = rest.indexOf("|");
39
+ if (pipeIndex !== -1) {
40
+ description = rest.substring(0, pipeIndex).trim();
41
+ const nestedText = rest.substring(pipeIndex + 1).trim();
42
+ const cleanedNestedText = nestedText.replace(/^\{/, "").trim();
43
+ nestedOptions = _Signature.parseOptions("{" + cleanedNestedText + "}");
44
+ } else {
45
+ description = description.trim();
46
+ }
47
+ let name = namePart;
48
+ let required = /[^a-zA-Z0-9_|-]/.test(name);
49
+ let multiple = false;
50
+ if (name.endsWith("?*")) {
51
+ required = false;
52
+ multiple = true;
53
+ name = name.slice(0, -2);
54
+ } else if (name.endsWith("*")) {
55
+ multiple = true;
56
+ name = name.slice(0, -1);
57
+ } else if (name.endsWith("?")) {
58
+ required = false;
59
+ name = name.slice(0, -1);
60
+ }
61
+ const isFlag = name.startsWith("--");
62
+ let flags;
63
+ let defaultValue;
64
+ if (isFlag) {
65
+ const flagParts = name.split("|").map((s) => s.trim());
66
+ flags = [];
67
+ for (let part of flagParts) {
68
+ if (part.startsWith("--") && part.slice(2).length === 1) {
69
+ part = "-" + part.slice(2);
70
+ } else if (part.startsWith("-") && !part.startsWith("--") && part.slice(1).length > 1) {
71
+ part = "--" + part.slice(1);
72
+ } else if (!part.startsWith("-") && part.slice(1).length > 1) {
73
+ part = "--" + part;
74
+ }
75
+ const eqIndex = part.indexOf("=");
76
+ if (eqIndex !== -1) {
77
+ flags.push(part.substring(0, eqIndex));
78
+ const val = part.substring(eqIndex + 1);
79
+ if (val === "*") {
80
+ defaultValue = [];
81
+ } else if (val === "true" || val === "false" || !val && !required) {
82
+ defaultValue = val === "true";
83
+ } else if (!isNaN(Number(val))) {
84
+ defaultValue = Number(val);
85
+ } else {
86
+ defaultValue = val;
87
+ }
88
+ } else {
89
+ flags.push(part);
90
+ }
91
+ }
92
+ }
93
+ options.push({
94
+ name: isFlag ? flags[flags.length - 1] : name,
95
+ required,
96
+ multiple,
97
+ description,
98
+ flags,
99
+ shared,
100
+ isFlag,
101
+ isHidden,
102
+ defaultValue,
103
+ nestedOptions
104
+ });
105
+ }
106
+ return options;
107
+ }
108
+ /**
109
+ * Helper to parse a command's signature
110
+ *
111
+ * @param signature
112
+ * @param commandClass
113
+ * @returns
114
+ */
115
+ static parseSignature(signature, commandClass) {
116
+ const lines = signature.split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
117
+ const isHidden = [
118
+ "#",
119
+ "^"
120
+ ].includes(lines[0][0]) || /:[#^]/.test(lines[0]);
121
+ const baseCommand = lines[0].replace(/[^\w=:-]/g, "");
122
+ const description = commandClass.getDescription();
123
+ const isNamespaceCommand = baseCommand.endsWith(":");
124
+ const rest = lines.slice(1).join(" ");
125
+ const allOptions = _Signature.parseOptions(rest);
126
+ if (isNamespaceCommand) {
127
+ return {
128
+ baseCommand: baseCommand.slice(0, -1),
129
+ isNamespaceCommand,
130
+ subCommands: allOptions.filter((e) => !e.flags && !e.isHidden),
131
+ description,
132
+ commandClass,
133
+ options: allOptions.filter((e) => !!e.flags),
134
+ isHidden
135
+ };
136
+ } else {
137
+ return {
138
+ baseCommand,
139
+ isNamespaceCommand,
140
+ options: allOptions,
141
+ description,
142
+ commandClass,
143
+ isHidden
144
+ };
145
+ }
146
+ }
147
+ };
148
+
149
+ export {
150
+ Signature
151
+ };
@@ -0,0 +1,106 @@
1
+ import {
2
+ Command
3
+ } from "./chunk-O45AB4MX.js";
4
+ import {
5
+ __name
6
+ } from "./chunk-SHUYVCID.js";
7
+
8
+ // src/Commands/MigrateCommand.ts
9
+ import { arquebus } from "@h3ravel/arquebus";
10
+ var MigrateCommand = class extends Command {
11
+ static {
12
+ __name(this, "MigrateCommand");
13
+ }
14
+ /**
15
+ * The name and signature of the console command.
16
+ *
17
+ * @var string
18
+ */
19
+ signature = `migrate:
20
+ {fresh : Drop all tables and re-run all migrations.}
21
+ {install : Create the migration repository.}
22
+ {refresh : Reset and re-run all migrations.}
23
+ {reset : Rollback all database migrations.}
24
+ {rollback : Rollback the last database migration.}
25
+ {status : Show the status of each migration.}
26
+ {publish : Publish any migration files from installed packages.}
27
+ {^--s|seed : Seed the database}
28
+ `;
29
+ /**
30
+ * The console command description.
31
+ *
32
+ * @var string
33
+ */
34
+ description = "Run all pending migrations.";
35
+ /**
36
+ * Execute the console command.
37
+ */
38
+ async handle() {
39
+ const command = this.dictionary.name ?? this.dictionary.baseCommand;
40
+ const methods = {
41
+ migrate: "migrateRun",
42
+ fresh: "migrateFresh",
43
+ install: "migrateInstall",
44
+ refresh: "migrateRefresh",
45
+ reset: "migrateReset",
46
+ rollback: "migrateRollback",
47
+ status: "migrateStatus",
48
+ publish: "migratePublish"
49
+ };
50
+ await this?.[methods[command]]();
51
+ }
52
+ /**
53
+ * Run all pending migrations.
54
+ */
55
+ async migrateRun() {
56
+ this.kernel.output.success(`Running migrations are not yet supported.`);
57
+ }
58
+ /**
59
+ * Drop all tables and re-run all migrations.
60
+ */
61
+ async migrateFresh() {
62
+ this.kernel.output.success(`Drop all tables and re-run all migrations.`);
63
+ }
64
+ /**
65
+ * Create the migration repository.
66
+ */
67
+ async migrateInstall() {
68
+ this.kernel.output.success(`Create the migration repository.`);
69
+ }
70
+ /**
71
+ * Reset and re-run all migrations.
72
+ */
73
+ async migrateRefresh() {
74
+ this.kernel.output.success(`Resetting and re-running migrations is not yet supported.`);
75
+ }
76
+ /**
77
+ * Rollback all database migrations.
78
+ */
79
+ async migrateReset() {
80
+ this.kernel.output.success(`Rolling back all migration is not yet supported.`);
81
+ }
82
+ /**
83
+ * Rollback the last database migration.
84
+ */
85
+ async migrateRollback() {
86
+ this.kernel.output.success(`Rolling back the last migration is not yet supported.`);
87
+ }
88
+ /**
89
+ * Show the status of each migration.
90
+ */
91
+ async migrateStatus() {
92
+ const path = app_path();
93
+ console.log(arquebus.connection());
94
+ this.kernel.output.success(`Show the status of each migration.`);
95
+ }
96
+ /**
97
+ * Publish any migration files from installed packages.
98
+ */
99
+ async migratePublish() {
100
+ this.kernel.output.success(`Publish any migration files from installed packages.`);
101
+ }
102
+ };
103
+
104
+ export {
105
+ MigrateCommand
106
+ };
@@ -0,0 +1,22 @@
1
+ import {
2
+ Kernel
3
+ } from "./chunk-URLTFJET.js";
4
+ import {
5
+ __name
6
+ } from "./chunk-SHUYVCID.js";
7
+
8
+ // src/Providers/ConsoleServiceProvider.ts
9
+ import { ServiceProvider } from "@h3ravel/core";
10
+ var ConsoleServiceProvider = class extends ServiceProvider {
11
+ static {
12
+ __name(this, "ConsoleServiceProvider");
13
+ }
14
+ static priority = 992;
15
+ register() {
16
+ Kernel.init(this.app);
17
+ }
18
+ };
19
+
20
+ export {
21
+ ConsoleServiceProvider
22
+ };