neex 0.3.6 → 0.3.8
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/.env +2 -0
- package/bun.lock +29 -93
- package/dist/commands/project-command/dev.js +4 -1
- package/dist/commands/project-command/dev.js.map +1 -1
- package/dist/project-manager.js +4 -1
- package/dist/project-manager.js.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/package.json +5 -2
- package/dist/bin/neex.js +0 -4
- package/dist/commands/build.d.ts +0 -3
- package/dist/commands/build.js +0 -41
- package/dist/commands/build.js.map +0 -1
- package/dist/commands/cache.d.ts +0 -3
- package/dist/commands/cache.js +0 -34
- package/dist/commands/cache.js.map +0 -1
- package/dist/commands/dev.d.ts +0 -3
- package/dist/commands/dev.js +0 -51
- package/dist/commands/dev.js.map +0 -1
- package/dist/commands/process.d.ts +0 -2
- package/dist/commands/process.js +0 -216
- package/dist/commands/process.js.map +0 -1
- package/dist/commands/run.d.ts +0 -2
- package/dist/commands/run.js +0 -81
- package/dist/commands/run.js.map +0 -1
- package/dist/commands/start.d.ts +0 -3
- package/dist/commands/start.js +0 -45
- package/dist/commands/start.js.map +0 -1
- package/dist/dev-manager.d.ts +0 -35
- package/dist/dev-manager.js +0 -172
- package/dist/dev-manager.js.map +0 -1
- package/dist/src/cli.js +0 -519
- package/dist/src/index.js +0 -70
- package/dist/src/logger.js +0 -237
- package/dist/src/process-manager.js +0 -258
- package/dist/src/runner.js +0 -320
- package/dist/src/types.js +0 -2
package/dist/commands/dev.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.registerDevCommand = registerDevCommand;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const figures_1 = __importDefault(require("figures"));
|
|
9
|
-
function registerDevCommand(program, projectManager) {
|
|
10
|
-
program
|
|
11
|
-
.command('dev <entry>')
|
|
12
|
-
.description('Run TypeScript project in development mode with ultra-fast compilation and hot reload')
|
|
13
|
-
.option('-p, --port <number>', 'Port to run the server on', '3000')
|
|
14
|
-
.option('-w, --watch <paths...>', 'Paths to watch for changes', ['src'])
|
|
15
|
-
.option('-i, --ignore <paths...>', 'Paths to ignore', ['node_modules', 'dist', '.git', '.neex'])
|
|
16
|
-
.option('-e, --ext <extensions...>', 'File extensions to watch', ['ts', 'js', 'json'])
|
|
17
|
-
.option('-d, --delay <number>', 'Delay before restarting in milliseconds', '500')
|
|
18
|
-
.option('-c, --no-color', 'Disable colored output')
|
|
19
|
-
.option('--no-clear', 'Disable screen clearing on restart')
|
|
20
|
-
.option('--no-cache', 'Disable TypeScript compilation cache')
|
|
21
|
-
.option('--compiler <type>', 'Choose compiler: swc, esbuild, tsc', 'auto')
|
|
22
|
-
.option('--inspect', 'Enable Node.js inspector')
|
|
23
|
-
.option('--inspect-brk', 'Enable Node.js inspector with break')
|
|
24
|
-
.action(async (entry, options) => {
|
|
25
|
-
try {
|
|
26
|
-
await projectManager.startDev({
|
|
27
|
-
entry,
|
|
28
|
-
port: options.port,
|
|
29
|
-
watch: options.watch,
|
|
30
|
-
ignore: options.ignore,
|
|
31
|
-
ext: options.ext,
|
|
32
|
-
delay: options.delay,
|
|
33
|
-
clear: options.clear,
|
|
34
|
-
cache: options.cache,
|
|
35
|
-
compiler: options.compiler,
|
|
36
|
-
inspect: options.inspect,
|
|
37
|
-
inspectBrk: options.inspectBrk
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
if (error instanceof Error) {
|
|
42
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
46
|
-
}
|
|
47
|
-
process.exit(1);
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=dev.js.map
|
package/dist/commands/dev.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":";;;;;AAKA,gDAuCC;AA3CD,kDAA0B;AAC1B,sDAA8B;AAG9B,SAAgB,kBAAkB,CAAC,OAAgB,EAAE,cAA8B;IAC/E,OAAO;SACF,OAAO,CAAC,aAAa,CAAC;SACtB,WAAW,CAAC,uFAAuF,CAAC;SACpG,MAAM,CAAC,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAClE,MAAM,CAAC,wBAAwB,EAAE,4BAA4B,EAAE,CAAC,KAAK,CAAC,CAAC;SACvE,MAAM,CAAC,yBAAyB,EAAE,iBAAiB,EAAE,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;SAC/F,MAAM,CAAC,2BAA2B,EAAE,0BAA0B,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;SACrF,MAAM,CAAC,sBAAsB,EAAE,yCAAyC,EAAE,KAAK,CAAC;SAChF,MAAM,CAAC,gBAAgB,EAAE,wBAAwB,CAAC;SAClD,MAAM,CAAC,YAAY,EAAE,oCAAoC,CAAC;SAC1D,MAAM,CAAC,YAAY,EAAE,sCAAsC,CAAC;SAC5D,MAAM,CAAC,mBAAmB,EAAE,oCAAoC,EAAE,MAAM,CAAC;SACzE,MAAM,CAAC,WAAW,EAAE,0BAA0B,CAAC;SAC/C,MAAM,CAAC,eAAe,EAAE,qCAAqC,CAAC;SAC9D,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7B,IAAI,CAAC;YACD,MAAM,cAAc,CAAC,QAAQ,CAAC;gBAC1B,KAAK;gBACL,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,UAAU,EAAE,OAAO,CAAC,UAAU;aACjC,CAAC,CAAC;QACP,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBACzB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,GAAG,iBAAO,CAAC,KAAK,WAAW,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACzE,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,GAAG,iBAAO,CAAC,KAAK,4BAA4B,CAAC,CAAC,CAAC;YAC3E,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACL,CAAC,CAAC,CAAC;AACX,CAAC"}
|
package/dist/commands/process.js
DELETED
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.registerProcessCommands = registerProcessCommands;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const figures_1 = __importDefault(require("figures"));
|
|
9
|
-
const chokidar_1 = require("chokidar");
|
|
10
|
-
const process_manager_js_1 = require("../process-manager.js");
|
|
11
|
-
function registerProcessCommands(program) {
|
|
12
|
-
// Start process command
|
|
13
|
-
program
|
|
14
|
-
.command('startx <command>')
|
|
15
|
-
.description('Start a process with monitoring and auto-restart')
|
|
16
|
-
.option('-n, --name <name>', 'Process name')
|
|
17
|
-
.option('-w, --watch', 'Watch for file changes and auto-restart')
|
|
18
|
-
.option('-r, --max-restarts <number>', 'Maximum number of restart attempts', '5')
|
|
19
|
-
.option('-d, --restart-delay <number>', 'Delay between restarts in milliseconds', '1000')
|
|
20
|
-
.option('-c, --cwd <path>', 'Working directory for the process')
|
|
21
|
-
.action(async (command, options) => {
|
|
22
|
-
try {
|
|
23
|
-
const process = await process_manager_js_1.processManager.startx(command, {
|
|
24
|
-
name: options.name,
|
|
25
|
-
watch: options.watch,
|
|
26
|
-
maxRestarts: parseInt(options.maxRestarts),
|
|
27
|
-
restartDelay: parseInt(options.restartDelay),
|
|
28
|
-
cwd: options.cwd
|
|
29
|
-
});
|
|
30
|
-
console.log(chalk_1.default.green(`${figures_1.default.tick} Process started successfully`));
|
|
31
|
-
console.log(chalk_1.default.blue(`Name: ${process.name}`));
|
|
32
|
-
console.log(chalk_1.default.blue(`PID: ${process.pid}`));
|
|
33
|
-
console.log(chalk_1.default.blue(`Command: ${process.command}`));
|
|
34
|
-
console.log(chalk_1.default.blue(`Max Restarts: ${process.maxRestarts}`));
|
|
35
|
-
console.log(chalk_1.default.blue(`Restart Delay: ${process.restartDelay}ms`));
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
if (error instanceof Error) {
|
|
39
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
43
|
-
}
|
|
44
|
-
process.exit(1);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
// Stop process command
|
|
48
|
-
program
|
|
49
|
-
.command('stopx <name>')
|
|
50
|
-
.description('Stop a running process')
|
|
51
|
-
.option('-f, --force', 'Force stop the process')
|
|
52
|
-
.action(async (name, options) => {
|
|
53
|
-
try {
|
|
54
|
-
await process_manager_js_1.processManager.stopx(name);
|
|
55
|
-
console.log(chalk_1.default.green(`${figures_1.default.tick} Process stopped successfully`));
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
if (error instanceof Error) {
|
|
59
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
63
|
-
}
|
|
64
|
-
process.exit(1);
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
// List processes command
|
|
68
|
-
program
|
|
69
|
-
.command('list')
|
|
70
|
-
.description('List all running processes')
|
|
71
|
-
.option('-a, --all', 'Show all processes including stopped ones')
|
|
72
|
-
.option('-j, --json', 'Output in JSON format')
|
|
73
|
-
.action((options) => {
|
|
74
|
-
try {
|
|
75
|
-
if (options.json) {
|
|
76
|
-
const processes = Array.from(process_manager_js_1.processManager.list());
|
|
77
|
-
console.log(JSON.stringify(processes, null, 2));
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
console.log(process_manager_js_1.processManager.list());
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
if (error instanceof Error) {
|
|
84
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
88
|
-
}
|
|
89
|
-
process.exit(1);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
// Monitor process command
|
|
93
|
-
program
|
|
94
|
-
.command('monit <name>')
|
|
95
|
-
.description('Monitor a process in real-time')
|
|
96
|
-
.option('-i, --interval <number>', 'Update interval in milliseconds', '1000')
|
|
97
|
-
.action((name, options) => {
|
|
98
|
-
try {
|
|
99
|
-
const interval = parseInt(options.interval);
|
|
100
|
-
if (isNaN(interval) || interval < 100) {
|
|
101
|
-
throw new Error('Interval must be a number greater than 100ms');
|
|
102
|
-
}
|
|
103
|
-
// Start real-time monitoring
|
|
104
|
-
const updateDisplay = () => {
|
|
105
|
-
try {
|
|
106
|
-
const { table, logs } = process_manager_js_1.processManager.monit(name);
|
|
107
|
-
process.stdout.write('\x1Bc'); // Clear screen
|
|
108
|
-
console.log(table);
|
|
109
|
-
console.log(chalk_1.default.blue('\nRecent Logs:'));
|
|
110
|
-
logs.forEach(log => {
|
|
111
|
-
if (log.includes('error') || log.includes('Error')) {
|
|
112
|
-
console.log(chalk_1.default.red(log));
|
|
113
|
-
}
|
|
114
|
-
else if (log.includes('warn') || log.includes('Warn')) {
|
|
115
|
-
console.log(chalk_1.default.yellow(log));
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
console.log(log);
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
catch (error) {
|
|
123
|
-
clearInterval(monitorInterval);
|
|
124
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error monitoring process: ${error}`));
|
|
125
|
-
process.exit(1);
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
const monitorInterval = setInterval(updateDisplay, interval);
|
|
129
|
-
updateDisplay(); // Initial display
|
|
130
|
-
process.on('SIGINT', () => {
|
|
131
|
-
clearInterval(monitorInterval);
|
|
132
|
-
process.exit(0);
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
catch (error) {
|
|
136
|
-
if (error instanceof Error) {
|
|
137
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
141
|
-
}
|
|
142
|
-
process.exit(1);
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
// View logs command
|
|
146
|
-
program
|
|
147
|
-
.command('log <name>')
|
|
148
|
-
.description('View process logs')
|
|
149
|
-
.option('-f, --follow', 'Follow log output')
|
|
150
|
-
.option('-e, --errors', 'Show only errors')
|
|
151
|
-
.option('-w, --warnings', 'Show only warnings')
|
|
152
|
-
.option('-l, --lines <number>', 'Number of lines to show', '100')
|
|
153
|
-
.action((name, options) => {
|
|
154
|
-
try {
|
|
155
|
-
const lines = parseInt(options.lines);
|
|
156
|
-
if (isNaN(lines) || lines < 1) {
|
|
157
|
-
throw new Error('Lines must be a positive number');
|
|
158
|
-
}
|
|
159
|
-
const logs = process_manager_js_1.processManager.log(name, lines);
|
|
160
|
-
let filteredLogs = logs;
|
|
161
|
-
if (options.errors) {
|
|
162
|
-
filteredLogs = logs.filter(log => log.toLowerCase().includes('error') ||
|
|
163
|
-
log.toLowerCase().includes('exception'));
|
|
164
|
-
}
|
|
165
|
-
else if (options.warnings) {
|
|
166
|
-
filteredLogs = logs.filter(log => log.toLowerCase().includes('warn') ||
|
|
167
|
-
log.toLowerCase().includes('warning'));
|
|
168
|
-
}
|
|
169
|
-
filteredLogs.forEach(log => {
|
|
170
|
-
if (log.includes('error') || log.includes('Error')) {
|
|
171
|
-
console.log(chalk_1.default.red(log));
|
|
172
|
-
}
|
|
173
|
-
else if (log.includes('warn') || log.includes('Warn')) {
|
|
174
|
-
console.log(chalk_1.default.yellow(log));
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
console.log(log);
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
if (options.follow) {
|
|
181
|
-
const watcher = (0, chokidar_1.watch)(process_manager_js_1.processManager.getLogPath(name), {
|
|
182
|
-
persistent: true
|
|
183
|
-
});
|
|
184
|
-
watcher.on('change', () => {
|
|
185
|
-
const newLogs = process_manager_js_1.processManager.log(name, 1);
|
|
186
|
-
if (newLogs.length > 0) {
|
|
187
|
-
const log = newLogs[0];
|
|
188
|
-
if (log.includes('error') || log.includes('Error')) {
|
|
189
|
-
console.log(chalk_1.default.red(log));
|
|
190
|
-
}
|
|
191
|
-
else if (log.includes('warn') || log.includes('Warn')) {
|
|
192
|
-
console.log(chalk_1.default.yellow(log));
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
console.log(log);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
process.on('SIGINT', () => {
|
|
200
|
-
watcher.close();
|
|
201
|
-
process.exit(0);
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
catch (error) {
|
|
206
|
-
if (error instanceof Error) {
|
|
207
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
211
|
-
}
|
|
212
|
-
process.exit(1);
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
//# sourceMappingURL=process.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/commands/process.ts"],"names":[],"mappings":";;;;;AAMA,0DA4MC;AAjND,kDAA0B;AAC1B,sDAA8B;AAC9B,uCAAiC;AACjC,8DAAuD;AAEvD,SAAgB,uBAAuB,CAAC,OAAgB;IACpD,wBAAwB;IACxB,OAAO;SACF,OAAO,CAAC,kBAAkB,CAAC;SAC3B,WAAW,CAAC,kDAAkD,CAAC;SAC/D,MAAM,CAAC,mBAAmB,EAAE,cAAc,CAAC;SAC3C,MAAM,CAAC,aAAa,EAAE,yCAAyC,CAAC;SAChE,MAAM,CAAC,6BAA6B,EAAE,oCAAoC,EAAE,GAAG,CAAC;SAChF,MAAM,CAAC,8BAA8B,EAAE,wCAAwC,EAAE,MAAM,CAAC;SACxF,MAAM,CAAC,kBAAkB,EAAE,mCA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,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACzE,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,GAAG,iBAAO,CAAC,KAAK,4BAA4B,CAAC,CAAC,CAAC;YAC3E,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACL,CAAC,CAAC,CAAC;AACX,CAAC"}
|
package/dist/commands/run.d.ts
DELETED
package/dist/commands/run.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.registerRunCommands = registerRunCommands;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const figures_1 = __importDefault(require("figures"));
|
|
9
|
-
const index_js_1 = require("../index.js");
|
|
10
|
-
function registerRunCommands(program) {
|
|
11
|
-
// Sequential execution command
|
|
12
|
-
program
|
|
13
|
-
.command('sequential <commands...>')
|
|
14
|
-
.alias('s')
|
|
15
|
-
.description('Run commands sequentially')
|
|
16
|
-
.option('-c, --no-color', 'Disable colored output')
|
|
17
|
-
.option('-t, --no-timing', 'Hide timing information')
|
|
18
|
-
.option('-p, --no-prefix', 'Hide command prefix')
|
|
19
|
-
.option('-s, --stop-on-error', 'Stop on first error')
|
|
20
|
-
.option('-o, --no-output', 'Hide command output')
|
|
21
|
-
.option('-m, --minimal', 'Use minimal output format')
|
|
22
|
-
.action(async (commands, options) => {
|
|
23
|
-
try {
|
|
24
|
-
await (0, index_js_1.run)(commands, {
|
|
25
|
-
parallel: false,
|
|
26
|
-
color: options.color,
|
|
27
|
-
showTiming: options.timing,
|
|
28
|
-
prefix: options.prefix,
|
|
29
|
-
stopOnError: options.stopOnError,
|
|
30
|
-
printOutput: options.output,
|
|
31
|
-
minimalOutput: options.minimal
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
if (error instanceof Error) {
|
|
36
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
40
|
-
}
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
// Parallel execution command
|
|
45
|
-
program
|
|
46
|
-
.command('parallel <commands...>', { isDefault: true })
|
|
47
|
-
.alias('p')
|
|
48
|
-
.description('Run commands in parallel (default) or sequentially with -q. Alias: p')
|
|
49
|
-
.option('-c, --no-color', 'Disable colored output')
|
|
50
|
-
.option('-t, --no-timing', 'Hide timing information')
|
|
51
|
-
.option('-p, --no-prefix', 'Hide command prefix')
|
|
52
|
-
.option('-s, --stop-on-error', 'Stop on first error')
|
|
53
|
-
.option('-o, --no-output', 'Hide command output')
|
|
54
|
-
.option('-m, --minimal', 'Use minimal output format')
|
|
55
|
-
.option('-x, --max-parallel <number>', 'Maximum number of parallel processes', parseInt)
|
|
56
|
-
.option('-q, --sequential', 'Run commands sequentially instead of in parallel')
|
|
57
|
-
.action(async (commands, options) => {
|
|
58
|
-
try {
|
|
59
|
-
await (0, index_js_1.run)(commands, {
|
|
60
|
-
parallel: !options.sequential,
|
|
61
|
-
maxParallel: options.maxParallel,
|
|
62
|
-
color: options.color,
|
|
63
|
-
showTiming: options.timing,
|
|
64
|
-
prefix: options.prefix,
|
|
65
|
-
stopOnError: options.stopOnError,
|
|
66
|
-
printOutput: options.output,
|
|
67
|
-
minimalOutput: options.minimal
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
if (error instanceof Error) {
|
|
72
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
76
|
-
}
|
|
77
|
-
process.exit(1);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
//# sourceMappingURL=run.js.map
|
package/dist/commands/run.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":";;;;;AAKA,kDAmEC;AAvED,kDAA0B;AAC1B,sDAA8B;AAC9B,0CAAkC;AAElC,SAAgB,mBAAmB,CAAC,OAAgB;IAChD,+BAA+B;IAC/B,OAAO;SACF,OAAO,CAAC,0BAA0B,CAAC;SACnC,KAAK,CAAC,GAAG,CAAC;SACV,WAAW,CAAC,2BAA2B,CAAC;SACxC,MAAM,CAAC,gBAAgB,EAAE,wBAAwB,CAAC;SAClD,MAAM,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;SACpD,MAAM,CAAC,iBAAiB,EAAE,qBAAqB,CAAC;SAChD,MAAM,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;SACpD,MAAM,CAAC,iBAAiB,EAAE,qBAAqB,CAAC;SAChD,MAAM,CAAC,eAAe,EAAE,2BAA2B,CAAC;SACpD,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;QAChC,IAAI,CAAC;YACD,MAAM,IAAA,cAAG,EAAC,QAAQ,EAAE;gBAChB,QAAQ,EAAE,KAAK;gBACf,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,MAAM;gBAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,WAAW,EAAE,OAAO,CAAC,WAAW;gBAChC,WAAW,EAAE,OAAO,CAAC,MAAM;gBAC3B,aAAa,EAAE,OAAO,CAAC,OAAO;aACjC,CAAC,CAAC;QACP,CAAC;QAAC,OAAO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C,MAAM;gBAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,WAAW,EAAE,OAAO,CAAC,WAAW;gBAChC,WAAW,EAAE,OAAO,CAAC,MAAM;gBAC3B,aAAa,EAAE,OAAO,CAAC,OAAO;aACjC,CAAC,CAAC;QACP,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACtB,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBACzB,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,GAAG,iBAAO,CAAC,KAAK,WAAW,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACzE,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,GAAG,iBAAO,CAAC,KAAK,4BAA4B,CAAC,CAAC,CAAC;YAC3E,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,CAAC;IACL,CAAC,CAAC,CAAC;AACX,CAAC"}
|
package/dist/commands/start.d.ts
DELETED
package/dist/commands/start.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.registerStartCommand = registerStartCommand;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const figures_1 = __importDefault(require("figures"));
|
|
9
|
-
function registerStartCommand(program, projectManager) {
|
|
10
|
-
program
|
|
11
|
-
.command('start')
|
|
12
|
-
.description('Start the built application in production mode with health monitoring')
|
|
13
|
-
.option('-p, --port <number>', 'Port to run the server on', '3000')
|
|
14
|
-
.option('-o, --outDir <dir>', 'Output directory', 'dist')
|
|
15
|
-
.option('-e, --entry <file>', 'Entry file name', 'server.js')
|
|
16
|
-
.option('-i, --inspect', 'Enable Node.js inspector')
|
|
17
|
-
.option('-c, --cluster', 'Run in cluster mode')
|
|
18
|
-
.option('-w, --workers <number>', 'Number of worker processes', '0')
|
|
19
|
-
.option('--max-memory <size>', 'Maximum memory per process (e.g., 1024M)')
|
|
20
|
-
.option('--health-check', 'Enable health check endpoint')
|
|
21
|
-
.action(async (options) => {
|
|
22
|
-
try {
|
|
23
|
-
await projectManager.start({
|
|
24
|
-
port: options.port,
|
|
25
|
-
outDir: options.outDir,
|
|
26
|
-
entry: options.entry,
|
|
27
|
-
inspect: options.inspect,
|
|
28
|
-
cluster: options.cluster,
|
|
29
|
-
workers: options.workers,
|
|
30
|
-
maxMemory: options.maxMemory,
|
|
31
|
-
healthCheck: options.healthCheck
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
if (error instanceof Error) {
|
|
36
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error: ${error.message}`));
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} An unknown error occurred`));
|
|
40
|
-
}
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=start.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":";;;;;AAKA,oDAiCC;AArCD,kDAA0B;AAC1B,sDAA8B;AAG9B,SAAgB,oBAAoB,CAAC,OAAgB,EAAE,cAA8B;IACjF,OAAO;SACF,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,uEAAuE,CAAC;SACpF,MAAM,CAAC,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,CAAC;SAClE,MAAM,CAAC,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,CAAC;SACxD,MAAM,CAAC,oBAAoB,EAAE,iBAAiB,EAAE,WAAW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|
3
|
-
interface DevOptions {
|
|
4
|
-
entry: string;
|
|
5
|
-
outdir?: string;
|
|
6
|
-
watch?: boolean;
|
|
7
|
-
port?: number;
|
|
8
|
-
env?: Record<string, string>;
|
|
9
|
-
sourcemap?: boolean;
|
|
10
|
-
minify?: boolean;
|
|
11
|
-
target?: string[];
|
|
12
|
-
format?: 'cjs' | 'esm' | 'iife';
|
|
13
|
-
}
|
|
14
|
-
interface BuildResult {
|
|
15
|
-
success: boolean;
|
|
16
|
-
outputPath?: string;
|
|
17
|
-
error?: Error;
|
|
18
|
-
}
|
|
19
|
-
declare class DevManager extends EventEmitter {
|
|
20
|
-
private watcher;
|
|
21
|
-
private process;
|
|
22
|
-
private isRestarting;
|
|
23
|
-
private restartTimer;
|
|
24
|
-
private defaultOutDir;
|
|
25
|
-
private defaultPort;
|
|
26
|
-
constructor();
|
|
27
|
-
build(options: DevOptions): Promise<BuildResult>;
|
|
28
|
-
private startProcess;
|
|
29
|
-
private setupWatcher;
|
|
30
|
-
dev(options: DevOptions): Promise<void>;
|
|
31
|
-
start(options: DevOptions): Promise<void>;
|
|
32
|
-
stop(): void;
|
|
33
|
-
}
|
|
34
|
-
export declare const devManager: DevManager;
|
|
35
|
-
export {};
|
package/dist/dev-manager.js
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.devManager = void 0;
|
|
7
|
-
const esbuild_1 = require("esbuild");
|
|
8
|
-
const chokidar_1 = require("chokidar");
|
|
9
|
-
const child_process_1 = require("child_process");
|
|
10
|
-
const path_1 = require("path");
|
|
11
|
-
const fs_1 = require("fs");
|
|
12
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
13
|
-
const figures_1 = __importDefault(require("figures"));
|
|
14
|
-
const events_1 = require("events");
|
|
15
|
-
class DevManager extends events_1.EventEmitter {
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
this.watcher = null;
|
|
19
|
-
this.process = null;
|
|
20
|
-
this.isRestarting = false;
|
|
21
|
-
this.restartTimer = null;
|
|
22
|
-
this.defaultOutDir = 'dist';
|
|
23
|
-
this.defaultPort = 8000;
|
|
24
|
-
}
|
|
25
|
-
async build(options) {
|
|
26
|
-
const outdir = options.outdir || this.defaultOutDir;
|
|
27
|
-
const outfile = (0, path_1.resolve)(outdir, `${(0, path_1.basename)(options.entry, '.ts')}.js`);
|
|
28
|
-
try {
|
|
29
|
-
if (!(0, fs_1.existsSync)(outdir)) {
|
|
30
|
-
(0, fs_1.mkdirSync)(outdir, { recursive: true });
|
|
31
|
-
}
|
|
32
|
-
const buildOptions = {
|
|
33
|
-
entryPoints: [options.entry],
|
|
34
|
-
outfile,
|
|
35
|
-
bundle: true,
|
|
36
|
-
platform: 'node',
|
|
37
|
-
target: options.target || ['node18'],
|
|
38
|
-
format: options.format || 'cjs',
|
|
39
|
-
sourcemap: options.sourcemap ?? true,
|
|
40
|
-
minify: options.minify ?? false,
|
|
41
|
-
define: {
|
|
42
|
-
'process.env.NODE_ENV': '"development"',
|
|
43
|
-
...Object.entries(options.env || {}).reduce((acc, [key, value]) => ({
|
|
44
|
-
...acc,
|
|
45
|
-
[`process.env.${key}`]: JSON.stringify(value)
|
|
46
|
-
}), {})
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
await (0, esbuild_1.build)(buildOptions);
|
|
50
|
-
return { success: true, outputPath: outfile };
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
return { success: false, error: error };
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
startProcess(outputPath, options) {
|
|
57
|
-
if (this.process) {
|
|
58
|
-
this.process.kill();
|
|
59
|
-
}
|
|
60
|
-
this.process = (0, child_process_1.spawn)('node', [outputPath], {
|
|
61
|
-
stdio: 'inherit',
|
|
62
|
-
env: {
|
|
63
|
-
...process.env,
|
|
64
|
-
PORT: options.port?.toString() || this.defaultPort.toString(),
|
|
65
|
-
NODE_ENV: 'development',
|
|
66
|
-
...options.env
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
this.process.on('error', (err) => {
|
|
70
|
-
this.emit('error', err);
|
|
71
|
-
});
|
|
72
|
-
this.process.on('exit', (code) => {
|
|
73
|
-
if (code !== 0 && !this.isRestarting) {
|
|
74
|
-
this.emit('error', new Error(`Process exited with code ${code}`));
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
setupWatcher(options) {
|
|
79
|
-
if (this.watcher) {
|
|
80
|
-
this.watcher.close();
|
|
81
|
-
}
|
|
82
|
-
const watchPaths = [
|
|
83
|
-
options.entry,
|
|
84
|
-
(0, path_1.dirname)(options.entry)
|
|
85
|
-
];
|
|
86
|
-
this.watcher = (0, chokidar_1.watch)(watchPaths, {
|
|
87
|
-
ignored: /(^|[\/\\])\../,
|
|
88
|
-
persistent: true
|
|
89
|
-
});
|
|
90
|
-
this.watcher.on('change', async (path) => {
|
|
91
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} File changed: ${path}`));
|
|
92
|
-
if (this.restartTimer) {
|
|
93
|
-
clearTimeout(this.restartTimer);
|
|
94
|
-
}
|
|
95
|
-
this.isRestarting = true;
|
|
96
|
-
this.restartTimer = setTimeout(async () => {
|
|
97
|
-
try {
|
|
98
|
-
const result = await this.build(options);
|
|
99
|
-
if (result.success && result.outputPath) {
|
|
100
|
-
this.startProcess(result.outputPath, options);
|
|
101
|
-
console.log(chalk_1.default.green(`${figures_1.default.tick} Restarted successfully`));
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Build failed: ${result.error?.message}`));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
catch (error) {
|
|
108
|
-
console.error(chalk_1.default.red(`${figures_1.default.cross} Error during restart: ${error}`));
|
|
109
|
-
}
|
|
110
|
-
finally {
|
|
111
|
-
this.isRestarting = false;
|
|
112
|
-
}
|
|
113
|
-
}, 1000);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
async dev(options) {
|
|
117
|
-
try {
|
|
118
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} Starting development server...`));
|
|
119
|
-
const result = await this.build(options);
|
|
120
|
-
if (!result.success || !result.outputPath) {
|
|
121
|
-
throw new Error(`Build failed: ${result.error?.message}`);
|
|
122
|
-
}
|
|
123
|
-
this.startProcess(result.outputPath, options);
|
|
124
|
-
if (options.watch) {
|
|
125
|
-
this.setupWatcher(options);
|
|
126
|
-
}
|
|
127
|
-
this.emit('start', { outputPath: result.outputPath });
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
this.emit('error', error);
|
|
131
|
-
throw error;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
async start(options) {
|
|
135
|
-
try {
|
|
136
|
-
const result = await this.build(options);
|
|
137
|
-
if (!result.success || !result.outputPath) {
|
|
138
|
-
throw new Error(`Build failed: ${result.error?.message}`);
|
|
139
|
-
}
|
|
140
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} Starting production server...`));
|
|
141
|
-
this.startProcess(result.outputPath, {
|
|
142
|
-
...options,
|
|
143
|
-
env: {
|
|
144
|
-
...options.env,
|
|
145
|
-
NODE_ENV: 'production'
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
this.emit('start', { outputPath: result.outputPath });
|
|
149
|
-
}
|
|
150
|
-
catch (error) {
|
|
151
|
-
this.emit('error', error);
|
|
152
|
-
throw error;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
stop() {
|
|
156
|
-
if (this.process) {
|
|
157
|
-
this.process.kill();
|
|
158
|
-
this.process = null;
|
|
159
|
-
}
|
|
160
|
-
if (this.watcher) {
|
|
161
|
-
this.watcher.close();
|
|
162
|
-
this.watcher = null;
|
|
163
|
-
}
|
|
164
|
-
if (this.restartTimer) {
|
|
165
|
-
clearTimeout(this.restartTimer);
|
|
166
|
-
this.restartTimer = null;
|
|
167
|
-
}
|
|
168
|
-
this.emit('stop');
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
exports.devManager = new DevManager();
|
|
172
|
-
//# sourceMappingURL=dev-manager.js.map
|