@@ -11,6 +11,7 @@ import type {
11
11
ModelElement ,
12
12
RelationConfig ,
13
13
} from '@stacksjs/types'
14
+ import { ExitCode } from '@stacksjs/types'
14
15
import { isString } from '@stacksjs/validation'
15
16
16
17
type ModelPath = string
@@ -1717,29 +1718,37 @@ export async function generateModelFiles(modelStringFile?: string, options?: Gen
1717
1718
// the reason we run it in background is because we don't care whether it fails or not, given there
1718
1719
// is a chance that the codebase has lint issues unrelating to our auto-generated code
1719
1720
const process = Bun . spawn ( [ 'bunx' , 'biome' , 'check' , '--fix' ] , {
1720
- stdio : [ 'inherit ' , 'pipe' , 'pipe' ] ,
1721
+ stdio : [ 'pipe ' , 'pipe' , 'pipe' ] ,
1721
1722
} )
1722
1723
1724
+ const reader = process . stdout . getReader ( )
1723
1725
let output = ''
1724
1726
1725
- // @ts -expect-error - unsure why this errors, but it works
1726
- process . stdout . on ( 'data' , ( chunk : any ) => {
1727
- output += chunk
1728
- } )
1729
- // @ts -expect-error - same here
1730
- process . stderr . on ( 'data' , ( chunk : any ) => {
1731
- output += chunk
1732
- } )
1727
+ while ( true ) {
1728
+ const { done, value } = await reader . read ( )
1729
+ if ( done ) break
1730
+ output += new TextDecoder ( ) . decode ( value )
1731
+ }
1732
+
1733
+ const stderrReader = process . stderr . getReader ( )
1734
+ while ( true ) {
1735
+ const { done, value } = await stderrReader . read ( )
1736
+ if ( done ) break
1737
+ // Collect stderr output but do not log it
1738
+ output += new TextDecoder ( ) . decode ( value )
1739
+ }
1733
1740
1734
1741
const exitCode = await process . exited
1735
1742
1736
1743
if ( exitCode !== 0 ) {
1737
- log . error ( 'There was an error fixing your code style.' )
1744
+ log . debug (
1745
+ 'There was an error fixing your code style but we are ignoring it because we fixed the auto-generated code already.' ,
1746
+ )
1738
1747
} else {
1739
1748
log . success ( 'Code style fixed successfully.' )
1740
1749
}
1741
1750
} catch ( error ) {
1742
- log . error ( 'There was an error fixing your code style.' , error )
1751
+ log . error ( 'There was an error fixing your code style.' )
1743
1752
process . exit ( ExitCode . FatalError )
1744
1753
}
1745
1754
0 commit comments