neex 0.6.28 → 0.6.31

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/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  </picture>
7
7
  </a>
8
8
 
9
- # Neex v0.6.21
9
+ # Neex v0.6.30
10
10
 
11
11
  ### 🚀 Neex: The Modern Build System for Polyrepo-in-Monorepo Architecture
12
12
 
@@ -42,12 +42,12 @@ class BuildManager {
42
42
  this.startTime = new Date();
43
43
  const defaultOptions = {
44
44
  parallel: false,
45
- printOutput: true,
45
+ printOutput: false,
46
46
  color: true,
47
- showTiming: true,
48
- prefix: true,
49
- stopOnError: false,
50
- minimalOutput: false,
47
+ showTiming: false,
48
+ prefix: false,
49
+ stopOnError: true,
50
+ minimalOutput: true,
51
51
  groupOutput: false,
52
52
  isServerMode: false,
53
53
  watch: false,
@@ -96,8 +96,8 @@ class BuildManager {
96
96
  });
97
97
  }
98
98
  async handleFileChange(event) {
99
- const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
100
99
  if (this.options.showInfo) {
100
+ const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
101
101
  logger_1.default.printLine(`${prefix} File changed: ${chalk_1.default.yellow(event.relativePath)}`, 'info');
102
102
  }
103
103
  await this.rebuild();
@@ -148,11 +148,15 @@ class BuildManager {
148
148
  }
149
149
  }
150
150
  async runBuild() {
151
+ var _a, _b, _c;
151
152
  const buildCommand = this.generateBuildCommand();
152
- // Create a modified options object for the runner
153
+ // Create a runner with clean output settings
153
154
  const runnerOptions = {
154
155
  ...this.options,
155
- customPrefix: () => `build`
156
+ printOutput: (_a = this.options.showInfo) !== null && _a !== void 0 ? _a : false,
157
+ showTiming: (_b = this.options.showInfo) !== null && _b !== void 0 ? _b : false,
158
+ prefix: (_c = this.options.showInfo) !== null && _c !== void 0 ? _c : false,
159
+ customPrefix: this.options.showInfo ? () => `build` : undefined
156
160
  };
157
161
  this.runner = new runner_1.Runner(runnerOptions);
158
162
  try {
@@ -169,24 +173,23 @@ class BuildManager {
169
173
  const results = await this.runner.run([buildCommand]);
170
174
  // Handle build results
171
175
  const success = results.every(result => result.success);
172
- const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
173
- if (success) {
174
- if (this.options.showInfo) {
175
- logger_1.default.printLine(`${prefix} ${chalk_1.default.green(`${figures_1.default.tick} Build completed successfully`)}`, 'info');
176
- }
177
- }
178
- else {
179
- if (this.options.showInfo) {
180
- logger_1.default.printLine(`${prefix} ${chalk_1.default.red(`${figures_1.default.cross} Build failed`)}`, 'error');
176
+ if (!success) {
177
+ // Only show errors, let the caller handle success message
178
+ const failedResults = results.filter(result => !result.success);
179
+ for (const result of failedResults) {
180
+ if (result.stderr) {
181
+ console.error(chalk_1.default.red(result.stderr));
182
+ }
183
+ if (result.error) {
184
+ console.error(chalk_1.default.red(result.error));
185
+ }
181
186
  }
187
+ throw new Error('Build failed');
182
188
  }
183
189
  return results;
184
190
  }
185
191
  catch (error) {
186
- if (this.options.showInfo) {
187
- logger_1.default.printLine(`Build failed: ${error.message}`, 'error');
188
- }
189
- return [];
192
+ throw error;
190
193
  }
191
194
  finally {
192
195
  this.isBuilding = false;
@@ -235,37 +238,31 @@ class BuildManager {
235
238
  this.setupFileWatcher();
236
239
  }
237
240
  // Print build banner only if showInfo is true
238
- this.printBuildBanner();
241
+ if (this.options.showInfo) {
242
+ this.printBuildBanner();
243
+ }
239
244
  // Start file watcher if enabled
240
245
  if (this.fileWatcher) {
241
246
  await this.fileWatcher.start();
242
247
  }
243
248
  // Run initial build
244
- const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
245
- if (this.options.showInfo) {
246
- logger_1.default.printLine(`${prefix} Starting build process...`, 'info');
247
- }
248
249
  await this.runBuild();
249
250
  // Set up graceful shutdown
250
251
  this.setupGracefulShutdown();
251
252
  if (this.options.watch) {
252
253
  if (this.options.showInfo) {
254
+ const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
253
255
  logger_1.default.printLine(`${prefix} Build completed. Watching for changes...`, 'info');
254
256
  logger_1.default.printLine(`${prefix} Press ${chalk_1.default.cyan('Ctrl+C')} to stop`, 'info');
255
257
  }
256
258
  }
257
- else {
258
- if (this.options.showInfo) {
259
- logger_1.default.printLine(`${prefix} Build process completed`, 'info');
260
- }
261
- }
262
259
  }
263
260
  async rebuild() {
264
- const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
265
261
  if (this.isBuilding) {
266
262
  return;
267
263
  }
268
264
  if (this.options.showInfo) {
265
+ const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
269
266
  logger_1.default.printLine(`${prefix} Rebuilding due to file changes...`, 'info');
270
267
  }
271
268
  // Stop current processes
@@ -275,19 +272,26 @@ class BuildManager {
275
272
  // Wait a moment before rebuilding
276
273
  await new Promise(resolve => setTimeout(resolve, 500));
277
274
  // Print rebuild banner only if showInfo is true
278
- this.printBuildBanner();
275
+ if (this.options.showInfo) {
276
+ this.printBuildBanner();
277
+ }
279
278
  // Run build again
280
279
  await this.runBuild();
281
280
  if (this.options.showInfo) {
281
+ const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
282
282
  logger_1.default.printLine(`${prefix} Rebuild completed. Watching for changes...`, 'info');
283
283
  }
284
+ else {
285
+ // Show rebuild completion even without showInfo for watch mode
286
+ console.log(chalk_1.default.green(`${figures_1.default.tick} Rebuild completed`));
287
+ }
284
288
  }
285
289
  async stop() {
286
- const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
287
290
  if (!this.isBuilding && !this.options.watch) {
288
291
  return;
289
292
  }
290
293
  if (this.options.showInfo) {
294
+ const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
291
295
  logger_1.default.printLine(`${prefix} Stopping build process...`, 'info');
292
296
  }
293
297
  // Stop file watcher
@@ -298,9 +302,10 @@ class BuildManager {
298
302
  if (this.runner) {
299
303
  this.runner.cleanup('SIGTERM');
300
304
  }
301
- const uptime = Math.floor((Date.now() - this.startTime.getTime()) / 1000);
302
- const uptimeStr = this.formatUptime(uptime);
303
305
  if (this.options.showInfo) {
306
+ const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
307
+ const uptime = Math.floor((Date.now() - this.startTime.getTime()) / 1000);
308
+ const uptimeStr = this.formatUptime(uptime);
304
309
  logger_1.default.printLine(`${prefix} Build process stopped after ${uptimeStr}`, 'info');
305
310
  if (this.buildCount > 0) {
306
311
  logger_1.default.printLine(`${prefix} Total builds: ${this.buildCount}`, 'info');
@@ -116,11 +116,7 @@ function addBuildCommands(program) {
116
116
  .option('--module <module>', 'Module system', 'commonjs')
117
117
  .action(async (file, options) => {
118
118
  try {
119
- const showInfo = options.info || false;
120
- if (showInfo) {
121
- console.log(chalk_1.default.blue(`${figures_1.default.info} neex build: Starting build process...`));
122
- console.log(chalk_1.default.blue(`${figures_1.default.info} neex build: Target file: ${chalk_1.default.cyan(file)}`));
123
- }
119
+ const showInfo = options.info || options.verbose || false;
124
120
  // Validate file parameter
125
121
  if (!file || file.trim() === '') {
126
122
  console.error(chalk_1.default.red(`${figures_1.default.cross} neex build: Error - No file specified!`));
@@ -130,18 +126,18 @@ function addBuildCommands(program) {
130
126
  }
131
127
  // Get build configuration
132
128
  const buildConfig = await getBuildConfig(file, options.output, showInfo);
133
- // Create BuildManager instance with all required options
134
- const buildManager = new build_manager_js_1.BuildManager({
129
+ // Create BuildManager instance with clean output settings
130
+ buildManager = new build_manager_js_1.BuildManager({
135
131
  runnerName: 'neex build',
136
132
  inputFile: file,
137
133
  outputDir: options.output,
138
134
  buildType: buildConfig.buildType,
139
135
  buildCommand: buildConfig.buildCommand,
140
136
  showInfo: showInfo,
141
- color: !options.color,
142
- showTiming: !options.timing,
137
+ color: !options.noColor,
138
+ showTiming: false,
143
139
  watch: options.watch,
144
- delay: parseInt(options.delay),
140
+ delay: parseInt(options.delay) || 1000,
145
141
  verbose: options.verbose,
146
142
  clean: options.clean,
147
143
  sourceMap: options.sourceMap,
@@ -150,56 +146,19 @@ function addBuildCommands(program) {
150
146
  parallel: false,
151
147
  groupOutput: false,
152
148
  isServerMode: false,
153
- printOutput: true,
154
- prefix: true,
155
- stopOnError: false,
156
- minimalOutput: false
149
+ printOutput: false,
150
+ prefix: false,
151
+ stopOnError: true,
152
+ minimalOutput: true // Use minimal output
157
153
  });
158
- // Setup ignore patterns for watch mode
159
- const ignorePatterns = options.ignore || [
160
- 'node_modules/**',
161
- '.git/**',
162
- '*.log',
163
- 'dist/**',
164
- 'build/**',
165
- 'coverage/**',
166
- '.nyc_output/**',
167
- '*.tmp',
168
- '*.temp',
169
- '.DS_Store',
170
- 'Thumbs.db'
171
- ];
172
- // Log configuration only if --info flag is set
173
- if (showInfo) {
174
- console.log(chalk_1.default.blue(`${figures_1.default.info} neex build: Configuration:`));
175
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Input: ${chalk_1.default.cyan(file)}`));
176
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Output: ${chalk_1.default.cyan(options.output)}`));
177
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Build type: ${chalk_1.default.cyan(buildConfig.buildType)}`));
178
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Target: ${chalk_1.default.cyan(options.target)}`));
179
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Module: ${chalk_1.default.cyan(options.module)}`));
180
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Watch mode: ${chalk_1.default.cyan(options.watch ? 'Yes' : 'No')}`));
181
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Clean before build: ${chalk_1.default.cyan(options.clean ? 'Yes' : 'No')}`));
182
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Source maps: ${chalk_1.default.cyan(options.sourceMap ? 'Yes' : 'No')}`));
183
- if (options.verbose) {
184
- console.log(chalk_1.default.blue(`${figures_1.default.info} neex build: Verbose mode enabled - showing detailed logs`));
185
- }
186
- console.log(chalk_1.default.green(`${figures_1.default.tick} neex build: Starting build process...`));
187
- console.log(chalk_1.default.gray(`${'='.repeat(60)}`));
188
- }
189
154
  // Start the build process
190
155
  try {
191
- if (showInfo) {
192
- console.log(chalk_1.default.blue(`${figures_1.default.info} neex build: Analyzing ${chalk_1.default.cyan(path.basename(file))}`));
193
- }
194
156
  await buildManager.start();
195
- if (showInfo) {
196
- console.log(chalk_1.default.green(`${figures_1.default.tick} Build completed successfully`));
197
- }
198
- else {
199
- console.log(chalk_1.default.green(`${figures_1.default.tick} Build completed`));
200
- }
157
+ // Only show success message, no extra logs
158
+ console.log(chalk_1.default.green(`${figures_1.default.tick} Build completed`));
201
159
  }
202
160
  catch (error) {
161
+ // Only show error message, no extra logs
203
162
  console.error(chalk_1.default.red(`${figures_1.default.cross} Build failed`));
204
163
  if (error instanceof Error) {
205
164
  console.error(chalk_1.default.red(`Error: ${error.message}`));
@@ -208,17 +167,14 @@ function addBuildCommands(program) {
208
167
  }
209
168
  }
210
169
  catch (error) {
211
- console.error(chalk_1.default.red(`${figures_1.default.cross} neex build: Fatal error occurred`));
170
+ // Only show fatal error, no extra logs
171
+ console.error(chalk_1.default.red(`${figures_1.default.cross} Build failed`));
212
172
  if (error instanceof Error) {
213
- console.error(chalk_1.default.red(`${figures_1.default.cross} Details: ${error.message}`));
173
+ console.error(chalk_1.default.red(`Error: ${error.message}`));
214
174
  if (options.verbose && error.stack) {
215
175
  console.error(chalk_1.default.gray(`Stack trace:\n${error.stack}`));
216
176
  }
217
177
  }
218
- else {
219
- console.error(chalk_1.default.red(`${figures_1.default.cross} Unknown error occurred`));
220
- }
221
- console.error(chalk_1.default.yellow(`${figures_1.default.pointer} Try running with --verbose flag for more details`));
222
178
  process.exit(1);
223
179
  }
224
180
  });
@@ -227,9 +183,7 @@ function addBuildCommands(program) {
227
183
  getBuildManager: () => buildManager,
228
184
  cleanupBuild: () => {
229
185
  if (buildManager && buildManager.isActive()) {
230
- console.log(chalk_1.default.blue(`${figures_1.default.info} neex build: Stopping build process...`));
231
186
  buildManager.stop();
232
- console.log(chalk_1.default.green(`${figures_1.default.tick} neex build: Build process stopped successfully`));
233
187
  }
234
188
  }
235
189
  };
@@ -163,10 +163,9 @@ class Runner {
163
163
  FORCE_COLOR: this.options.color ? '1' : '0'
164
164
  };
165
165
  const proc = (0, child_process_1.spawn)(cmd, args, {
166
- stdio: ['ignore', 'pipe', 'pipe'],
166
+ stdio: 'inherit',
167
167
  shell: true,
168
168
  env,
169
- detached: true,
170
169
  cwd
171
170
  });
172
171
  this.activeProcesses.set(originalCommand, proc);
@@ -140,11 +140,26 @@ class StartManager {
140
140
  stopOnError: false,
141
141
  restartOnFailure: true,
142
142
  maxRestarts: this.options.maxRestarts,
143
- restartDelay: this.options.restartDelay
143
+ restartDelay: this.options.restartDelay,
144
+ keepAlive: true,
145
+ onProcessExit: (code, signal) => {
146
+ if (code === 0) {
147
+ this.isRunning = false;
148
+ return;
149
+ }
150
+ // Only restart if it's not a graceful shutdown
151
+ if (signal !== this.options.signal) {
152
+ this.crashCount++;
153
+ if (this.shouldRestart()) {
154
+ this.handleCrash().catch(console.error);
155
+ }
156
+ }
157
+ }
144
158
  };
145
159
  this.runner = new runner_1.Runner(runnerOptions);
146
160
  try {
147
161
  const results = await this.runner.run([command]);
162
+ this.isRunning = true;
148
163
  return results;
149
164
  }
150
165
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neex",
3
- "version": "0.6.28",
3
+ "version": "0.6.31",
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",