Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(wrangler): setup x-provision flag #7348

Merged
merged 6 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/purple-coats-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

Added `x-provision` global option

This experimental flag currently has no effect. More details will be shared as we roll out its functionality.
2 changes: 2 additions & 0 deletions packages/wrangler/src/api/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export async function unstable_dev(
...options,
logLevel: options?.logLevel ?? defaultLogLevel,
port: options?.port ?? 0,
experimentalProvision: undefined,
experimentalVersions: undefined,
experimentalDevEnv: undefined,
experimentalRegistry: fileBasedRegistry,
Expand All @@ -228,6 +229,7 @@ export async function unstable_dev(
const devServer = await run(
{
FILE_BASED_REGISTRY: fileBasedRegistry,
RESOURCES_PROVISION: false,
},
() => startDev(devOptions)
);
Expand Down
1 change: 1 addition & 0 deletions packages/wrangler/src/api/integrations/platform/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export async function getPlatformProxy<
const miniflareOptions = await run(
{
FILE_BASED_REGISTRY: Boolean(options.experimentalRegistry ?? true),
RESOURCES_PROVISION: false,
},
() => getMiniflareOptionsFromConfig(rawConfig, env, options)
);
Expand Down
11 changes: 11 additions & 0 deletions packages/wrangler/src/deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { processAssetsArg, validateAssetsArgsAndConfig } from "../assets";
import { configFileName, findWranglerConfig, readConfig } from "../config";
import { getEntry } from "../deployment-bundle/entry";
import { UserError } from "../errors";
import { run } from "../experimental-flags";
import {
getRules,
getScriptName,
Expand Down Expand Up @@ -234,6 +235,16 @@ export function deployOptions(yargs: CommonYargsArgv) {
export type DeployArgs = StrictYargsOptionsToInterface<typeof deployOptions>;

export async function deployHandler(args: DeployArgs) {
await run(
{
FILE_BASED_REGISTRY: false,
RESOURCES_PROVISION: args.experimentalProvision ?? false,
},
() => deployWorker(args)
);
}

async function deployWorker(args: DeployArgs) {
await printWranglerBanner();

// Check for deprecated `wrangler publish` command
Expand Down
1 change: 1 addition & 0 deletions packages/wrangler/src/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ const command = defineCommand({
const devInstance = await run(
{
FILE_BASED_REGISTRY: args.experimentalRegistry,
RESOURCES_PROVISION: false,
},
() => startDev(args)
);
Expand Down
1 change: 1 addition & 0 deletions packages/wrangler/src/experimental-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { logger } from "./logger";

type ExperimentalFlags = {
FILE_BASED_REGISTRY: boolean;
RESOURCES_PROVISION: boolean;
};

const flags = new AsyncLocalStorage<ExperimentalFlags>();
Expand Down
1 change: 1 addition & 0 deletions packages/wrangler/src/generate/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export async function generateHandler(args: GenerateArgs) {
_: args._,
$0: args.$0,
experimentalVersions: args.experimentalVersions,
experimentalProvision: args.experimentalProvision,
});
}

Expand Down
6 changes: 6 additions & 0 deletions packages/wrangler/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ export function createCLIParser(argv: string[]) {

return true;
})
.option("experimental-provision", {
describe: `Experimental: Enable automatic resource provisioning`,
type: "boolean",
hidden: true,
alias: ["x-provision"],
})
.epilogue(
`Please report any issues to ${chalk.hex("#3B818D")(
"https://github.com/cloudflare/workers-sdk/issues/new/choose"
Expand Down
1 change: 1 addition & 0 deletions packages/wrangler/src/yargs-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface CommonYargsOptions {
config: string | undefined;
env: string | undefined;
"experimental-versions": boolean | undefined;
"experimental-provision": boolean | undefined;
}

/**
Expand Down
Loading