Skip to content

Commit

Permalink
feat: Add support for bun package manager
Browse files Browse the repository at this point in the history
This commit adds support for the bun package manager in the `installPackage` function. The function now checks for the existence of a `bun.lockb` file in the project root or any of its parent directories. If the file is found, the `packageManager` variable is set to 'bun'. This allows the function to handle installations using the bun package manager.
  • Loading branch information
bryanjtc committed Nov 11, 2023
1 parent 8585ca7 commit da5753c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/test-storybook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,15 @@ export async function installPackage() {
let packageManager;

// Look for lock files in the current working directory or any of its parent directories
const lockFilePath = await findUp(['yarn.lock', 'pnpm-lock.yaml', 'package-lock.json']);
const lockFilePath = await findUp([
'yarn.lock',
'pnpm-lock.yaml',
'package-lock.json',
'bun.lockb',
]);
if (!lockFilePath) {
console.error(
'Cannot determine lock file. Make sure either yarn.lock, pnpm-lock.yaml, or package-lock.json exists in the project root or any of its parent directories.'
'Cannot determine lock file. Make sure either yarn.lock, pnpm-lock.yaml, or package-lock.json, or bun.locb exists in the project root or any of its parent directories.'
);
return;
}
Expand All @@ -278,6 +283,8 @@ export async function installPackage() {
packageManager = 'pnpm';
} else if (fs.existsSync(`${rootDir}/package-lock.json`)) {
packageManager = 'npm';
} else if (fs.existsSync(`${rootDir}/bun.lockb`)) {
packageManager = 'bun';
}

if (packageManager) {
Expand Down

0 comments on commit da5753c

Please sign in to comment.