@h3ravel/console 11.0.5 → 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.
Files changed (78) hide show
  1. package/bin/fire.cjs +2 -0
  2. package/bin/fire.js +2 -0
  3. package/dist/Utils-7OrjoB1C.d.cts +22 -0
  4. package/dist/Utils-B1kpj9-1.cjs +130 -0
  5. package/dist/Utils-B1kpj9-1.cjs.map +1 -0
  6. package/dist/Utils-DAJvoXlr.js +86 -0
  7. package/dist/Utils-DAJvoXlr.js.map +1 -0
  8. package/dist/Utils-DxnHOGMz.d.ts +22 -0
  9. package/dist/Utils.cjs +3 -217
  10. package/dist/Utils.d.cts +2 -0
  11. package/dist/Utils.d.ts +2 -0
  12. package/dist/Utils.js +3 -9
  13. package/dist/index.cjs +885 -921
  14. package/dist/index.cjs.map +1 -0
  15. package/dist/index.d.cts +270 -290
  16. package/dist/index.d.ts +270 -290
  17. package/dist/index.js +899 -44
  18. package/dist/index.js.map +1 -0
  19. package/package.json +36 -19
  20. package/bin/run.cjs +0 -26
  21. package/bin/run.js +0 -26
  22. package/dist/Commands/Command.cjs +0 -104
  23. package/dist/Commands/Command.js +0 -7
  24. package/dist/Commands/MakeCommand.cjs +0 -433
  25. package/dist/Commands/MakeCommand.js +0 -9
  26. package/dist/Commands/MigrateCommand.cjs +0 -202
  27. package/dist/Commands/MigrateCommand.js +0 -8
  28. package/dist/Commands/ServeCommand.cjs +0 -159
  29. package/dist/Commands/ServeCommand.js +0 -8
  30. package/dist/Contracts/ICommand.cjs +0 -18
  31. package/dist/Contracts/ICommand.js +0 -1
  32. package/dist/IO/app.cjs +0 -935
  33. package/dist/IO/app.js +0 -17
  34. package/dist/IO/providers.cjs +0 -911
  35. package/dist/IO/providers.js +0 -16
  36. package/dist/Kernel.cjs +0 -892
  37. package/dist/Kernel.js +0 -14
  38. package/dist/Musket.cjs +0 -837
  39. package/dist/Musket.js +0 -13
  40. package/dist/Providers/ConsoleServiceProvider.cjs +0 -904
  41. package/dist/Providers/ConsoleServiceProvider.js +0 -15
  42. package/dist/Signature.cjs +0 -172
  43. package/dist/Signature.js +0 -7
  44. package/dist/chunk-2O2AYFAG.js +0 -63
  45. package/dist/chunk-3FVPHQCH.js +0 -151
  46. package/dist/chunk-3VCNSA6P.js +0 -14
  47. package/dist/chunk-3WHUADTN.js +0 -6
  48. package/dist/chunk-6OCHCPBP.js +0 -36
  49. package/dist/chunk-CTQ6DUT2.js +0 -8
  50. package/dist/chunk-E5XIGIEX.js +0 -14
  51. package/dist/chunk-FOSDCKCR.js +0 -106
  52. package/dist/chunk-GVGO5OAK.js +0 -8
  53. package/dist/chunk-GXRCTWKL.js +0 -16
  54. package/dist/chunk-HVKW7JK4.js +0 -8
  55. package/dist/chunk-IGEFNODG.js +0 -22
  56. package/dist/chunk-JXL4VJHZ.js +0 -36
  57. package/dist/chunk-KMIFCLXG.js +0 -16
  58. package/dist/chunk-M4ZRDJJ2.js +0 -68
  59. package/dist/chunk-MAQAT3PU.js +0 -32
  60. package/dist/chunk-NADN2PHB.js +0 -0
  61. package/dist/chunk-O45AB4MX.js +0 -83
  62. package/dist/chunk-P7M5PEDY.js +0 -18
  63. package/dist/chunk-PMV4TMFS.js +0 -151
  64. package/dist/chunk-POF4JGTX.js +0 -186
  65. package/dist/chunk-RRP7K5LI.js +0 -36
  66. package/dist/chunk-SHUYVCID.js +0 -6
  67. package/dist/chunk-SP4JKAUC.js +0 -63
  68. package/dist/chunk-TJZCDDEV.js +0 -36
  69. package/dist/chunk-TN5SV7LF.js +0 -133
  70. package/dist/chunk-U6TOLKGJ.js +0 -22
  71. package/dist/chunk-UCOXL3OM.js +0 -0
  72. package/dist/chunk-URLTFJET.js +0 -68
  73. package/dist/chunk-XCOSZXAE.js +0 -133
  74. package/dist/chunk-XSL373TG.js +0 -36
  75. package/dist/chunk-YAYU7VOK.js +0 -8
  76. package/dist/chunk-ZTIO25VB.js +0 -8
  77. package/dist/run.cjs +0 -929
  78. package/dist/run.js +0 -14
@@ -1,16 +0,0 @@
1
- import {
2
- ConsoleServiceProvider
3
- } from "./chunk-IGEFNODG.js";
4
-
5
- // src/IO/providers.ts
6
- import { ConfigServiceProvider } from "@h3ravel/config";
7
- import { DatabaseServiceProvider } from "@h3ravel/database";
8
- var providers_default = [
9
- ConfigServiceProvider,
10
- DatabaseServiceProvider,
11
- ConsoleServiceProvider
12
- ];
13
-
14
- export {
15
- providers_default
16
- };
@@ -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
- };
@@ -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
- };
File without changes
@@ -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
- };
@@ -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
- };
@@ -1,151 +0,0 @@
1
- import {
2
- TableGuesser,
3
- Utils
4
- } from "./chunk-POF4JGTX.js";
5
- import {
6
- Command
7
- } from "./chunk-O45AB4MX.js";
8
- import {
9
- __name
10
- } from "./chunk-SHUYVCID.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
- };
@@ -1,186 +0,0 @@
1
- import {
2
- __name
3
- } from "./chunk-SHUYVCID.js";
4
-
5
- // src/Utils.ts
6
- import { access } from "fs/promises";
7
- import chalk from "chalk";
8
-
9
- // ../../node_modules/.pnpm/escalade@3.2.0/node_modules/escalade/sync/index.mjs
10
- import { dirname, resolve } from "path";
11
- import { readdirSync, statSync } from "fs";
12
- function sync_default(start, callback) {
13
- let dir = resolve(".", start);
14
- let tmp, stats = statSync(dir);
15
- if (!stats.isDirectory()) {
16
- dir = dirname(dir);
17
- }
18
- while (true) {
19
- tmp = callback(dir, readdirSync(dir));
20
- if (tmp) return resolve(dir, tmp);
21
- dir = dirname(tmp = dir);
22
- if (tmp === dir) break;
23
- }
24
- }
25
- __name(sync_default, "default");
26
-
27
- // src/Utils.ts
28
- import path from "path";
29
- var join = path.join;
30
- var Utils = class {
31
- static {
32
- __name(this, "Utils");
33
- }
34
- /**
35
- * Wraps text with chalk
36
- *
37
- * @param txt
38
- * @param color
39
- * @returns
40
- */
41
- static textFormat(txt, color) {
42
- return String(txt).split(":").map((e, i, a) => i == 0 && a.length > 1 ? color(" " + e + ": ") : e).join("");
43
- }
44
- /**
45
- * Ouput formater object
46
- *
47
- * @returns
48
- */
49
- static output() {
50
- return {
51
- success: /* @__PURE__ */ __name((msg, exit = false) => {
52
- console.log(chalk.green("\u2713"), this.textFormat(msg, chalk.bgGreen), "\n");
53
- if (exit) process.exit(0);
54
- }, "success"),
55
- info: /* @__PURE__ */ __name((msg, exit = false) => {
56
- console.log(chalk.blue("\u2139"), this.textFormat(msg, chalk.bgBlue), "\n");
57
- if (exit) process.exit(0);
58
- }, "info"),
59
- error: /* @__PURE__ */ __name((msg, exit = true) => {
60
- if (msg instanceof Error) {
61
- if (msg.message) {
62
- console.error(chalk.red("\u2716"), this.textFormat("ERROR:" + msg.message, chalk.bgRed));
63
- }
64
- console.error(chalk.red(`${msg.detail ? `${msg.detail}
65
- ` : ""}${msg.stack}`), "\n");
66
- } else {
67
- console.error(chalk.red("\u2716"), this.textFormat(msg, chalk.bgRed), "\n");
68
- }
69
- if (exit) process.exit(1);
70
- }, "error"),
71
- split: /* @__PURE__ */ __name((name, value, status, exit = false) => {
72
- status ??= "info";
73
- const color = {
74
- success: chalk.bgGreen,
75
- info: chalk.bgBlue,
76
- error: chalk.bgRed
77
- };
78
- const regex = /\x1b\[\d+m/g;
79
- const width = Math.min(process.stdout.columns, 100);
80
- const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
81
- console.log(this.textFormat(name, color[status]), chalk.gray(".".repeat(dots)), value);
82
- if (exit) process.exit(0);
83
- }, "split"),
84
- quiet: /* @__PURE__ */ __name(() => {
85
- process.exit(0);
86
- }, "quiet")
87
- };
88
- }
89
- static findModulePkg(moduleId, cwd) {
90
- const parts = moduleId.replace(/\\/g, "/").split("/");
91
- let packageName = "";
92
- if (parts.length > 0 && parts[0][0] === "@") {
93
- packageName += parts.shift() + "/";
94
- }
95
- packageName += parts.shift();
96
- const packageJson = path.join(cwd ?? process.cwd(), "node_modules", packageName);
97
- const resolved = this.findUpConfig(packageJson, "package", [
98
- "json"
99
- ]);
100
- if (!resolved) {
101
- return;
102
- }
103
- return path.join(path.dirname(resolved), parts.join("/"));
104
- }
105
- static async getMigrationPaths(cwd, migrator, defaultPath, path2) {
106
- if (path2) {
107
- return [
108
- join(cwd, path2)
109
- ];
110
- }
111
- return [
112
- ...migrator.getPaths(),
113
- join(cwd, defaultPath)
114
- ];
115
- }
116
- static twoColumnDetail(name, value) {
117
- const regex = /\x1b\[\d+m/g;
118
- const width = Math.min(process.stdout.columns, 100);
119
- const dots = Math.max(width - name.replace(regex, "").length - value.replace(regex, "").length - 10, 0);
120
- return console.log(name, chalk.gray(".".repeat(dots)), value);
121
- }
122
- /**
123
- * Check if file exists
124
- *
125
- * @param path
126
- * @returns
127
- */
128
- static async fileExists(path2) {
129
- try {
130
- await access(path2);
131
- return true;
132
- } catch {
133
- return false;
134
- }
135
- }
136
- static findUpConfig(cwd, name, extensions) {
137
- return sync_default(cwd, (_dir, names) => {
138
- for (const ext of extensions) {
139
- const filename = `${name}.${ext}`;
140
- if (names.includes(filename)) {
141
- return filename;
142
- }
143
- }
144
- return false;
145
- });
146
- }
147
- };
148
- var TableGuesser = class TableGuesser2 {
149
- static {
150
- __name(this, "TableGuesser");
151
- }
152
- static CREATE_PATTERNS = [
153
- /^create_(\w+)_table$/,
154
- /^create_(\w+)$/
155
- ];
156
- static CHANGE_PATTERNS = [
157
- /.+_(to|from|in)_(\w+)_table$/,
158
- /.+_(to|from|in)_(\w+)$/
159
- ];
160
- static guess(migration) {
161
- for (const pattern of TableGuesser2.CREATE_PATTERNS) {
162
- const matches = migration.match(pattern);
163
- if (matches) {
164
- return [
165
- matches[1],
166
- true
167
- ];
168
- }
169
- }
170
- for (const pattern of TableGuesser2.CHANGE_PATTERNS) {
171
- const matches = migration.match(pattern);
172
- if (matches) {
173
- return [
174
- matches[2],
175
- false
176
- ];
177
- }
178
- }
179
- return [];
180
- }
181
- };
182
-
183
- export {
184
- Utils,
185
- TableGuesser
186
- };
@@ -1,36 +0,0 @@
1
- import {
2
- providers_default
3
- } from "./chunk-3VCNSA6P.js";
4
- import {
5
- Kernel
6
- } from "./chunk-M4ZRDJJ2.js";
7
- import {
8
- __name
9
- } from "./chunk-SHUYVCID.js";
10
-
11
- // src/IO/app.ts
12
- import { Application } from "@h3ravel/core";
13
- import { EventEmitter } from "events";
14
- var app_default = class {
15
- static {
16
- __name(this, "default");
17
- }
18
- async bootstrap() {
19
- const app = new Application(process.cwd());
20
- app.registerProviders(providers_default);
21
- await app.registerConfiguredProviders();
22
- await app.boot();
23
- new Kernel(app);
24
- new EventEmitter().once("SIGINT", () => process.exit(0));
25
- process.on("SIGINT", () => {
26
- process.exit(0);
27
- });
28
- process.on("SIGTERM", () => {
29
- process.exit(0);
30
- });
31
- }
32
- };
33
-
34
- export {
35
- app_default
36
- };
@@ -1,6 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
- export {
5
- __name
6
- };
@@ -1,63 +0,0 @@
1
- import {
2
- Command
3
- } from "./chunk-O45AB4MX.js";
4
- import {
5
- __name
6
- } from "./chunk-SHUYVCID.js";
7
-
8
- // src/Commands/ServeCommand.ts
9
- import { spawn } from "child_process";
10
- var ServeCommand = class extends Command {
11
- static {
12
- __name(this, "ServeCommand");
13
- }
14
- /**
15
- * The name and signature of the console command.
16
- *
17
- * @var string
18
- */
19
- signature = "serve";
20
- /**
21
- * The console command description.
22
- *
23
- * @var string
24
- */
25
- description = "Start the Developement Server";
26
- async handle() {
27
- try {
28
- await this.serve();
29
- } catch (e) {
30
- this.kernel.output.error(e);
31
- }
32
- }
33
- async serve() {
34
- const child = spawn("tsup-node", {
35
- stdio: "inherit",
36
- shell: true,
37
- env: Object.assign({}, process.env, {
38
- NODE_ENV: "development"
39
- }),
40
- detached: true
41
- });
42
- const cleanup = /* @__PURE__ */ __name(() => {
43
- console.log(111);
44
- if (child.pid) {
45
- process.kill(child.pid, "SIGTERM");
46
- }
47
- }, "cleanup");
48
- process.on("SIGINT", () => child.kill("SIGINT"));
49
- process.on("SIGTERM", () => child.kill("SIGTERM"));
50
- process.on("SIGINT", () => {
51
- cleanup();
52
- process.exit(0);
53
- });
54
- process.on("SIGTERM", () => {
55
- cleanup();
56
- process.exit(0);
57
- });
58
- }
59
- };
60
-
61
- export {
62
- ServeCommand
63
- };
@@ -1,36 +0,0 @@
1
- import {
2
- providers_default
3
- } from "./chunk-GXRCTWKL.js";
4
- import {
5
- Kernel
6
- } from "./chunk-M4ZRDJJ2.js";
7
- import {
8
- __name
9
- } from "./chunk-SHUYVCID.js";
10
-
11
- // src/IO/app.ts
12
- import { Application } from "@h3ravel/core";
13
- import { EventEmitter } from "events";
14
- var app_default = class {
15
- static {
16
- __name(this, "default");
17
- }
18
- async bootstrap() {
19
- const app = new Application(process.cwd());
20
- app.registerProviders(providers_default);
21
- await app.registerConfiguredProviders();
22
- await app.boot();
23
- new Kernel(app);
24
- new EventEmitter().once("SIGINT", () => process.exit(0));
25
- process.on("SIGINT", () => {
26
- process.exit(0);
27
- });
28
- process.on("SIGTERM", () => {
29
- process.exit(0);
30
- });
31
- }
32
- };
33
-
34
- export {
35
- app_default
36
- };