Skip to content

Commit

Permalink
Add basic support for bun package manager
Browse files Browse the repository at this point in the history
  • Loading branch information
harveylee committed Jul 31, 2024
1 parent c332456 commit df6f715
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/lib/lockfile/process-lockfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ export async function processLockfile({
});
break;
}
case "bun": {
log.warn(`Ouput lockfiles for Bun are not yet supported. Using NPM for output`);
await generateNpmLockfile({
workspaceRootDir,
isolateDir,
});

usedFallbackToNpm = true;
break;
}
default:
log.warn(`Unexpected package manager ${name}. Using NPM for output`);
await generateNpmLockfile({
Expand Down
4 changes: 3 additions & 1 deletion src/lib/package-manager/names.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const supportedPackageManagerNames = ["pnpm", "yarn", "npm"] as const;
export const supportedPackageManagerNames = ["pnpm", "yarn", "npm", "bun"] as const;

export type PackageManagerName = (typeof supportedPackageManagerNames)[number];

Expand All @@ -11,6 +11,8 @@ export type PackageManager = {

export function getLockfileFileName(name: PackageManagerName) {
switch (name) {
case "bun":
return "bun.lockb";
case "pnpm":
return "pnpm-lock.yaml";
case "yarn":
Expand Down
1 change: 1 addition & 0 deletions src/lib/registry/helpers/find-packages-globs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function findPackagesGlobs(workspaceRootDir: string) {
log.debug("Detected pnpm packages globs:", inspectValue(globs));
return globs;
}
case "bun":
case "yarn":
case "npm": {
const workspaceRootManifestPath = path.join(
Expand Down

0 comments on commit df6f715

Please sign in to comment.