Skip to content

Commit 758bb22

Browse files
committed
rename --public as --experimental-public
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.
1 parent caa0143 commit 758bb22

File tree

2 files changed

+33
-4
lines changed

2 files changed

+33
-4
lines changed

.changeset/new-carrots-relax.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
rename `--public` as `--experimental-public`

packages/wrangler/src/index.tsx

+28-4
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ export async function main(argv: string[]): Promise<void> {
455455
describe: "Protocol to listen to requests on, defaults to http.",
456456
choices: ["http", "https"],
457457
})
458-
.option("public", {
458+
.option("experimental-public", {
459459
describe: "Static assets to be served",
460460
type: "string",
461461
})
@@ -482,6 +482,18 @@ export async function main(argv: string[]): Promise<void> {
482482
const { filename, format } = args;
483483
const config = args.config as Config;
484484

485+
if (args["experimental-public"]) {
486+
console.warn(
487+
"🚨 The --experimental-public field is experimental and will change in the future."
488+
);
489+
}
490+
491+
if (args.public) {
492+
throw new Error(
493+
"🚨 The --public field has been renamed to --experimental-public, and will change behaviour in the future."
494+
);
495+
}
496+
485497
// -- snip, extract --
486498

487499
if (!args.local) {
@@ -526,7 +538,7 @@ export async function main(argv: string[]): Promise<void> {
526538
accountId={config.account_id}
527539
site={args.site || config.site?.bucket}
528540
port={args.port || config.dev?.port}
529-
public={args.public}
541+
public={args["experimental-public"]}
530542
compatibilityDate={config.compatibility_date}
531543
compatibilityFlags={config.compatibility_flags}
532544
usageModel={config.usage_model}
@@ -580,7 +592,7 @@ export async function main(argv: string[]): Promise<void> {
580592
describe: "name to use when uploading",
581593
type: "string",
582594
})
583-
.option("public", {
595+
.option("experimental-public", {
584596
describe: "Static assets to be served",
585597
type: "string",
586598
})
@@ -619,6 +631,18 @@ export async function main(argv: string[]): Promise<void> {
619631
"🚫 Local publishing is not yet supported"
620632
);
621633
}
634+
635+
if (args["experimental-public"]) {
636+
console.warn(
637+
"🚨 The --experimental-public field is experimental and will change in the future."
638+
);
639+
}
640+
if (args.public) {
641+
throw new Error(
642+
"🚨 The --public field has been renamed to --experimental-public, and will change behaviour in the future."
643+
);
644+
}
645+
622646
const config = args.config as Config;
623647

624648
// -- snip, extract --
@@ -648,7 +672,7 @@ export async function main(argv: string[]): Promise<void> {
648672
jsxFactory: args["jsx-factory"],
649673
jsxFragment: args["jsx-fragment"],
650674
routes: args.routes,
651-
public: args.public,
675+
public: args["experimental-public"],
652676
site: args.site,
653677
});
654678
}

0 commit comments

Comments
 (0)