Skip to content

Commit

Permalink
fix(typecheck): use bunx if running on bun (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
HigherOrderLogic authored Oct 22, 2024
1 parent 569b101 commit bb6db3f
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/commands/typecheck.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { execa } from 'execa'
import { resolve } from 'pathe'
import { defineCommand } from 'citty'
import { isBun } from 'std-env'

// we are deliberately inlining this code as a backup in case user has `@nuxt/schema<3.7`
import { writeTypes as writeTypesLegacy } from '@nuxt/kit'
Expand Down Expand Up @@ -55,11 +56,25 @@ export default defineCommand({
})
}
else {
await execa(
'npx',
'-p vue-tsc -p typescript vue-tsc --noEmit'.split(' '),
{ stdio: 'inherit', cwd },
)
if (isBun) {
await execa(
'bun',
'install typescript vue-tsc --global --silent'.split(' '),
{ stdio: 'inherit', cwd },
)

await execa('bunx', 'vue-tsc --noEmit'.split(' '), {
stdio: 'inherit',
cwd,
})
}
else {
await execa(
'npx',
'-p vue-tsc -p typescript vue-tsc --noEmit'.split(' '),
{ stdio: 'inherit', cwd },
)
}
}
},
})

0 comments on commit bb6db3f

Please sign in to comment.