diff --git a/__test__/getCommand.spec.ts b/__test__/getCommand.spec.ts index 63c86a99..6730da93 100644 --- a/__test__/getCommand.spec.ts +++ b/__test__/getCommand.spec.ts @@ -17,4 +17,9 @@ describe('getCommand', () => { expect(getCommand('pnpm', 'dev')).toBe('pnpm dev') expect(getCommand('pnpm', 'build')).toBe('pnpm build') }) + it('should generate the correct command for bun', () => { + expect(getCommand('bun', 'install')).toBe('bun install') + expect(getCommand('bun', 'dev')).toBe('bun dev') + expect(getCommand('bun', 'build')).toBe('bun run build') + }) }) diff --git a/utils/getCommand.ts b/utils/getCommand.ts index ea3a4e19..40b907d8 100644 --- a/utils/getCommand.ts +++ b/utils/getCommand.ts @@ -2,6 +2,11 @@ export default function getCommand(packageManager: string, scriptName: string, a if (scriptName === 'install') { return packageManager === 'yarn' ? 'yarn' : `${packageManager} install` } + if (scriptName === 'build') { + return packageManager === 'npm' || packageManager === 'bun' + ? `${packageManager} run build` + : `${packageManager} build` + } if (args) { return packageManager === 'npm'