Skip to content

Commit

Permalink
feat(cpa): add support for bun package manager in v3 installer (#7709)
Browse files Browse the repository at this point in the history
Adds support for bun package manger in v3, enabled with `--use-bun`
flag.

Related: #6932 (for v2)
  • Loading branch information
Arctomachine authored Sep 6, 2024
1 parent e80da7c commit b69826a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/create-payload-app/src/lib/create-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ async function installDeps(args: {
installCmd = 'yarn'
} else if (packageManager === 'pnpm') {
installCmd = 'pnpm install'
} else if (packageManager === 'bun') {
installCmd = 'bun install'
}

try {
Expand Down
2 changes: 2 additions & 0 deletions packages/create-payload-app/src/lib/get-package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export async function getPackageManager(args: {
detected = 'yarn'
} else if (cliArgs?.['--use-npm'] || fse.existsSync(`${projectDir}/package-lock.json`)) {
detected = 'npm'
} else if (cliArgs?.['--use-bun'] || fse.existsSync(`${projectDir}/bun.lockb`)) {
detected = 'bun'
} else {
// Otherwise check for existing commands
if (await commandExists('pnpm')) {
Expand Down
1 change: 1 addition & 0 deletions packages/create-payload-app/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class Main {

// Package manager
'--no-deps': Boolean,
'--use-bun': Boolean,
'--use-npm': Boolean,
'--use-pnpm': Boolean,
'--use-yarn': Boolean,
Expand Down
1 change: 1 addition & 0 deletions packages/create-payload-app/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface Args extends arg.Spec {
'--secret': StringConstructor
'--template': StringConstructor
'--template-branch': StringConstructor
'--use-bun': BooleanConstructor
'--use-npm': BooleanConstructor
'--use-pnpm': BooleanConstructor
'--use-yarn': BooleanConstructor
Expand Down
1 change: 1 addition & 0 deletions packages/create-payload-app/src/utils/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export function helpMessage(): void {
--use-npm Use npm to install dependencies
--use-yarn Use yarn to install dependencies
--use-pnpm Use pnpm to install dependencies
--use-bun Use bun to install dependencies (experimental)
--no-deps Do not install any dependencies
-h Show help
`)
Expand Down

0 comments on commit b69826a

Please sign in to comment.