neex 0.6.38 → 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.
@@ -32,31 +32,6 @@ const chalk_1 = __importDefault(require("chalk"));
32
32
  const figures_1 = __importDefault(require("figures"));
33
33
  const path = __importStar(require("path"));
34
34
  const fs = __importStar(require("fs/promises"));
35
- // Simple logger class - no spinners, no complex features
36
- class SimpleLogger {
37
- info(message) {
38
- console.log(chalk_1.default.blue(`${figures_1.default.info} ${message}`));
39
- }
40
- success(message) {
41
- console.log(chalk_1.default.green(`${figures_1.default.tick} ${message}`));
42
- }
43
- warning(message) {
44
- console.log(chalk_1.default.yellow(`${figures_1.default.warning} ${message}`));
45
- }
46
- error(message) {
47
- console.log(chalk_1.default.red(`${figures_1.default.cross} ${message}`));
48
- }
49
- gray(message) {
50
- console.log(chalk_1.default.gray(message));
51
- }
52
- cyan(message) {
53
- console.log(chalk_1.default.cyan(message));
54
- }
55
- log(message) {
56
- console.log(message);
57
- }
58
- }
59
- const logger = new SimpleLogger();
60
35
  // Helper function to check if file exists
61
36
  async function fileExists(filePath) {
62
37
  try {
@@ -76,26 +51,26 @@ async function getBestCommand(filePath, showInfo) {
76
51
  throw new Error(`File not found: ${filePath}`);
77
52
  }
78
53
  if (showInfo) {
79
- logger.info(`neex dev: Analyzing ${chalk_1.default.cyan(path.basename(filePath))}`);
54
+ console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Analyzing ${chalk_1.default.cyan(path.basename(filePath))}`));
80
55
  }
81
56
  switch (ext) {
82
57
  case '.ts':
83
58
  case '.mts':
84
59
  case '.cts':
85
60
  if (showInfo) {
86
- logger.success(`neex dev: TypeScript detected, ready to run`);
61
+ console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: TypeScript detected, ready to run`));
87
62
  }
88
63
  return `npx ts-node ${filePath}`;
89
64
  case '.js':
90
65
  case '.mjs':
91
66
  case '.cjs':
92
67
  if (showInfo) {
93
- logger.success(`neex dev: JavaScript detected, ready to run`);
68
+ console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: JavaScript detected, ready to run`));
94
69
  }
95
70
  return `node ${filePath}`;
96
71
  default:
97
72
  if (showInfo) {
98
- logger.warning(`neex dev: Unknown file type, using Node.js`);
73
+ console.log(chalk_1.default.yellow(`${figures_1.default.warning} neex dev: Unknown file type, using Node.js`));
99
74
  }
100
75
  return `node ${filePath}`;
101
76
  }
@@ -125,14 +100,14 @@ function addDevCommands(program) {
125
100
  try {
126
101
  const showInfo = options.info || false;
127
102
  if (showInfo) {
128
- logger.info(`neex dev: Starting enhanced development server...`);
129
- logger.info(`neex dev: Target file: ${chalk_1.default.cyan(file)}`);
103
+ console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Starting enhanced development server...`));
104
+ console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Target file: ${chalk_1.default.cyan(file)}`));
130
105
  }
131
106
  // Validate file parameter
132
107
  if (!file || file.trim() === '') {
133
- logger.error(`neex dev: Error - No file specified!`);
134
- logger.log(chalk_1.default.yellow(`${figures_1.default.pointer} Usage: neex dev <file>`));
135
- logger.log(chalk_1.default.yellow(`${figures_1.default.pointer} Example: neex dev src/server.ts`));
108
+ console.error(chalk_1.default.red(`${figures_1.default.cross} neex dev: Error - No file specified!`));
109
+ console.error(chalk_1.default.yellow(`${figures_1.default.pointer} Usage: neex dev <file>`));
110
+ console.error(chalk_1.default.yellow(`${figures_1.default.pointer} Example: neex dev src/server.ts`));
136
111
  process.exit(1);
137
112
  }
138
113
  // Get the best command to run the file
@@ -143,7 +118,7 @@ function addDevCommands(program) {
143
118
  fileExtension = path.extname(file).toLowerCase();
144
119
  }
145
120
  catch (error) {
146
- logger.error(`neex dev: ${error instanceof Error ? error.message : 'Unknown error occurred'}`);
121
+ console.error(chalk_1.default.red(`${figures_1.default.cross} neex dev: ${error instanceof Error ? error.message : 'Unknown error occurred'}`));
147
122
  process.exit(1);
148
123
  }
149
124
  // Setup watch configuration
@@ -164,20 +139,20 @@ function addDevCommands(program) {
164
139
  const extensions = options.ext || ['js', 'mjs', 'json', 'ts', 'tsx', 'jsx', 'vue', 'svelte'];
165
140
  // Log configuration only if --info flag is set
166
141
  if (showInfo) {
167
- logger.info(`neex dev: Configuration:`);
168
- logger.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Target: ${chalk_1.default.cyan(file)}`));
169
- logger.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Runtime: ${chalk_1.default.cyan(fileExtension === '.ts' || fileExtension === '.mts' || fileExtension === '.cts' ? 'TypeScript' : 'JavaScript')}`));
170
- logger.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Watch paths: ${chalk_1.default.cyan(watchPaths.join(', '))}`));
171
- logger.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Extensions: ${chalk_1.default.cyan(extensions.join(', '))}`));
172
- logger.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Restart delay: ${chalk_1.default.cyan(options.delay || 1000)}ms`));
173
- logger.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Clear console: ${chalk_1.default.cyan(options.clear ? 'Yes' : 'No')}`));
142
+ console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Configuration:`));
143
+ console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Target: ${chalk_1.default.cyan(file)}`));
144
+ console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Runtime: ${chalk_1.default.cyan(fileExtension === '.ts' || fileExtension === '.mts' || fileExtension === '.cts' ? 'TypeScript' : 'JavaScript')}`));
145
+ console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Watch paths: ${chalk_1.default.cyan(watchPaths.join(', '))}`));
146
+ console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Extensions: ${chalk_1.default.cyan(extensions.join(', '))}`));
147
+ console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Restart delay: ${chalk_1.default.cyan(options.delay || 1000)}ms`));
148
+ console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Clear console: ${chalk_1.default.cyan(options.clear ? 'Yes' : 'No')}`));
174
149
  if (options.verbose) {
175
- logger.info(`neex dev: Verbose mode enabled - showing detailed logs`);
150
+ console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Verbose mode enabled - showing detailed logs`));
176
151
  }
177
- logger.success(`neex dev: Starting file watcher and process manager...`);
178
- logger.success(`neex dev: Launching ${chalk_1.default.cyan(path.basename(file))} with auto-restart capability...`);
179
- logger.info(`neex dev: Press Ctrl+C to stop the development server`);
180
- logger.gray(`${'='.repeat(60)}`);
152
+ console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: Starting file watcher and process manager...`));
153
+ console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: Launching ${chalk_1.default.cyan(path.basename(file))} with auto-restart capability...`));
154
+ console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Press Ctrl+C to stop the development server`));
155
+ console.log(chalk_1.default.gray(`${'='.repeat(60)}`));
181
156
  }
182
157
  // Create DevRunner instance
183
158
  devRunner = new dev_runner_js_1.DevRunner({
@@ -205,17 +180,17 @@ function addDevCommands(program) {
205
180
  await devRunner.start([commandToExecute]);
206
181
  }
207
182
  catch (error) {
208
- logger.error(`neex dev: Fatal error occurred`);
183
+ console.error(chalk_1.default.red(`${figures_1.default.cross} neex dev: Fatal error occurred`));
209
184
  if (error instanceof Error) {
210
- logger.error(`Details: ${error.message}`);
185
+ console.error(chalk_1.default.red(`${figures_1.default.cross} Details: ${error.message}`));
211
186
  if (options.verbose && error.stack) {
212
- logger.gray(`Stack trace:\n${error.stack}`);
187
+ console.error(chalk_1.default.gray(`Stack trace:\n${error.stack}`));
213
188
  }
214
189
  }
215
190
  else {
216
- logger.error(`Unknown error occurred`);
191
+ console.error(chalk_1.default.red(`${figures_1.default.cross} Unknown error occurred`));
217
192
  }
218
- logger.log(chalk_1.default.yellow(`${figures_1.default.pointer} Try running with --verbose flag for more details`));
193
+ console.error(chalk_1.default.yellow(`${figures_1.default.pointer} Try running with --verbose flag for more details`));
219
194
  process.exit(1);
220
195
  }
221
196
  });
@@ -224,9 +199,9 @@ function addDevCommands(program) {
224
199
  getDevRunner: () => devRunner,
225
200
  cleanupDev: () => {
226
201
  if (devRunner && devRunner.isActive()) {
227
- logger.info(`neex dev: Stopping development server...`);
202
+ console.log(chalk_1.default.blue(`${figures_1.default.info} neex dev: Stopping development server...`));
228
203
  devRunner.stop();
229
- logger.success(`neex dev: Development server stopped successfully`);
204
+ console.log(chalk_1.default.green(`${figures_1.default.tick} neex dev: Development server stopped successfully`));
230
205
  }
231
206
  }
232
207
  };
@@ -9,31 +9,7 @@ const watcher_1 = require("./watcher");
9
9
  const runner_1 = require("./runner");
10
10
  const chalk_1 = __importDefault(require("chalk"));
11
11
  const figures_1 = __importDefault(require("figures"));
12
- // Simple logger class - no spinners, no complex features
13
- class SimpleLogger {
14
- info(message) {
15
- console.log(chalk_1.default.blue(`${figures_1.default.info} ${message}`));
16
- }
17
- success(message) {
18
- console.log(chalk_1.default.green(`${figures_1.default.tick} ${message}`));
19
- }
20
- warning(message) {
21
- console.log(chalk_1.default.yellow(`${figures_1.default.warning} ${message}`));
22
- }
23
- error(message) {
24
- console.log(chalk_1.default.red(`${figures_1.default.cross} ${message}`));
25
- }
26
- gray(message) {
27
- console.log(chalk_1.default.gray(message));
28
- }
29
- cyan(message) {
30
- console.log(chalk_1.default.cyan(message));
31
- }
32
- log(message) {
33
- console.log(message);
34
- }
35
- }
36
- const logger = new SimpleLogger();
12
+ const logger_1 = __importDefault(require("./logger"));
37
13
  class DevRunner {
38
14
  constructor(options) {
39
15
  this.commands = [];
@@ -92,10 +68,6 @@ class DevRunner {
92
68
  });
93
69
  }
94
70
  async handleFileChange(event) {
95
- const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
96
- if (this.options.showInfo) {
97
- logger.log(`${prefix} File changed: ${chalk_1.default.yellow(event.relativePath)}`);
98
- }
99
71
  if (this.options.clearConsole) {
100
72
  console.clear();
101
73
  }
@@ -126,9 +98,6 @@ class DevRunner {
126
98
  return results;
127
99
  }
128
100
  catch (error) {
129
- if (this.options.showInfo) {
130
- logger.error(`Execution failed: ${error.message}`);
131
- }
132
101
  return [];
133
102
  }
134
103
  }
@@ -179,16 +148,12 @@ class DevRunner {
179
148
  await this.fileWatcher.start();
180
149
  }
181
150
  // Run initial commands
182
- const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
183
- if (this.options.showInfo) {
184
- logger.log(`${prefix} Starting development server...`);
185
- }
186
151
  await this.runCommands();
187
152
  // Set up graceful shutdown
188
153
  this.setupGracefulShutdown();
189
154
  if (this.options.showInfo) {
190
- logger.log(`${prefix} Development server started. Watching for changes...`);
191
- logger.log(`${prefix} Press ${chalk_1.default.cyan('Ctrl+C')} to stop`);
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');
192
157
  }
193
158
  }
194
159
  async restart() {
@@ -196,9 +161,6 @@ class DevRunner {
196
161
  if (!this.isRunning) {
197
162
  return;
198
163
  }
199
- if (this.options.showInfo) {
200
- logger.log(`${prefix} Restarting due to file changes...`);
201
- }
202
164
  this.restartCount++;
203
165
  // Stop current processes
204
166
  if (this.runner) {
@@ -210,9 +172,6 @@ class DevRunner {
210
172
  this.printDevBanner();
211
173
  // Run commands again
212
174
  await this.runCommands();
213
- if (this.options.showInfo) {
214
- logger.log(`${prefix} Restart completed. Watching for changes...`);
215
- }
216
175
  }
217
176
  async stop() {
218
177
  const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
@@ -220,7 +179,7 @@ class DevRunner {
220
179
  return;
221
180
  }
222
181
  if (this.options.showInfo) {
223
- logger.log(`${prefix} Stopping development server...`);
182
+ logger_1.default.printLine(`Stopping development server...`, 'info');
224
183
  }
225
184
  this.isRunning = false;
226
185
  // Stop file watcher
@@ -234,9 +193,9 @@ class DevRunner {
234
193
  const uptime = Math.floor((Date.now() - this.startTime.getTime()) / 1000);
235
194
  const uptimeStr = this.formatUptime(uptime);
236
195
  if (this.options.showInfo) {
237
- logger.log(`${prefix} ${this.options.runnerName} development server stopped after ${uptimeStr}`);
196
+ logger_1.default.printLine(`${this.options.runnerName} development server stopped after ${uptimeStr}`, 'info');
238
197
  if (this.restartCount > 0) {
239
- logger.log(`${prefix} Total restarts: ${this.restartCount}`);
198
+ logger_1.default.printLine(`Total restarts: ${this.restartCount}`, 'info');
240
199
  }
241
200
  }
242
201
  }
@@ -76,9 +76,7 @@ class Logger {
76
76
  return chalk_1.default.hex(vibrantColors[colorIndex]);
77
77
  }
78
78
  formatPrefix(command) {
79
- const color = this.commandColors.get(command) || chalk_1.default.white;
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 = `${prefix} ${line}`;
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(`${prefix} ${chalk_1.default.yellow(line)}`);
102
+ console.log(`${chalk_1.default.yellow(line)}`);
106
103
  }
107
104
  else if (line.toLowerCase().includes('error')) {
108
- console.log(`${prefix} ${chalk_1.default.red(line)}`);
105
+ console.log(`${chalk_1.default.red(line)}`);
109
106
  }
110
107
  else {
111
- console.log(`${prefix} ${line}`);
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(`${prefix} ${color('Starting...')}`);
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${prefix} ${color(frame)} ${chalk_1.default.dim('Running...')}`);
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(`${prefix} ${chalk_1.default.green(figures_1.default.tick)} ${chalk_1.default.green('Completed')}${durationStr}`);
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(`${prefix} ${chalk_1.default.red(figures_1.default.cross)} ${chalk_1.default.red('Failed')}${errorCode}${durationStr}`);
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(`${prefix} ${chalk_1.default.red(error.message)}`);
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(`${prefix} ${chalk_1.default.red(figures_1.default.cross)} ${result.command} ${status} ${duration}`, 'error');
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(`${prefix} ${chalk_1.default.green(figures_1.default.tick)} Command "${result.command}" finished successfully ${duration}`, 'info');
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(`${prefix} ${chalk_1.default.red(figures_1.default.cross)} Command "${result.command}" failed${errorCode}${errorMessage} ${duration}`, 'error');
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
  }
@@ -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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neex",
3
- "version": "0.6.38",
3
+ "version": "0.6.39",
4
4
  "description": "The Modern Build System for Polyrepo-in-Monorepo Architecture",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",