Skip to content

Commit c61abd7

Browse files
committed
chore: wip
1 parent b9c5d71 commit c61abd7

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

storage/framework/core/actions/src/lint/fix.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ const result = await runCommand(NpmScript.LintFix, {
1313
})
1414

1515
if (result.isErr()) {
16-
log.error('There was an error fixing your code style.', result.error)
16+
log.error('There was an error fixing your code style.')
17+
console.error(result.error)
1718
process.exit(1)
1819
}
1920

storage/framework/core/orm/src/utils.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {
1111
ModelElement,
1212
RelationConfig,
1313
} from '@stacksjs/types'
14+
import { ExitCode } from '@stacksjs/types'
1415
import { isString } from '@stacksjs/validation'
1516

1617
type ModelPath = string
@@ -1717,29 +1718,37 @@ export async function generateModelFiles(modelStringFile?: string, options?: Gen
17171718
// the reason we run it in background is because we don't care whether it fails or not, given there
17181719
// is a chance that the codebase has lint issues unrelating to our auto-generated code
17191720
const process = Bun.spawn(['bunx', 'biome', 'check', '--fix'], {
1720-
stdio: ['inherit', 'pipe', 'pipe'],
1721+
stdio: ['pipe', 'pipe', 'pipe'],
17211722
})
17221723

1724+
const reader = process.stdout.getReader()
17231725
let output = ''
17241726

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+
}
17331740

17341741
const exitCode = await process.exited
17351742

17361743
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+
)
17381747
} else {
17391748
log.success('Code style fixed successfully.')
17401749
}
17411750
} 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.')
17431752
process.exit(ExitCode.FatalError)
17441753
}
17451754

0 commit comments

Comments
 (0)