Skip to content

Commit

Permalink
Invoke wrangler to check if it's installed, but don't auto-install th…
Browse files Browse the repository at this point in the history
…rough npx/bunx
  • Loading branch information
Maximo-Guk committed Jun 16, 2024
1 parent aa5d18d commit 3c1c124
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-spies-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler-action": minor
---

This unreverts #235 ensuring wrangler-action will re-use existing wrangler installations, thanks @AdiRishi! and ensures we don't automatically install wrangler when checking if it present
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ async function installWrangler() {
let installedVersionSatisfiesRequirement = false;
try {
const { stdout } = await getExecOutput(
packageManager.exec,
// We want to simply invoke wrangler to check if it's installed, but don't want to auto-install it at this stage
packageManager.execNoInstall,
["wrangler", "--version"],
{
cwd: config["workingDirectory"],
Expand Down
5 changes: 5 additions & 0 deletions src/packageManagers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,29 @@ import * as path from "node:path";
interface PackageManager {
install: string;
exec: string;
execNoInstall: string;
}

const PACKAGE_MANAGERS = {
npm: {
install: "npm i",
exec: "npx",
execNoInstall: "npx --no-install",
},
yarn: {
install: "yarn add",
exec: "yarn",
execNoInstall: "yarn",
},
pnpm: {
install: "pnpm add",
exec: "pnpm exec",
execNoInstall: "pnpm exec",
},
bun: {
install: "bun i",
exec: "bunx",
execNoInstall: "bun run",
},
} as const satisfies Readonly<Record<string, PackageManager>>;

Expand Down

0 comments on commit 3c1c124

Please sign in to comment.