11const { Command, Output, boolean } = require ( "@formidablejs/console" ) ;
22const { exec, execSync } = require ( "child_process" ) ;
3- const { getExt } = require ( '../ext' )
3+ const { getExt } = require ( '../ext' ) ;
4+ const { getRuntime } = require ( "../runtime" ) ;
45
56class Build extends Command {
67 get signature ( ) {
@@ -18,6 +19,8 @@ class Build extends Command {
1819 }
1920
2021 handle ( ) {
22+ const runtime = getRuntime ( ) ;
23+
2124 if ( this . option ( "watch-console" ) ) {
2225 return execSync (
2326 `imba build bootstrap/console${ getExt ( ) } -p -s -f -w -o .formidable` ,
@@ -29,7 +32,7 @@ class Build extends Command {
2932 }
3033
3134 const output = exec (
32- `imba build bootstrap/console${ getExt ( ) } -p -s -f -o .formidable && imba build bootstrap/build${ getExt ( ) } -p -s -f -o .formidable && node craftsman config:cache` ,
35+ `imba build bootstrap/console${ getExt ( ) } -p -s -f -o .formidable && imba build bootstrap/build${ getExt ( ) } -p -s -f -o .formidable && ${ runtime } craftsman config:cache` ,
3336 {
3437 stdio : "pipe" ,
3538 cwd : process . cwd ( ) ,
@@ -69,7 +72,21 @@ class Build extends Command {
6972 track . push ( data ) ;
7073 } ) ;
7174
75+ let workerThreadErrors = false ;
76+
7277 output . stderr . on ( "data" , function ( data ) {
78+ if (
79+ data . startsWith ( 'NotImplementedError: worker_threads.Worker' )
80+ ) {
81+ if ( workerThreadErrors ) {
82+ return ;
83+ }
84+
85+ workerThreadErrors = true ;
86+
87+ return Output . write ( " <bg:yellow> WARN </bg:yellow> Bun does not support node.js worker_threads yet.\n" ) ;
88+ }
89+
7390 process . stdout . write ( data ) ;
7491 } ) ;
7592
0 commit comments