neex 0.6.91 → 0.6.92
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.
|
@@ -352,7 +352,7 @@ class BuildManager {
|
|
|
352
352
|
}
|
|
353
353
|
async stop() {
|
|
354
354
|
if (!this.options.quiet) {
|
|
355
|
-
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.yellow(
|
|
355
|
+
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.yellow('⏹')} Stopping build process...`, 'info');
|
|
356
356
|
}
|
|
357
357
|
if (this.watcher) {
|
|
358
358
|
await this.watcher.close();
|
|
@@ -360,7 +360,7 @@ class BuildManager {
|
|
|
360
360
|
}
|
|
361
361
|
await this.stopProcess();
|
|
362
362
|
if (this.buildCount > 0 && !this.options.quiet) {
|
|
363
|
-
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.blue(
|
|
363
|
+
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.blue('ℹ')} Build process stopped after ${this.buildCount} build(s).`, 'info');
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
}
|
|
@@ -48,6 +48,20 @@ function addBuildCommands(program) {
|
|
|
48
48
|
color: options.color,
|
|
49
49
|
analyze: options.analyze
|
|
50
50
|
});
|
|
51
|
+
// --- Signal Handlers for Build ---
|
|
52
|
+
const cleanupAndExit = (signal) => {
|
|
53
|
+
if (buildManager) {
|
|
54
|
+
logger_manager_js_1.loggerManager.printLine(`\n${chalk_1.default.yellow('⏹')} Received ${signal}, shutting down...`, 'info');
|
|
55
|
+
buildManager.stop().then(() => process.exit(0));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const sigintHandler = () => cleanupAndExit('SIGINT');
|
|
62
|
+
const sigtermHandler = () => cleanupAndExit('SIGTERM');
|
|
63
|
+
process.on('SIGINT', sigintHandler);
|
|
64
|
+
process.on('SIGTERM', sigtermHandler);
|
|
51
65
|
await buildManager.build();
|
|
52
66
|
// If not in watch mode, show completion message
|
|
53
67
|
if (!options.watch && !options.quiet) {
|
|
@@ -103,40 +117,8 @@ function addBuildCommands(program) {
|
|
|
103
117
|
process.exit(1);
|
|
104
118
|
}
|
|
105
119
|
});
|
|
106
|
-
// Cleanup function
|
|
107
|
-
const cleanupBuild = async () => {
|
|
108
|
-
if (buildManager) {
|
|
109
|
-
try {
|
|
110
|
-
await buildManager.stop();
|
|
111
|
-
buildManager = null;
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
// Ignore cleanup errors
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
// Handle process termination
|
|
119
|
-
const handleExit = (signal) => {
|
|
120
|
-
if (buildManager) {
|
|
121
|
-
logger_manager_js_1.loggerManager.printLine(`\n${chalk_1.default.yellow(figures_1.default.warning)} Received ${signal}, stopping build process...`, 'info');
|
|
122
|
-
cleanupBuild().then(() => {
|
|
123
|
-
process.exit(0);
|
|
124
|
-
}).catch(() => {
|
|
125
|
-
process.exit(1);
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
process.exit(0);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
// Register signal handlers
|
|
133
|
-
process.on('SIGINT', () => handleExit('SIGINT'));
|
|
134
|
-
process.on('SIGTERM', () => handleExit('SIGTERM'));
|
|
135
|
-
process.on('exit', () => {
|
|
136
|
-
if (buildManager) {
|
|
137
|
-
cleanupBuild();
|
|
138
|
-
}
|
|
139
|
-
});
|
|
120
|
+
// Cleanup function is no longer needed here as it's handled within the command
|
|
121
|
+
const cleanupBuild = async () => { };
|
|
140
122
|
return { cleanupBuild };
|
|
141
123
|
}
|
|
142
124
|
exports.addBuildCommands = addBuildCommands;
|
|
@@ -57,6 +57,17 @@ function addDevCommands(program) {
|
|
|
57
57
|
transpileOnly: options.transpileOnly,
|
|
58
58
|
nodeArgs: options.nodeArgs ? options.nodeArgs.split(',').map((arg) => arg.trim()) : []
|
|
59
59
|
});
|
|
60
|
+
// --- Signal Handlers for Dev ---
|
|
61
|
+
const cleanupAndExit = () => {
|
|
62
|
+
if (devManager) {
|
|
63
|
+
logger_manager_js_1.loggerManager.printLine(`\n${chalk_1.default.yellow('⏹')} Received SIGINT, shutting down...`, 'info');
|
|
64
|
+
devManager.stop().then(() => process.exit(0));
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const sigintHandler = () => cleanupAndExit();
|
|
68
|
+
const sigtermHandler = () => cleanupAndExit();
|
|
69
|
+
process.on('SIGINT', sigintHandler);
|
|
70
|
+
process.on('SIGTERM', sigtermHandler);
|
|
60
71
|
await devManager.start();
|
|
61
72
|
}
|
|
62
73
|
catch (error) {
|
|
@@ -174,35 +185,8 @@ function addDevCommands(program) {
|
|
|
174
185
|
}
|
|
175
186
|
console.log('');
|
|
176
187
|
});
|
|
177
|
-
// Cleanup function
|
|
178
|
-
const cleanupDev = () => {
|
|
179
|
-
if (devManager) {
|
|
180
|
-
devManager.stop();
|
|
181
|
-
devManager = null;
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
// Enhanced signal handling
|
|
185
|
-
const handleSignal = (signal) => {
|
|
186
|
-
if (devManager) {
|
|
187
|
-
console.log(''); // New line for better formatting
|
|
188
|
-
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.yellow('⏹')} Received ${signal}, shutting down...`, 'info');
|
|
189
|
-
cleanupDev();
|
|
190
|
-
process.exit(0);
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
process.on('SIGINT', () => handleSignal('SIGINT'));
|
|
194
|
-
process.on('SIGTERM', () => handleSignal('SIGTERM'));
|
|
195
|
-
// Handle uncaught exceptions
|
|
196
|
-
process.on('uncaughtException', (error) => {
|
|
197
|
-
console.error(chalk_1.default.red('Uncaught Exception:'), error);
|
|
198
|
-
cleanupDev();
|
|
199
|
-
process.exit(1);
|
|
200
|
-
});
|
|
201
|
-
process.on('unhandledRejection', (reason, promise) => {
|
|
202
|
-
console.error(chalk_1.default.red('Unhandled Rejection at:'), promise, 'reason:', reason);
|
|
203
|
-
cleanupDev();
|
|
204
|
-
process.exit(1);
|
|
205
|
-
});
|
|
188
|
+
// Cleanup function is no longer needed here as it's handled within the command
|
|
189
|
+
const cleanupDev = () => { };
|
|
206
190
|
return { cleanupDev };
|
|
207
191
|
}
|
|
208
192
|
exports.addDevCommands = addDevCommands;
|
|
@@ -130,6 +130,20 @@ function addStartCommands(program) {
|
|
|
130
130
|
inspectBrk: options.inspectBrk,
|
|
131
131
|
nodeArgs: options.nodeArgs
|
|
132
132
|
});
|
|
133
|
+
// --- Signal Handlers for Start ---
|
|
134
|
+
const cleanupAndExit = (signal) => {
|
|
135
|
+
if (startManager) {
|
|
136
|
+
logger_manager_js_1.loggerManager.printLine(`\n${chalk_1.default.yellow('⏹')} Received ${signal}, shutting down...`, 'info');
|
|
137
|
+
startManager.stop().then(() => process.exit(0));
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
process.exit(0);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
const sigintHandler = () => cleanupAndExit('SIGINT');
|
|
144
|
+
const sigtermHandler = () => cleanupAndExit('SIGTERM');
|
|
145
|
+
process.on('SIGINT', sigintHandler);
|
|
146
|
+
process.on('SIGTERM', sigtermHandler);
|
|
133
147
|
await startManager.start();
|
|
134
148
|
}
|
|
135
149
|
catch (error) {
|
|
@@ -142,49 +156,8 @@ function addStartCommands(program) {
|
|
|
142
156
|
process.exit(1);
|
|
143
157
|
}
|
|
144
158
|
});
|
|
145
|
-
// Cleanup function
|
|
146
|
-
const cleanupStart = async () => {
|
|
147
|
-
if (startManager) {
|
|
148
|
-
try {
|
|
149
|
-
await startManager.stop();
|
|
150
|
-
startManager = null;
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
if (process.env.VERBOSE) {
|
|
154
|
-
console.error('Cleanup error:', error);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
// Signal handling
|
|
160
|
-
const handleExit = (signal) => {
|
|
161
|
-
if (startManager) {
|
|
162
|
-
console.log(`\n${chalk_1.default.yellow(figures_1.default.warning)} Received ${signal}, shutting down gracefully...`);
|
|
163
|
-
cleanupStart().then(() => {
|
|
164
|
-
process.exit(0);
|
|
165
|
-
}).catch(() => {
|
|
166
|
-
process.exit(1);
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
process.exit(0);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
process.on('SIGINT', () => handleExit('SIGINT'));
|
|
174
|
-
process.on('SIGTERM', () => handleExit('SIGTERM'));
|
|
175
|
-
process.on('SIGUSR2', () => handleExit('SIGUSR2'));
|
|
176
|
-
process.on('uncaughtException', (error) => {
|
|
177
|
-
console.error(`${chalk_1.default.red(figures_1.default.cross)} Uncaught Exception:`, error);
|
|
178
|
-
cleanupStart().then(() => {
|
|
179
|
-
process.exit(1);
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
process.on('unhandledRejection', (reason, promise) => {
|
|
183
|
-
console.error(`${chalk_1.default.red(figures_1.default.cross)} Unhandled Rejection at:`, promise, 'reason:', reason);
|
|
184
|
-
cleanupStart().then(() => {
|
|
185
|
-
process.exit(1);
|
|
186
|
-
});
|
|
187
|
-
});
|
|
159
|
+
// Cleanup function is no longer needed here as it's handled within the command
|
|
160
|
+
const cleanupStart = async () => { };
|
|
188
161
|
return { cleanupStart };
|
|
189
162
|
}
|
|
190
163
|
exports.addStartCommands = addStartCommands;
|
package/dist/src/dev-manager.js
CHANGED
|
@@ -290,10 +290,6 @@ class DevManager {
|
|
|
290
290
|
});
|
|
291
291
|
this.startTime = new Date();
|
|
292
292
|
this.restartCount++;
|
|
293
|
-
if (!this.options.quiet) {
|
|
294
|
-
const fileRelative = path_1.default.relative(process.cwd(), this.options.file);
|
|
295
|
-
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.green('▶')} Started ${chalk_1.default.cyan(fileRelative)}`, 'info');
|
|
296
|
-
}
|
|
297
293
|
// Handle stdout/stderr
|
|
298
294
|
(_a = this.process.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
|
|
299
295
|
process.stdout.write(data);
|
|
@@ -442,7 +442,7 @@ class StartManager {
|
|
|
442
442
|
if (this.isShuttingDown)
|
|
443
443
|
return;
|
|
444
444
|
this.isShuttingDown = true;
|
|
445
|
-
this.log('Shutting down gracefully
|
|
445
|
+
this.log(`${chalk_1.default.yellow('⏹')} Shutting down gracefully...`);
|
|
446
446
|
if (this.watcher) {
|
|
447
447
|
await this.watcher.close();
|
|
448
448
|
}
|
|
@@ -474,7 +474,7 @@ class StartManager {
|
|
|
474
474
|
}
|
|
475
475
|
await Promise.allSettled(shutdownPromises);
|
|
476
476
|
this.workers.clear();
|
|
477
|
-
this.log('Server stopped
|
|
477
|
+
this.log(`${chalk_1.default.green('⏹')} Server stopped.`);
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
480
|
exports.StartManager = StartManager;
|