Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Bun #104

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A GitHub action that reports changes in compressed file sizes on your PRs.

- Automatically uses `yarn`, `pnpm` or `npm ci` when lockfiles are present
- Automatically uses `yarn`, `pnpm`, `bun`, or `npm ci` when lockfiles are present
- Builds your PR, then builds the target and compares between the two
- Doesn't upload anything or rely on centralized storage
- Supports [custom build scripts](#customizing-the-build) and [file patterns](#customizing-the-list-of-files)
Expand Down
2 changes: 1 addition & 1 deletion index.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ async function run(octokit, context, token) {

let yarnLock = await fileExists(path.resolve(cwd, 'yarn.lock'));
let pnpmLock = await fileExists(path.resolve(cwd, 'pnpm-lock.yaml'));
let bunLock = await fileExists(path.resolve(cwd, 'bun.lockb'));
let packageLock = await fileExists(path.resolve(cwd, 'package-lock.json'));

let packageManager = 'npm';
Expand All @@ -62,6 +63,9 @@ async function run(octokit, context, token) {
} else if (pnpmLock) {
installScript = 'pnpm install --frozen-lockfile';
packageManager = 'pnpm';
} else if (bunLock) {
installScript = 'bun install --frozen-lockfile';
packageManager = 'bun';
} else if (packageLock) {
installScript = 'npm ci';
}
Expand Down Expand Up @@ -121,6 +125,7 @@ async function run(octokit, context, token) {

yarnLock = await fileExists(path.resolve(cwd, 'yarn.lock'));
pnpmLock = await fileExists(path.resolve(cwd, 'pnpm-lock.yaml'));
bunLock = await fileExists(path.resolve(cwd, 'bun.lockb'));
packageLock = await fileExists(path.resolve(cwd, 'package-lock.json'));

packageManager = 'npm';
Expand All @@ -131,6 +136,9 @@ async function run(octokit, context, token) {
} else if (pnpmLock) {
installScript = `pnpm install --frozen-lockfile`;
packageManager = `pnpm`;
} else if (bunLock) {
installScript = `bun install --frozen-lockfile`;
packageManager = `bun`;
} else if (packageLock) {
installScript = `npm ci`;
}
Expand Down
Loading