neex 0.6.25 → 0.6.27

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.
@@ -42,12 +42,12 @@ class BuildManager {
42
42
  this.startTime = new Date();
43
43
  const defaultOptions = {
44
44
  parallel: false,
45
- printOutput: false,
45
+ printOutput: true,
46
46
  color: true,
47
- showTiming: false,
48
- prefix: false,
49
- stopOnError: true,
50
- minimalOutput: true,
47
+ showTiming: true,
48
+ prefix: true,
49
+ stopOnError: false,
50
+ minimalOutput: false,
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}]`);
99
100
  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();
@@ -149,13 +149,10 @@ class BuildManager {
149
149
  }
150
150
  async runBuild() {
151
151
  const buildCommand = this.generateBuildCommand();
152
- // Create a runner with clean output settings
152
+ // Create a modified options object for the runner
153
153
  const runnerOptions = {
154
154
  ...this.options,
155
- printOutput: Boolean(this.options.showInfo),
156
- showTiming: Boolean(this.options.showInfo),
157
- prefix: Boolean(this.options.showInfo),
158
- customPrefix: this.options.showInfo ? () => `build` : undefined
155
+ customPrefix: () => `build`
159
156
  };
160
157
  this.runner = new runner_1.Runner(runnerOptions);
161
158
  try {
@@ -172,23 +169,24 @@ class BuildManager {
172
169
  const results = await this.runner.run([buildCommand]);
173
170
  // Handle build results
174
171
  const success = results.every(result => result.success);
175
- if (!success) {
176
- // Only show errors, let the caller handle success message
177
- const failedResults = results.filter(result => !result.success);
178
- for (const result of failedResults) {
179
- if (result.stderr) {
180
- console.error(chalk_1.default.red(result.stderr));
181
- }
182
- if (result.error) {
183
- console.error(chalk_1.default.red(result.error));
184
- }
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');
185
181
  }
186
- throw new Error('Build failed');
187
182
  }
188
183
  return results;
189
184
  }
190
185
  catch (error) {
191
- throw error;
186
+ if (this.options.showInfo) {
187
+ logger_1.default.printLine(`Build failed: ${error.message}`, 'error');
188
+ }
189
+ return [];
192
190
  }
193
191
  finally {
194
192
  this.isBuilding = false;
@@ -237,31 +235,37 @@ class BuildManager {
237
235
  this.setupFileWatcher();
238
236
  }
239
237
  // Print build banner only if showInfo is true
240
- if (this.options.showInfo) {
241
- this.printBuildBanner();
242
- }
238
+ this.printBuildBanner();
243
239
  // Start file watcher if enabled
244
240
  if (this.fileWatcher) {
245
241
  await this.fileWatcher.start();
246
242
  }
247
243
  // 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
248
  await this.runBuild();
249
249
  // Set up graceful shutdown
250
250
  this.setupGracefulShutdown();
251
251
  if (this.options.watch) {
252
252
  if (this.options.showInfo) {
253
- const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
254
253
  logger_1.default.printLine(`${prefix} Build completed. Watching for changes...`, 'info');
255
254
  logger_1.default.printLine(`${prefix} Press ${chalk_1.default.cyan('Ctrl+C')} to stop`, 'info');
256
255
  }
257
256
  }
257
+ else {
258
+ if (this.options.showInfo) {
259
+ logger_1.default.printLine(`${prefix} Build process completed`, 'info');
260
+ }
261
+ }
258
262
  }
259
263
  async rebuild() {
264
+ const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
260
265
  if (this.isBuilding) {
261
266
  return;
262
267
  }
263
268
  if (this.options.showInfo) {
264
- const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
265
269
  logger_1.default.printLine(`${prefix} Rebuilding due to file changes...`, 'info');
266
270
  }
267
271
  // Stop current processes
@@ -271,26 +275,19 @@ class BuildManager {
271
275
  // Wait a moment before rebuilding
272
276
  await new Promise(resolve => setTimeout(resolve, 500));
273
277
  // Print rebuild banner only if showInfo is true
274
- if (this.options.showInfo) {
275
- this.printBuildBanner();
276
- }
278
+ this.printBuildBanner();
277
279
  // Run build again
278
280
  await this.runBuild();
279
281
  if (this.options.showInfo) {
280
- const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
281
282
  logger_1.default.printLine(`${prefix} Rebuild completed. Watching for changes...`, 'info');
282
283
  }
283
- else {
284
- // Show rebuild completion even without showInfo for watch mode
285
- console.log(chalk_1.default.green(`${figures_1.default.tick} Rebuild completed`));
286
- }
287
284
  }
288
285
  async stop() {
286
+ const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
289
287
  if (!this.isBuilding && !this.options.watch) {
290
288
  return;
291
289
  }
292
290
  if (this.options.showInfo) {
293
- const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
294
291
  logger_1.default.printLine(`${prefix} Stopping build process...`, 'info');
295
292
  }
296
293
  // Stop file watcher
@@ -301,10 +298,9 @@ class BuildManager {
301
298
  if (this.runner) {
302
299
  this.runner.cleanup('SIGTERM');
303
300
  }
301
+ const uptime = Math.floor((Date.now() - this.startTime.getTime()) / 1000);
302
+ const uptimeStr = this.formatUptime(uptime);
304
303
  if (this.options.showInfo) {
305
- const prefix = chalk_1.default.cyan(`[${this.options.runnerName}]`);
306
- const uptime = Math.floor((Date.now() - this.startTime.getTime()) / 1000);
307
- const uptimeStr = this.formatUptime(uptime);
308
304
  logger_1.default.printLine(`${prefix} Build process stopped after ${uptimeStr}`, 'info');
309
305
  if (this.buildCount > 0) {
310
306
  logger_1.default.printLine(`${prefix} Total builds: ${this.buildCount}`, 'info');
@@ -110,13 +110,17 @@ 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 build information')
113
+ .option('--info', 'Show detailed information during build')
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 || options.verbose || false;
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
+ }
120
124
  // Validate file parameter
121
125
  if (!file || file.trim() === '') {
122
126
  console.error(chalk_1.default.red(`${figures_1.default.cross} neex build: Error - No file specified!`));
@@ -125,56 +129,86 @@ function addBuildCommands(program) {
125
129
  process.exit(1);
126
130
  }
127
131
  // Get build configuration
128
- const buildConfig = await getBuildConfig(file, options.output, showInfo);
129
- // Create BuildManager instance with clean output settings
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
130
172
  buildManager = new build_manager_js_1.BuildManager({
131
173
  runnerName: 'neex build',
132
174
  inputFile: file,
133
175
  outputDir: options.output,
134
176
  buildType: buildConfig.buildType,
135
177
  buildCommand: buildConfig.buildCommand,
136
- showInfo: showInfo,
137
- color: !options.noColor,
138
- showTiming: false,
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,
139
187
  watch: options.watch,
140
- delay: parseInt(options.delay) || 1000,
188
+ ignore: ignorePatterns,
189
+ delay: options.delay || 1000,
141
190
  verbose: options.verbose,
191
+ showInfo: showInfo,
142
192
  clean: options.clean,
143
193
  sourceMap: options.sourceMap,
144
194
  target: options.target,
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
195
+ module: options.module
153
196
  });
154
197
  // Start the build process
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
- }
198
+ await buildManager.start();
168
199
  }
169
200
  catch (error) {
170
- // Only show fatal error, no extra logs
171
- console.error(chalk_1.default.red(`${figures_1.default.cross} Build failed`));
201
+ console.error(chalk_1.default.red(`${figures_1.default.cross} neex build: Fatal error occurred`));
172
202
  if (error instanceof Error) {
173
- console.error(chalk_1.default.red(`Error: ${error.message}`));
203
+ console.error(chalk_1.default.red(`${figures_1.default.cross} Details: ${error.message}`));
174
204
  if (options.verbose && error.stack) {
175
205
  console.error(chalk_1.default.gray(`Stack trace:\n${error.stack}`));
176
206
  }
177
207
  }
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`));
178
212
  process.exit(1);
179
213
  }
180
214
  });
@@ -183,7 +217,9 @@ function addBuildCommands(program) {
183
217
  getBuildManager: () => buildManager,
184
218
  cleanupBuild: () => {
185
219
  if (buildManager && buildManager.isActive()) {
220
+ console.log(chalk_1.default.blue(`${figures_1.default.info} neex build: Stopping build process...`));
186
221
  buildManager.stop();
222
+ console.log(chalk_1.default.green(`${figures_1.default.tick} neex build: Build process stopped successfully`));
187
223
  }
188
224
  }
189
225
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neex",
3
- "version": "0.6.25",
3
+ "version": "0.6.27",
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",