neex 0.6.91 → 0.6.93
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.
|
@@ -110,7 +110,7 @@ class BuildManager {
|
|
|
110
110
|
const startTime = Date.now();
|
|
111
111
|
if (!this.options.quiet) {
|
|
112
112
|
const buildNumber = this.options.watch ? ` #${this.buildCount}` : '';
|
|
113
|
-
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.
|
|
113
|
+
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.green(figures_1.default.play)} Building${buildNumber}...`, 'info');
|
|
114
114
|
}
|
|
115
115
|
try {
|
|
116
116
|
await this.ensureOutputDirectory();
|
|
@@ -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
|
}
|
|
@@ -29,7 +29,7 @@ function addBuildCommands(program) {
|
|
|
29
29
|
try {
|
|
30
30
|
const sourceDir = source || 'src';
|
|
31
31
|
if (!options.quiet) {
|
|
32
|
-
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.
|
|
32
|
+
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.green(figures_1.default.play)} Building TypeScript project from ${chalk_1.default.cyan(sourceDir)}`, 'info');
|
|
33
33
|
}
|
|
34
34
|
buildManager = new build_manager_js_1.BuildManager({
|
|
35
35
|
source: sourceDir,
|
|
@@ -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;
|
|
@@ -7,6 +7,7 @@ exports.addDevCommands = void 0;
|
|
|
7
7
|
const dev_manager_js_1 = require("../dev-manager.js");
|
|
8
8
|
const logger_manager_js_1 = require("../logger-manager.js");
|
|
9
9
|
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const figures_1 = __importDefault(require("figures"));
|
|
10
11
|
function addDevCommands(program) {
|
|
11
12
|
let devManager = null;
|
|
12
13
|
// Ultra-fast dev command optimized for speed
|
|
@@ -36,7 +37,7 @@ function addDevCommands(program) {
|
|
|
36
37
|
const delay = options.fast ? 50 : options.delay;
|
|
37
38
|
if (!options.quiet) {
|
|
38
39
|
console.log(''); // Empty line for better visual separation
|
|
39
|
-
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.
|
|
40
|
+
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.green(figures_1.default.play)} Starting ${chalk_1.default.cyan('neex dev')} for ${chalk_1.default.cyan(targetFile)}`, 'info');
|
|
40
41
|
}
|
|
41
42
|
devManager = new dev_manager_js_1.DevManager({
|
|
42
43
|
file: targetFile,
|
|
@@ -57,6 +58,20 @@ function addDevCommands(program) {
|
|
|
57
58
|
transpileOnly: options.transpileOnly,
|
|
58
59
|
nodeArgs: options.nodeArgs ? options.nodeArgs.split(',').map((arg) => arg.trim()) : []
|
|
59
60
|
});
|
|
61
|
+
// --- Signal Handlers for Dev ---
|
|
62
|
+
const cleanupAndExit = () => {
|
|
63
|
+
if (devManager) {
|
|
64
|
+
logger_manager_js_1.loggerManager.printLine(`\n${chalk_1.default.yellow('⏹')} Shutting down...`, 'info');
|
|
65
|
+
devManager.stop().then(() => process.exit(0));
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
process.exit(0);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const sigintHandler = () => cleanupAndExit();
|
|
72
|
+
const sigtermHandler = () => cleanupAndExit();
|
|
73
|
+
process.on('SIGINT', sigintHandler);
|
|
74
|
+
process.on('SIGTERM', sigtermHandler);
|
|
60
75
|
await devManager.start();
|
|
61
76
|
}
|
|
62
77
|
catch (error) {
|
|
@@ -174,35 +189,8 @@ function addDevCommands(program) {
|
|
|
174
189
|
}
|
|
175
190
|
console.log('');
|
|
176
191
|
});
|
|
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
|
-
});
|
|
192
|
+
// Cleanup function is no longer needed here as it's handled within the command
|
|
193
|
+
const cleanupDev = () => { };
|
|
206
194
|
return { cleanupDev };
|
|
207
195
|
}
|
|
208
196
|
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
|
@@ -118,7 +118,7 @@ class DevManager {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
if (!this.options.quiet) {
|
|
121
|
-
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.
|
|
121
|
+
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.green(figures_1.default.play)} Loaded ${count} env variables from ${envFile}`, 'info');
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
catch (error) {
|
|
@@ -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);
|
|
@@ -421,7 +417,7 @@ class DevManager {
|
|
|
421
417
|
this.moduleCache.clear();
|
|
422
418
|
this.setupTempDir();
|
|
423
419
|
if (!this.options.quiet) {
|
|
424
|
-
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.
|
|
420
|
+
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.green(figures_1.default.play)} Starting TypeScript development server...`, 'info');
|
|
425
421
|
}
|
|
426
422
|
this.setupWatcher();
|
|
427
423
|
await this.startProcess();
|
|
@@ -438,6 +434,9 @@ class DevManager {
|
|
|
438
434
|
this.watcher = null;
|
|
439
435
|
}
|
|
440
436
|
await this.stopProcess();
|
|
437
|
+
if (!this.options.quiet) {
|
|
438
|
+
logger_manager_js_1.loggerManager.printLine(`${chalk_1.default.green('⏹')} Dev server stopped.`, 'info');
|
|
439
|
+
}
|
|
441
440
|
// Cleanup temp files
|
|
442
441
|
if (fs_1.default.existsSync(this.tempDir)) {
|
|
443
442
|
try {
|
|
@@ -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,6 @@ class StartManager {
|
|
|
474
474
|
}
|
|
475
475
|
await Promise.allSettled(shutdownPromises);
|
|
476
476
|
this.workers.clear();
|
|
477
|
-
this.log('Server stopped');
|
|
478
477
|
}
|
|
479
478
|
}
|
|
480
479
|
exports.StartManager = StartManager;
|