From 79d0f2dc8ab416c15c5b1e73b6c6888ade8c848a Mon Sep 17 00:00:00 2001 From: Sunil Pai Date: Fri, 7 Jan 2022 22:11:22 +0000 Subject: [PATCH] rename `--public` as `--experimental-public` (#214) This PR is a breaking change. We'll keep it as a patch release tho. We want to change the behaviour of `--public` to closer match Pages behaviour, and only really expose it in v2.1 (maybe even after that). This PR renames the field as `experimental-public`, and adds warnings. In a future PR we'll actually change the behaviour. --- .changeset/new-carrots-relax.md | 5 +++++ packages/wrangler/src/index.tsx | 32 ++++++++++++++++++++++++++++---- 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 .changeset/new-carrots-relax.md diff --git a/.changeset/new-carrots-relax.md b/.changeset/new-carrots-relax.md new file mode 100644 index 000000000000..44285afa077a --- /dev/null +++ b/.changeset/new-carrots-relax.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +rename `--public` as `--experimental-public` diff --git a/packages/wrangler/src/index.tsx b/packages/wrangler/src/index.tsx index f55df60b37af..29afa023a139 100644 --- a/packages/wrangler/src/index.tsx +++ b/packages/wrangler/src/index.tsx @@ -455,7 +455,7 @@ export async function main(argv: string[]): Promise { describe: "Protocol to listen to requests on, defaults to http.", choices: ["http", "https"], }) - .option("public", { + .option("experimental-public", { describe: "Static assets to be served", type: "string", }) @@ -482,6 +482,18 @@ export async function main(argv: string[]): Promise { const { filename, format } = args; const config = args.config as Config; + if (args["experimental-public"]) { + console.warn( + "🚨 The --experimental-public field is experimental and will change in the future." + ); + } + + if (args.public) { + throw new Error( + "🚨 The --public field has been renamed to --experimental-public, and will change behaviour in the future." + ); + } + // -- snip, extract -- if (!args.local) { @@ -526,7 +538,7 @@ export async function main(argv: string[]): Promise { accountId={config.account_id} site={args.site || config.site?.bucket} port={args.port || config.dev?.port} - public={args.public} + public={args["experimental-public"]} compatibilityDate={config.compatibility_date} compatibilityFlags={config.compatibility_flags} usageModel={config.usage_model} @@ -580,7 +592,7 @@ export async function main(argv: string[]): Promise { describe: "name to use when uploading", type: "string", }) - .option("public", { + .option("experimental-public", { describe: "Static assets to be served", type: "string", }) @@ -619,6 +631,18 @@ export async function main(argv: string[]): Promise { "🚫 Local publishing is not yet supported" ); } + + if (args["experimental-public"]) { + console.warn( + "🚨 The --experimental-public field is experimental and will change in the future." + ); + } + if (args.public) { + throw new Error( + "🚨 The --public field has been renamed to --experimental-public, and will change behaviour in the future." + ); + } + const config = args.config as Config; // -- snip, extract -- @@ -648,7 +672,7 @@ export async function main(argv: string[]): Promise { jsxFactory: args["jsx-factory"], jsxFragment: args["jsx-fragment"], routes: args.routes, - public: args.public, + public: args["experimental-public"], site: args.site, }); }