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