From 421fa82b3afe1ffe3410f5203e575e4e4aead1ce Mon Sep 17 00:00:00 2001 From: Nate Stringham <44071655+nstringham@users.noreply.github.com> Date: Sat, 23 May 2026 17:40:26 -0400 Subject: [PATCH 1/2] feat: auto detect package manager --- bin/action.min.js | 15 ++++++++++++++- src/deploy.ts | 17 ++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/bin/action.min.js b/bin/action.min.js index 7291ada8..7747e764 100644 --- a/bin/action.min.js +++ b/bin/action.min.js @@ -92942,13 +92942,26 @@ function interpretChannelDeployResult(deployResult) { urls }; } +function getPackageManagerExecuteCommand() { + if (fs.existsSync("./package-lock.json")) { + return "npx"; + } + if (fs.existsSync("./yarn.lock")) { + return "yarn dlx"; + } + if (fs.existsSync("./pnpm-lock.yaml")) { + return "pnpm dlx"; + } + return "npx"; +} async function execWithCredentials(args, projectId, gacFilename, opts) { let deployOutputBuf = []; const debug = opts.debug || false; const firebaseToolsVersion = opts.firebaseToolsVersion || "latest"; const force = opts.force; + const packageManager = getPackageManagerExecuteCommand(); try { - await exec_1.exec(`npx firebase-tools@${firebaseToolsVersion}`, [...args, ...(projectId ? ["--project", projectId] : []), ...(force ? ["--force"] : []), debug ? "--debug" // gives a more thorough error message + await exec_1.exec(`${packageManager} firebase-tools@${firebaseToolsVersion}`, [...args, ...(projectId ? ["--project", projectId] : []), ...(force ? ["--force"] : []), debug ? "--debug" // gives a more thorough error message : "--json" // allows us to easily parse the output ], { listeners: { diff --git a/src/deploy.ts b/src/deploy.ts index f7a419b7..db38b04c 100644 --- a/src/deploy.ts +++ b/src/deploy.ts @@ -15,6 +15,7 @@ */ import { exec } from "@actions/exec"; +import { existsSync } from "fs"; export type SiteDeploy = { site: string; @@ -74,6 +75,19 @@ export function interpretChannelDeployResult( }; } +function getPackageManagerExecuteCommand(): string { + if (existsSync("./package-lock.json")) { + return "npx"; + } + if (existsSync("./yarn.lock")) { + return "yarn dlx"; + } + if (existsSync("./pnpm-lock.yaml")) { + return "pnpm dlx"; + } + return "npx"; +} + async function execWithCredentials( args: string[], projectId, @@ -84,10 +98,11 @@ async function execWithCredentials( const debug = opts.debug || false; const firebaseToolsVersion = opts.firebaseToolsVersion || "latest"; const force = opts.force; + const packageManager = getPackageManagerExecuteCommand(); try { await exec( - `npx firebase-tools@${firebaseToolsVersion}`, + `${packageManager} firebase-tools@${firebaseToolsVersion}`, [ ...args, ...(projectId ? ["--project", projectId] : []), From 021a5b684889030fddac0de5397ddb9737bb48d0 Mon Sep 17 00:00:00 2001 From: Nate Stringham <44071655+nstringham@users.noreply.github.com> Date: Sat, 23 May 2026 18:10:39 -0400 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=F0=9F=90=9B=20only=20use=20yarn=20d?= =?UTF-8?q?lx=20for=20yarn=202=20and=20allow=20yarn=201=20to=20fall=20back?= =?UTF-8?q?=20to=20npx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/action.min.js | 2 +- src/deploy.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/action.min.js b/bin/action.min.js index 7747e764..729b0137 100644 --- a/bin/action.min.js +++ b/bin/action.min.js @@ -92946,7 +92946,7 @@ function getPackageManagerExecuteCommand() { if (fs.existsSync("./package-lock.json")) { return "npx"; } - if (fs.existsSync("./yarn.lock")) { + if (fs.existsSync("./yarn.lock") && fs.existsSync("./.yarnrc.yml")) { return "yarn dlx"; } if (fs.existsSync("./pnpm-lock.yaml")) { diff --git a/src/deploy.ts b/src/deploy.ts index db38b04c..08fa7552 100644 --- a/src/deploy.ts +++ b/src/deploy.ts @@ -79,7 +79,7 @@ function getPackageManagerExecuteCommand(): string { if (existsSync("./package-lock.json")) { return "npx"; } - if (existsSync("./yarn.lock")) { + if (existsSync("./yarn.lock") && existsSync("./.yarnrc.yml")) { return "yarn dlx"; } if (existsSync("./pnpm-lock.yaml")) {