mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-25 03:14:46 +01:00
Add packageManager setting
This commit is contained in:
parent
f2e4cda4dd
commit
a009342d77
2 changed files with 9 additions and 0 deletions
|
@ -41,3 +41,6 @@ inputs:
|
||||||
vars:
|
vars:
|
||||||
description: "A string of environment variable names, separated by newlines. These will be bound to your Worker using the values of matching environment variables declared in `env` of this workflow."
|
description: "A string of environment variable names, separated by newlines. These will be bound to your Worker using the values of matching environment variables declared in `env` of this workflow."
|
||||||
required: false
|
required: false
|
||||||
|
packageManager:
|
||||||
|
description: "The name of the package manager to install and run wrangler. If not provided, it will be detected via the lock file. Valid values: [npm, pnpm, yarn]"
|
||||||
|
required: false
|
||||||
|
|
|
@ -14,6 +14,7 @@ import {
|
||||||
PackageManager,
|
PackageManager,
|
||||||
checkWorkingDirectory,
|
checkWorkingDirectory,
|
||||||
detectPackageManager,
|
detectPackageManager,
|
||||||
|
isValidPackageManager,
|
||||||
semverCompare,
|
semverCompare,
|
||||||
} from "./utils";
|
} from "./utils";
|
||||||
const execAsync = util.promisify(exec);
|
const execAsync = util.promisify(exec);
|
||||||
|
@ -53,9 +54,14 @@ const config = {
|
||||||
VARS: getMultilineInput("vars"),
|
VARS: getMultilineInput("vars"),
|
||||||
COMMANDS: getMultilineInput("command"),
|
COMMANDS: getMultilineInput("command"),
|
||||||
QUIET_MODE: getBooleanInput("quiet"),
|
QUIET_MODE: getBooleanInput("quiet"),
|
||||||
|
PACKAGE_MANAGER: getInput("packageManager"),
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
function realPackageManager(): PackageManager {
|
function realPackageManager(): PackageManager {
|
||||||
|
if (isValidPackageManager(config.PACKAGE_MANAGER)) {
|
||||||
|
return config.PACKAGE_MANAGER;
|
||||||
|
}
|
||||||
|
|
||||||
const packageManager = detectPackageManager(config.workingDirectory);
|
const packageManager = detectPackageManager(config.workingDirectory);
|
||||||
if (packageManager !== null) {
|
if (packageManager !== null) {
|
||||||
return packageManager;
|
return packageManager;
|
||||||
|
|
Loading…
Reference in a new issue