mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-21 17:43:23 +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:
|
||||
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
|
||||
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,
|
||||
checkWorkingDirectory,
|
||||
detectPackageManager,
|
||||
isValidPackageManager,
|
||||
semverCompare,
|
||||
} from "./utils";
|
||||
const execAsync = util.promisify(exec);
|
||||
|
@ -53,9 +54,14 @@ const config = {
|
|||
VARS: getMultilineInput("vars"),
|
||||
COMMANDS: getMultilineInput("command"),
|
||||
QUIET_MODE: getBooleanInput("quiet"),
|
||||
PACKAGE_MANAGER: getInput("packageManager"),
|
||||
} as const;
|
||||
|
||||
function realPackageManager(): PackageManager {
|
||||
if (isValidPackageManager(config.PACKAGE_MANAGER)) {
|
||||
return config.PACKAGE_MANAGER;
|
||||
}
|
||||
|
||||
const packageManager = detectPackageManager(config.workingDirectory);
|
||||
if (packageManager !== null) {
|
||||
return packageManager;
|
||||
|
|
Loading…
Reference in a new issue