From 3e76dde15323725c7bb0e31ef78a8964156142ce Mon Sep 17 00:00:00 2001 From: Simon Sawicki Date: Sun, 7 Dec 2025 19:27:53 +0100 Subject: [PATCH] Use `pnpm` binary if available (#35) --- .github/workflows/ci.yml | 9 +++++---- pnpm.py | 10 +++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3759a13..cb38cc5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,10 +113,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - - name: Install Deno v2.x (latest) - uses: denoland/setup-deno@v2 - with: - deno-version: v2.x + - uses: pnpm/action-setup@v4 # respects packageManager version in package.json - name: Install requirements run: | python pnpm.py install --frozen-lockfile @@ -143,6 +140,10 @@ jobs: path: | src/yt/solver/test/players key: test-player-js-${{ hashFiles('src/yt/solver/test/tests.ts') }} + - name: Install Deno v2.x (latest) + uses: denoland/setup-deno@v2 + with: + deno-version: v2.x - name: Download player JS files run: | deno run \ diff --git a/pnpm.py b/pnpm.py index ef897f2..0223d50 100755 --- a/pnpm.py +++ b/pnpm.py @@ -43,7 +43,11 @@ def build_pnpm(): package_manager = data["packageManager"] env = os.environ.copy() - if deno := shutil.which("deno"): + if pnpm := shutil.which("pnpm"): + name = "pnpm binary" + cmd = [pnpm] + + elif deno := shutil.which("deno"): name = "deno" env["DENO_NO_UPDATE_CHECK"] = "1" cmd = [ @@ -65,10 +69,10 @@ def build_pnpm(): else: return None, None - def pnpm(args: list[str]): + def run_pnpm(args: list[str]): return subprocess.check_call([*cmd, *args], env=env) - return name, pnpm + return name, run_pnpm if __name__ == "__main__":