Skip to content

Commit 68177c9

Browse files
Add support for Deno (#144)
* work * build * Revert "build" This reverts commit 4bd9512. * `packageManager` * refactor: Move NPM check to last --------- Co-authored-by: Ryan Christian <33403762+rschristian@users.noreply.github.com>
1 parent 66325aa commit 68177c9

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

5-
- Automatically uses `yarn`, `pnpm`, `bun`, or `npm ci` when lockfiles are present
5+
- Automatically uses `yarn`, `pnpm`, `bun`, `deno`, or `npm ci` when lockfiles are present
66
- Builds your PR, then builds the target and compares between the two
77
- Doesn't upload anything or rely on centralized storage
88
- Supports [custom build scripts](#customizing-the-build) and [file patterns](#customizing-the-list-of-files)

src/utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import prettyBytes from 'pretty-bytes';
77
* @returns {Promise<{ packageManager: string, installScript: string }>}
88
*/
99
export async function getPackageManagerAndInstallScript(cwd) {
10-
const [yarnLockExists, pnpmLockExists, bunLockBinaryExists, bunLockExists, packageLockExists] = await Promise.all([
10+
const [yarnLockExists, pnpmLockExists, bunLockBinaryExists, bunLockExists, packageLockExists, denoLockExists] = await Promise.all([
1111
fileExists(path.resolve(cwd, 'yarn.lock')),
1212
fileExists(path.resolve(cwd, 'pnpm-lock.yaml')),
1313
fileExists(path.resolve(cwd, 'bun.lockb')),
1414
fileExists(path.resolve(cwd, 'bun.lock')),
1515
fileExists(path.resolve(cwd, 'package-lock.json')),
16+
fileExists(path.resolve(cwd, 'deno.lock')),
1617
]);
1718

1819
let packageManager = 'npm';
@@ -26,6 +27,9 @@ export async function getPackageManagerAndInstallScript(cwd) {
2627
} else if (bunLockBinaryExists || bunLockExists) {
2728
installScript = 'bun install --frozen-lockfile';
2829
packageManager = 'bun';
30+
} else if (denoLockExists) {
31+
installScript = 'deno install --frozen';
32+
packageManager = 'deno';
2933
} else if (packageLockExists) {
3034
installScript = 'npm ci';
3135
}

0 commit comments

Comments
 (0)