bunosh 0.4.9 → 0.4.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunosh",
3
- "version": "0.4.9",
3
+ "version": "0.4.10",
4
4
  "type": "module",
5
5
  "module": "index.js",
6
6
  "bin": {
package/src/program.js CHANGED
@@ -606,6 +606,27 @@ ${namespaceCommands}
606
606
  process.exit(1);
607
607
  });
608
608
 
609
+
610
+ // Handle --version option before parsing
611
+ if (process.argv.includes('--version')) {
612
+ let version = '';
613
+ // For compiled binaries, check if version is embedded at build time
614
+ if (typeof BUNOSH_VERSION !== 'undefined') {
615
+ version = BUNOSH_VERSION;
616
+ } else {
617
+ // For development, try to read from package.json
618
+ try {
619
+ const pkgPath = new URL('../package.json', import.meta.url);
620
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
621
+ version = pkg.version;
622
+ } catch (e) {
623
+ version = '0.1.5'; // fallback to current version
624
+ }
625
+ }
626
+ console.log(version);
627
+ process.exit(0);
628
+ }
629
+
609
630
  // Show help if no command provided
610
631
  if (process.argv.length === 2) {
611
632
  program.outputHelp();
package/src/task.js CHANGED
@@ -138,6 +138,20 @@ export async function tryTask(name, fn, isSilent = true) {
138
138
  const endTime = Date.now();
139
139
  const duration = endTime - taskInfo.startTime;
140
140
 
141
+ // Check if result is a TaskResult and if it has failed
142
+ if (result && typeof result === 'object' && result.constructor && result.constructor.name === 'TaskResult') {
143
+ if (result.hasFailed || result.hasWarning) {
144
+ taskInfo.status = TaskStatus.WARNING;
145
+ taskInfo.duration = duration;
146
+ taskInfo.result = { status: TaskStatus.WARNING, output: result.output };
147
+
148
+ if (shouldPrint) printer.warning(name);
149
+ runningTasks.delete(taskInfo.id);
150
+
151
+ return false;
152
+ }
153
+ }
154
+
141
155
  taskInfo.status = TaskStatus.SUCCESS;
142
156
  taskInfo.duration = duration;
143
157
  taskInfo.result = { status: TaskStatus.SUCCESS, output: result };