neex 0.6.39 → 0.6.41
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/dist/src/dev-runner.js +22 -5
- package/dist/src/logger.js +21 -13
- package/dist/src/watcher.js +1 -0
- package/package.json +1 -1
package/dist/src/dev-runner.js
CHANGED
|
@@ -68,6 +68,10 @@ class DevRunner {
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
async handleFileChange(event) {
|
|
71
|
+
const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
|
|
72
|
+
if (this.options.showInfo) {
|
|
73
|
+
logger_1.default.printLine(`${prefix} File changed: ${chalk_1.default.yellow(event.relativePath)}`, 'info');
|
|
74
|
+
}
|
|
71
75
|
if (this.options.clearConsole) {
|
|
72
76
|
console.clear();
|
|
73
77
|
}
|
|
@@ -98,6 +102,9 @@ class DevRunner {
|
|
|
98
102
|
return results;
|
|
99
103
|
}
|
|
100
104
|
catch (error) {
|
|
105
|
+
if (this.options.showInfo) {
|
|
106
|
+
logger_1.default.printLine(`Execution failed: ${error.message}`, 'error');
|
|
107
|
+
}
|
|
101
108
|
return [];
|
|
102
109
|
}
|
|
103
110
|
}
|
|
@@ -148,12 +155,16 @@ class DevRunner {
|
|
|
148
155
|
await this.fileWatcher.start();
|
|
149
156
|
}
|
|
150
157
|
// Run initial commands
|
|
158
|
+
const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
|
|
159
|
+
if (this.options.showInfo) {
|
|
160
|
+
logger_1.default.printLine(`${prefix} Starting development server...`, 'info');
|
|
161
|
+
}
|
|
151
162
|
await this.runCommands();
|
|
152
163
|
// Set up graceful shutdown
|
|
153
164
|
this.setupGracefulShutdown();
|
|
154
165
|
if (this.options.showInfo) {
|
|
155
|
-
logger_1.default.printLine(
|
|
156
|
-
logger_1.default.printLine(
|
|
166
|
+
logger_1.default.printLine(`${prefix} Development server started. Watching for changes...`, 'info');
|
|
167
|
+
logger_1.default.printLine(`${prefix} Press ${chalk_1.default.cyan('Ctrl+C')} to stop`, 'info');
|
|
157
168
|
}
|
|
158
169
|
}
|
|
159
170
|
async restart() {
|
|
@@ -161,6 +172,9 @@ class DevRunner {
|
|
|
161
172
|
if (!this.isRunning) {
|
|
162
173
|
return;
|
|
163
174
|
}
|
|
175
|
+
if (this.options.showInfo) {
|
|
176
|
+
logger_1.default.printLine(`${prefix} Restarting due to file changes...`, 'info');
|
|
177
|
+
}
|
|
164
178
|
this.restartCount++;
|
|
165
179
|
// Stop current processes
|
|
166
180
|
if (this.runner) {
|
|
@@ -172,6 +186,9 @@ class DevRunner {
|
|
|
172
186
|
this.printDevBanner();
|
|
173
187
|
// Run commands again
|
|
174
188
|
await this.runCommands();
|
|
189
|
+
if (this.options.showInfo) {
|
|
190
|
+
logger_1.default.printLine(`${prefix} Restart completed. Watching for changes...`, 'info');
|
|
191
|
+
}
|
|
175
192
|
}
|
|
176
193
|
async stop() {
|
|
177
194
|
const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
|
|
@@ -179,7 +196,7 @@ class DevRunner {
|
|
|
179
196
|
return;
|
|
180
197
|
}
|
|
181
198
|
if (this.options.showInfo) {
|
|
182
|
-
logger_1.default.printLine(
|
|
199
|
+
logger_1.default.printLine(`${prefix} Stopping development server...`, 'info');
|
|
183
200
|
}
|
|
184
201
|
this.isRunning = false;
|
|
185
202
|
// Stop file watcher
|
|
@@ -193,9 +210,9 @@ class DevRunner {
|
|
|
193
210
|
const uptime = Math.floor((Date.now() - this.startTime.getTime()) / 1000);
|
|
194
211
|
const uptimeStr = this.formatUptime(uptime);
|
|
195
212
|
if (this.options.showInfo) {
|
|
196
|
-
logger_1.default.printLine(`${this.options.runnerName} development server stopped after ${uptimeStr}`, 'info');
|
|
213
|
+
logger_1.default.printLine(`${prefix} ${this.options.runnerName} development server stopped after ${uptimeStr}`, 'info');
|
|
197
214
|
if (this.restartCount > 0) {
|
|
198
|
-
logger_1.default.printLine(
|
|
215
|
+
logger_1.default.printLine(`${prefix} Total restarts: ${this.restartCount}`, 'info');
|
|
199
216
|
}
|
|
200
217
|
}
|
|
201
218
|
}
|
package/dist/src/logger.js
CHANGED
|
@@ -76,7 +76,9 @@ class Logger {
|
|
|
76
76
|
return chalk_1.default.hex(vibrantColors[colorIndex]);
|
|
77
77
|
}
|
|
78
78
|
formatPrefix(command) {
|
|
79
|
-
|
|
79
|
+
const color = this.commandColors.get(command) || chalk_1.default.white;
|
|
80
|
+
const prefix = `${command}:`.padEnd(this.prefixLength);
|
|
81
|
+
return color(prefix);
|
|
80
82
|
}
|
|
81
83
|
bufferOutput(output) {
|
|
82
84
|
const currentBuffer = this.outputBuffer.get(output.command) || [];
|
|
@@ -89,23 +91,24 @@ class Logger {
|
|
|
89
91
|
// Stop spinner for this command if running
|
|
90
92
|
this.stopSpinner(command);
|
|
91
93
|
buffer.forEach(output => {
|
|
94
|
+
const prefix = this.formatPrefix(output.command);
|
|
92
95
|
const content = output.data.trim();
|
|
93
96
|
if (content) {
|
|
94
97
|
const lines = content.split('\n');
|
|
95
98
|
lines.forEach(line => {
|
|
96
99
|
if (line.trim()) {
|
|
97
|
-
const outputLine = `${line}`;
|
|
100
|
+
const outputLine = `${prefix} ${line}`;
|
|
98
101
|
// Show stderr in appropriate colors
|
|
99
102
|
if (output.type === 'stderr') {
|
|
100
103
|
// Not all stderr is an error, check for warning or info patterns
|
|
101
104
|
if (line.toLowerCase().includes('warn') || line.toLowerCase().includes('warning')) {
|
|
102
|
-
console.log(`${chalk_1.default.yellow(line)}`);
|
|
105
|
+
console.log(`${prefix} ${chalk_1.default.yellow(line)}`);
|
|
103
106
|
}
|
|
104
107
|
else if (line.toLowerCase().includes('error')) {
|
|
105
|
-
console.log(`${chalk_1.default.red(line)}`);
|
|
108
|
+
console.log(`${prefix} ${chalk_1.default.red(line)}`);
|
|
106
109
|
}
|
|
107
110
|
else {
|
|
108
|
-
console.log(`${line}`);
|
|
111
|
+
console.log(`${prefix} ${line}`);
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
else {
|
|
@@ -135,6 +138,7 @@ class Logger {
|
|
|
135
138
|
printStart(command) {
|
|
136
139
|
// Record start time
|
|
137
140
|
this.startTimes.set(command, new Date());
|
|
141
|
+
const prefix = this.formatPrefix(command);
|
|
138
142
|
const color = this.commandColors.get(command) || chalk_1.default.white;
|
|
139
143
|
// Stop any previous spinner for this command (e.g. if retrying)
|
|
140
144
|
this.stopSpinner(command);
|
|
@@ -142,7 +146,7 @@ class Logger {
|
|
|
142
146
|
if (this.isSpinnerActive) { // Check if any spinner was active to avoid clearing unnecessarily
|
|
143
147
|
process.stdout.write('\r' + ' '.repeat(process.stdout.columns || 80) + '\r');
|
|
144
148
|
}
|
|
145
|
-
console.log(`${color('Starting...')}`);
|
|
149
|
+
console.log(`${prefix} ${color('Starting...')}`);
|
|
146
150
|
// Start spinner for this command
|
|
147
151
|
this.startSpinner(command);
|
|
148
152
|
}
|
|
@@ -153,9 +157,10 @@ class Logger {
|
|
|
153
157
|
}
|
|
154
158
|
this.isSpinnerActive = true;
|
|
155
159
|
const color = this.commandColors.get(command) || chalk_1.default.white;
|
|
160
|
+
const prefix = this.formatPrefix(command);
|
|
156
161
|
const interval = setInterval(() => {
|
|
157
162
|
const frame = this.getSpinnerFrame();
|
|
158
|
-
process.stdout.write(`\r${color(frame)} ${chalk_1.default.dim('Running...')}`);
|
|
163
|
+
process.stdout.write(`\r${prefix} ${color(frame)} ${chalk_1.default.dim('Running...')}`);
|
|
159
164
|
}, 80);
|
|
160
165
|
this.spinnerIntervals.set(command, interval);
|
|
161
166
|
}
|
|
@@ -184,24 +189,27 @@ class Logger {
|
|
|
184
189
|
printSuccess(result) {
|
|
185
190
|
const { command, duration } = result;
|
|
186
191
|
this.stopSpinner(command);
|
|
192
|
+
const prefix = this.formatPrefix(command);
|
|
187
193
|
const color = this.commandColors.get(command) || chalk_1.default.white;
|
|
188
194
|
const durationStr = duration
|
|
189
195
|
? ` ${chalk_1.default.dim(`(${(duration / 1000).toFixed(2)}s)`)}`
|
|
190
196
|
: '';
|
|
191
|
-
console.log(`${chalk_1.default.green(figures_1.default.tick)} ${chalk_1.default.green('Completed')}${durationStr}`);
|
|
197
|
+
console.log(`${prefix} ${chalk_1.default.green(figures_1.default.tick)} ${chalk_1.default.green('Completed')}${durationStr}`);
|
|
192
198
|
}
|
|
193
199
|
printError(result) {
|
|
194
200
|
const { command, error, code, duration } = result;
|
|
195
201
|
this.stopSpinner(command);
|
|
202
|
+
const prefix = this.formatPrefix(command);
|
|
196
203
|
const durationStr = duration ? ` ${chalk_1.default.dim(`(${(duration / 1000).toFixed(2)}s)`)}` : '';
|
|
197
204
|
const errorCode = code !== null ? ` ${chalk_1.default.red(`[code: ${code}]`)}` : '';
|
|
198
|
-
console.error(`${chalk_1.default.red(figures_1.default.cross)} ${chalk_1.default.red('Failed')}${errorCode}${durationStr}`);
|
|
205
|
+
console.error(`${prefix} ${chalk_1.default.red(figures_1.default.cross)} ${chalk_1.default.red('Failed')}${errorCode}${durationStr}`);
|
|
199
206
|
if (error) {
|
|
200
|
-
console.error(`${chalk_1.default.red(error.message)}`);
|
|
207
|
+
console.error(`${prefix} ${chalk_1.default.red(error.message)}`);
|
|
201
208
|
}
|
|
202
209
|
}
|
|
203
210
|
printEnd(result, minimalOutput) {
|
|
204
211
|
this.stopSpinner(result.command);
|
|
212
|
+
const prefix = this.formatPrefix(result.command); // Corrected to formatPrefix
|
|
205
213
|
let durationDisplay = '';
|
|
206
214
|
if (result.duration !== null) {
|
|
207
215
|
// Ensure result.duration is treated as a number here
|
|
@@ -211,17 +219,17 @@ class Logger {
|
|
|
211
219
|
if (minimalOutput) {
|
|
212
220
|
if (!result.success) {
|
|
213
221
|
const status = result.code !== null ? `failed (code ${result.code})` : 'failed';
|
|
214
|
-
this.printLine(`${chalk_1.default.red(figures_1.default.cross)} ${result.command} ${status} ${duration}`, 'error');
|
|
222
|
+
this.printLine(`${prefix} ${chalk_1.default.red(figures_1.default.cross)} ${result.command} ${status} ${duration}`, 'error');
|
|
215
223
|
}
|
|
216
224
|
}
|
|
217
225
|
else {
|
|
218
226
|
if (result.success) {
|
|
219
|
-
this.printLine(`${chalk_1.default.green(figures_1.default.tick)} Command "${result.command}" finished successfully ${duration}`, 'info');
|
|
227
|
+
this.printLine(`${prefix} ${chalk_1.default.green(figures_1.default.tick)} Command "${result.command}" finished successfully ${duration}`, 'info');
|
|
220
228
|
}
|
|
221
229
|
else {
|
|
222
230
|
const errorCode = result.code !== null ? ` (code ${result.code})` : '';
|
|
223
231
|
const errorMessage = result.error ? `: ${result.error.message}` : '';
|
|
224
|
-
this.printLine(`${chalk_1.default.red(figures_1.default.cross)} Command "${result.command}" failed${errorCode}${errorMessage} ${duration}`, 'error');
|
|
232
|
+
this.printLine(`${prefix} ${chalk_1.default.red(figures_1.default.cross)} Command "${result.command}" failed${errorCode}${errorMessage} ${duration}`, 'error');
|
|
225
233
|
}
|
|
226
234
|
}
|
|
227
235
|
}
|
package/dist/src/watcher.js
CHANGED
|
@@ -188,6 +188,7 @@ class FileWatcher extends events_1.EventEmitter {
|
|
|
188
188
|
return;
|
|
189
189
|
}
|
|
190
190
|
this.isWatching = true;
|
|
191
|
+
logger_1.default.printLine('Starting file watcher...', 'info');
|
|
191
192
|
for (const watchPath of this.options.watch) {
|
|
192
193
|
const absolutePath = path.resolve(watchPath);
|
|
193
194
|
try {
|