mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-21 17:43:23 +01:00
Invoke wrangler to check if it's installed, but don't auto-install through npx/bunx
This commit is contained in:
parent
aa5d18dd1e
commit
66efca2cbb
5 changed files with 52 additions and 32 deletions
5
.changeset/brown-spies-grab.md
Normal file
5
.changeset/brown-spies-grab.md
Normal file
|
@ -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
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "wrangler-action",
|
"name": "wrangler-action",
|
||||||
"version": "3.5.0",
|
"version": "3.6.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "wrangler-action",
|
"name": "wrangler-action",
|
||||||
"version": "3.5.0",
|
"version": "3.6.1",
|
||||||
"license": "MIT OR Apache-2.0",
|
"license": "MIT OR Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
|
|
|
@ -90,7 +90,8 @@ async function installWrangler() {
|
||||||
let installedVersionSatisfiesRequirement = false;
|
let installedVersionSatisfiesRequirement = false;
|
||||||
try {
|
try {
|
||||||
const { stdout } = await getExecOutput(
|
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"],
|
["wrangler", "--version"],
|
||||||
{
|
{
|
||||||
cwd: config["workingDirectory"],
|
cwd: config["workingDirectory"],
|
||||||
|
|
|
@ -7,6 +7,7 @@ describe("getPackageManager", () => {
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"exec": "npx",
|
"exec": "npx",
|
||||||
|
"execNoInstall": "npx --no-install",
|
||||||
"install": "npm i",
|
"install": "npm i",
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
@ -15,6 +16,7 @@ describe("getPackageManager", () => {
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"exec": "yarn",
|
"exec": "yarn",
|
||||||
|
"execNoInstall": "yarn",
|
||||||
"install": "yarn add",
|
"install": "yarn add",
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
@ -23,6 +25,7 @@ describe("getPackageManager", () => {
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"exec": "pnpm exec",
|
"exec": "pnpm exec",
|
||||||
|
"execNoInstall": "pnpm exec",
|
||||||
"install": "pnpm add",
|
"install": "pnpm add",
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
@ -31,6 +34,7 @@ describe("getPackageManager", () => {
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"exec": "bunx",
|
"exec": "bunx",
|
||||||
|
"execNoInstall": "bun run",
|
||||||
"install": "bun i",
|
"install": "bun i",
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
@ -41,6 +45,7 @@ describe("getPackageManager", () => {
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"exec": "npx",
|
"exec": "npx",
|
||||||
|
"execNoInstall": "npx --no-install",
|
||||||
"install": "npm i",
|
"install": "npm i",
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
@ -51,6 +56,7 @@ describe("getPackageManager", () => {
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"exec": "yarn",
|
"exec": "yarn",
|
||||||
|
"execNoInstall": "yarn",
|
||||||
"install": "yarn add",
|
"install": "yarn add",
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
@ -61,6 +67,7 @@ describe("getPackageManager", () => {
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"exec": "pnpm exec",
|
"exec": "pnpm exec",
|
||||||
|
"execNoInstall": "pnpm exec",
|
||||||
"install": "pnpm add",
|
"install": "pnpm add",
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
@ -71,6 +78,7 @@ describe("getPackageManager", () => {
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"exec": "bunx",
|
"exec": "bunx",
|
||||||
|
"execNoInstall": "bun run",
|
||||||
"install": "bun i",
|
"install": "bun i",
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
@ -81,6 +89,7 @@ describe("getPackageManager", () => {
|
||||||
.toMatchInlineSnapshot(`
|
.toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"exec": "npx",
|
"exec": "npx",
|
||||||
|
"execNoInstall": "npx --no-install",
|
||||||
"install": "npm i",
|
"install": "npm i",
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
|
|
@ -4,24 +4,29 @@ import * as path from "node:path";
|
||||||
interface PackageManager {
|
interface PackageManager {
|
||||||
install: string;
|
install: string;
|
||||||
exec: string;
|
exec: string;
|
||||||
|
execNoInstall: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const PACKAGE_MANAGERS = {
|
const PACKAGE_MANAGERS = {
|
||||||
npm: {
|
npm: {
|
||||||
install: "npm i",
|
install: "npm i",
|
||||||
exec: "npx",
|
exec: "npx",
|
||||||
|
execNoInstall: "npx --no-install",
|
||||||
},
|
},
|
||||||
yarn: {
|
yarn: {
|
||||||
install: "yarn add",
|
install: "yarn add",
|
||||||
exec: "yarn",
|
exec: "yarn",
|
||||||
|
execNoInstall: "yarn",
|
||||||
},
|
},
|
||||||
pnpm: {
|
pnpm: {
|
||||||
install: "pnpm add",
|
install: "pnpm add",
|
||||||
exec: "pnpm exec",
|
exec: "pnpm exec",
|
||||||
|
execNoInstall: "pnpm exec",
|
||||||
},
|
},
|
||||||
bun: {
|
bun: {
|
||||||
install: "bun i",
|
install: "bun i",
|
||||||
exec: "bunx",
|
exec: "bunx",
|
||||||
|
execNoInstall: "bun run",
|
||||||
},
|
},
|
||||||
} as const satisfies Readonly<Record<string, PackageManager>>;
|
} as const satisfies Readonly<Record<string, PackageManager>>;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue