Skip to content

Commit

Permalink
Rename command definition behaviour from "useConfigRedirect" to "useC…
Browse files Browse the repository at this point in the history
…onfigRedirectIfAvailable"
  • Loading branch information
petebacondarwin committed Jan 8, 2025
1 parent fc72a15 commit 893f7e9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion packages/wrangler/src/core/register-yargs-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ function createHandler(def: CommandDefinition) {
def.behaviour?.provideConfig ?? true
? readConfig(args, {
hideWarnings: !(def.behaviour?.printConfigWarnings ?? true),
useRedirectIfAvailable: def.behaviour?.useConfigRedirect,
useRedirectIfAvailable:
def.behaviour?.useConfigRedirectIfAvailable,
})
: defaultWranglerConfig,
errors: { UserError, FatalError },
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/core/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export type CommandDefinition<
/**
* If true, then look for a redirect file at `.wrangler/deploy/config.json` and use that to find the Wrangler configuration file.
*/
useConfigRedirect?: boolean;
useConfigRedirectIfAvailable?: boolean;
};

/**
Expand Down
6 changes: 2 additions & 4 deletions packages/wrangler/src/versions/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
spinnerWhile,
} from "@cloudflare/cli/interactive";
import { fetchResult } from "../cfetch";
import { readConfig } from "../config";
import { createCommand } from "../core/create-command";
import { UserError } from "../errors";
import { isNonInteractiveOrCI } from "../is-interactive";
Expand Down Expand Up @@ -49,7 +48,7 @@ export const versionsDeployCommand = createCommand({
status: "stable",
},
behaviour: {
provideConfig: false,
useConfigRedirectIfAvailable: true,
},

args: {
Expand Down Expand Up @@ -101,8 +100,7 @@ export const versionsDeployCommand = createCommand({
},
},
positionalArgs: ["version-specs"],
handler: async function versionsDeployHandler(args) {
const config = readConfig(args, { useRedirectIfAvailable: true });
handler: async function versionsDeployHandler(args, { config }) {
metrics.sendMetricsEvent(
"deploy worker versions",
{},
Expand Down
3 changes: 1 addition & 2 deletions packages/wrangler/src/versions/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,7 @@ export const versionsUploadCommand = createCommand({
},
},
behaviour: {
provideConfig: true,
useConfigRedirect: true,
useConfigRedirectIfAvailable: true,
},
handler: async function versionsUploadHandler(args, { config }) {
const entry = await getEntry(args, config, "versions upload");
Expand Down

0 comments on commit 893f7e9

Please sign in to comment.