From 5087a5340257699b124e54decdd573a9fb1ea978 Mon Sep 17 00:00:00 2001 From: Horu <73709188+HigherOrderLogic@users.noreply.github.com> Date: Fri, 4 Oct 2024 21:27:16 +1000 Subject: [PATCH] fix(typecheck): use bunx if is running on bun --- src/commands/typecheck.ts | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/commands/typecheck.ts b/src/commands/typecheck.ts index 7df03325..73e4848f 100644 --- a/src/commands/typecheck.ts +++ b/src/commands/typecheck.ts @@ -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' @@ -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 }, + ) + } } }, })