neex 0.6.27 → 0.6.30

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');
@@ -110,17 +110,13 @@ function addBuildCommands(program) {
110
110
  .option('-d, --delay <ms>', 'Delay before rebuild in milliseconds', parseInt)
111
111
  .option('--clean', 'Clean output directory before build')
112
112
  .option('--verbose', 'Verbose output')
113
- .option('--info', 'Show detailed information during build')
113
+ .option('--info', 'Show detailed build information')
114
114
  .option('--source-map', 'Generate source maps')
115
115
  .option('--target <target>', 'Target ECMAScript version', 'es2020')
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!`));
@@ -129,86 +125,56 @@ function addBuildCommands(program) {
129
125
  process.exit(1);
130
126
  }
131
127
  // Get build configuration
132
- let buildConfig;
133
- try {
134
- buildConfig = await getBuildConfig(file, options.output, showInfo);
135
- }
136
- catch (error) {
137
- console.error(chalk_1.default.red(`${figures_1.default.cross} neex build: ${error instanceof Error ? error.message : 'Unknown error occurred'}`));
138
- process.exit(1);
139
- }
140
- // Setup ignore patterns for watch mode
141
- const ignorePatterns = options.ignore || [
142
- 'node_modules/**',
143
- '.git/**',
144
- '*.log',
145
- 'dist/**',
146
- 'build/**',
147
- 'coverage/**',
148
- '.nyc_output/**',
149
- '*.tmp',
150
- '*.temp',
151
- '.DS_Store',
152
- 'Thumbs.db'
153
- ];
154
- // Log configuration only if --info flag is set
155
- if (showInfo) {
156
- console.log(chalk_1.default.blue(`${figures_1.default.info} neex build: Configuration:`));
157
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Input: ${chalk_1.default.cyan(file)}`));
158
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Output: ${chalk_1.default.cyan(options.output)}`));
159
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Build type: ${chalk_1.default.cyan(buildConfig.buildType)}`));
160
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Target: ${chalk_1.default.cyan(options.target)}`));
161
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Module: ${chalk_1.default.cyan(options.module)}`));
162
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Watch mode: ${chalk_1.default.cyan(options.watch ? 'Yes' : 'No')}`));
163
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Clean before build: ${chalk_1.default.cyan(options.clean ? 'Yes' : 'No')}`));
164
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Source maps: ${chalk_1.default.cyan(options.sourceMap ? 'Yes' : 'No')}`));
165
- if (options.verbose) {
166
- console.log(chalk_1.default.blue(`${figures_1.default.info} neex build: Verbose mode enabled - showing detailed logs`));
167
- }
168
- console.log(chalk_1.default.green(`${figures_1.default.tick} neex build: Starting build process...`));
169
- console.log(chalk_1.default.gray(`${'='.repeat(60)}`));
170
- }
171
- // Create BuildManager instance
128
+ const buildConfig = await getBuildConfig(file, options.output, showInfo);
129
+ // Create BuildManager instance with clean output settings
172
130
  buildManager = new build_manager_js_1.BuildManager({
173
131
  runnerName: 'neex build',
174
132
  inputFile: file,
175
133
  outputDir: options.output,
176
134
  buildType: buildConfig.buildType,
177
135
  buildCommand: buildConfig.buildCommand,
178
- parallel: false,
179
- groupOutput: false,
180
- isServerMode: false,
181
- color: options.color,
182
- showTiming: options.timing,
183
- prefix: options.prefix,
184
- stopOnError: options.stopOnError,
185
- printOutput: true,
186
- minimalOutput: options.minimal,
136
+ showInfo: showInfo,
137
+ color: !options.noColor,
138
+ showTiming: false,
187
139
  watch: options.watch,
188
- ignore: ignorePatterns,
189
- delay: options.delay || 1000,
140
+ delay: parseInt(options.delay) || 1000,
190
141
  verbose: options.verbose,
191
- showInfo: showInfo,
192
142
  clean: options.clean,
193
143
  sourceMap: options.sourceMap,
194
144
  target: options.target,
195
- module: options.module
145
+ module: options.module,
146
+ parallel: false,
147
+ groupOutput: false,
148
+ isServerMode: false,
149
+ printOutput: false,
150
+ prefix: false,
151
+ stopOnError: true,
152
+ minimalOutput: true // Use minimal output
196
153
  });
197
154
  // Start the build process
198
- await buildManager.start();
155
+ try {
156
+ await buildManager.start();
157
+ // Only show success message, no extra logs
158
+ console.log(chalk_1.default.green(`${figures_1.default.tick} Build completed`));
159
+ }
160
+ catch (error) {
161
+ // Only show error message, no extra logs
162
+ console.error(chalk_1.default.red(`${figures_1.default.cross} Build failed`));
163
+ if (error instanceof Error) {
164
+ console.error(chalk_1.default.red(`Error: ${error.message}`));
165
+ }
166
+ process.exit(1);
167
+ }
199
168
  }
200
169
  catch (error) {
201
- 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`));
202
172
  if (error instanceof Error) {
203
- console.error(chalk_1.default.red(`${figures_1.default.cross} Details: ${error.message}`));
173
+ console.error(chalk_1.default.red(`Error: ${error.message}`));
204
174
  if (options.verbose && error.stack) {
205
175
  console.error(chalk_1.default.gray(`Stack trace:\n${error.stack}`));
206
176
  }
207
177
  }
208
- else {
209
- console.error(chalk_1.default.red(`${figures_1.default.cross} Unknown error occurred`));
210
- }
211
- console.error(chalk_1.default.yellow(`${figures_1.default.pointer} Try running with --verbose flag for more details`));
212
178
  process.exit(1);
213
179
  }
214
180
  });
@@ -217,9 +183,7 @@ function addBuildCommands(program) {
217
183
  getBuildManager: () => buildManager,
218
184
  cleanupBuild: () => {
219
185
  if (buildManager && buildManager.isActive()) {
220
- console.log(chalk_1.default.blue(`${figures_1.default.info} neex build: Stopping build process...`));
221
186
  buildManager.stop();
222
- console.log(chalk_1.default.green(`${figures_1.default.tick} neex build: Build process stopped successfully`));
223
187
  }
224
188
  }
225
189
  };
@@ -155,13 +155,15 @@ function addStartCommands(program) {
155
155
  'Thumbs.db'
156
156
  ];
157
157
  const extensions = options.ext || ['js', 'mjs', 'json'];
158
+ // Ensure environment is always set to production unless explicitly overridden
159
+ const environment = options.env === 'development' ? options.env : 'production';
158
160
  // Log configuration only if --info flag is set
159
161
  if (showInfo) {
160
162
  console.log(chalk_1.default.blue(`${figures_1.default.info} neex start: Configuration:`));
161
163
  console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Target: ${chalk_1.default.cyan(file)}`));
162
164
  console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Runtime: ${chalk_1.default.cyan(startConfig.runtime)}`));
163
165
  console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Process name: ${chalk_1.default.cyan(startConfig.processName)}`));
164
- console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Environment: ${chalk_1.default.cyan(options.env)}`));
166
+ console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Environment: ${chalk_1.default.cyan(environment)}`));
165
167
  console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Watch mode: ${chalk_1.default.cyan(options.watch ? 'Yes' : 'No')}`));
166
168
  console.log(chalk_1.default.blue(` ${figures_1.default.arrowRight} Cluster mode: ${chalk_1.default.cyan(options.cluster ? 'Yes' : 'No')}`));
167
169
  if (options.cluster) {
@@ -185,7 +187,7 @@ function addStartCommands(program) {
185
187
  console.log(chalk_1.default.blue(`${figures_1.default.info} neex start: Verbose mode enabled - showing detailed logs`));
186
188
  }
187
189
  console.log(chalk_1.default.green(`${figures_1.default.tick} neex start: Starting production application server...`));
188
- console.log(chalk_1.default.green(`${figures_1.default.tick} neex start: Launching ${chalk_1.default.cyan(startConfig.processName)} in ${chalk_1.default.cyan(options.env)} mode...`));
190
+ console.log(chalk_1.default.green(`${figures_1.default.tick} neex start: Launching ${chalk_1.default.cyan(startConfig.processName)} in ${chalk_1.default.cyan(environment)} mode...`));
189
191
  console.log(chalk_1.default.blue(`${figures_1.default.info} neex start: Press Ctrl+C to stop the application server`));
190
192
  console.log(chalk_1.default.gray(`${'='.repeat(60)}`));
191
193
  }
@@ -196,7 +198,7 @@ function addStartCommands(program) {
196
198
  command: startConfig.command,
197
199
  processName: startConfig.processName,
198
200
  runtime: startConfig.runtime,
199
- environment: options.env,
201
+ environment: environment,
200
202
  parallel: false,
201
203
  color: options.color,
202
204
  showTiming: options.timing,
@@ -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.27",
3
+ "version": "0.6.30",
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",