Skip to content

Commit 1ba9e97

Browse files
remove BETA label from Workers+Assets templates and hide Pages templates (#8698)
* remove BETA label from Workers+Assets templates and hide Pages templates * Skip the platform question if there is only one option * include hiding of next-on-pages * update snapshots
1 parent 9a3d43c commit 1ba9e97

File tree

16 files changed

+57
-19
lines changed

16 files changed

+57
-19
lines changed

.changeset/clever-squids-unite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-cloudflare": patch
3+
---
4+
5+
remove BETA label from Workers+Assets templates and hide Pages templates

packages/create-cloudflare/e2e-tests/cli.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,10 @@ describe.skipIf(frameworkToTest || isQuarantineMode())("help text", () => {
486486
--platform=<value>
487487
Whether the application should be deployed to Pages or Workers. This is only applicable for Frameworks templates that support both Pages and Workers.
488488
Allowed Values:
489+
workers
490+
Create a web application that can be deployed to Workers.
489491
pages
490492
Create a web application that can be deployed to Pages.
491-
workers
492-
Create a web application that can be deployed to Workers (BETA).
493493
--lang=<value>
494494
The programming language of the template
495495
Allowed Values:
@@ -576,10 +576,10 @@ describe.skipIf(frameworkToTest || isQuarantineMode())("help text", () => {
576576
--platform=<value>
577577
Whether the application should be deployed to Pages or Workers. This is only applicable for Frameworks templates that support both Pages and Workers.
578578
Allowed Values:
579+
workers
580+
Create a web application that can be deployed to Workers.
579581
pages
580582
Create a web application that can be deployed to Pages.
581-
workers
582-
Create a web application that can be deployed to Workers (BETA).
583583
--lang=<value>
584584
The programming language of the template
585585
Allowed Values:

packages/create-cloudflare/src/helpers/args.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ export const cliDefinition: ArgumentsDefinition = {
129129
description: `Whether the application should be deployed to Pages or Workers. This is only applicable for Frameworks templates that support both Pages and Workers.`,
130130
values: [
131131
{
132-
name: "pages",
132+
name: "workers",
133133
description:
134-
"Create a web application that can be deployed to Pages.",
134+
"Create a web application that can be deployed to Workers.",
135135
},
136136
{
137-
name: "workers",
137+
name: "pages",
138138
description:
139-
"Create a web application that can be deployed to Workers (BETA).",
139+
"Create a web application that can be deployed to Pages.",
140140
},
141141
],
142142
requiresArg: true,

packages/create-cloudflare/src/templates.ts

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -467,22 +467,43 @@ export const createContext = async (
467467
}
468468

469469
if ("platformVariants" in frameworkConfig) {
470+
const availableVariants = Object.entries(
471+
frameworkConfig.platformVariants,
472+
).filter(([, config]) => !config.hidden) as [
473+
keyof typeof frameworkConfig.platformVariants,
474+
TemplateConfig,
475+
][];
476+
477+
if (availableVariants.length === 1) {
478+
args.platform ??= availableVariants[0][0];
479+
}
480+
470481
const platform = await processArgument(args, "platform", {
471482
type: "select",
472483
label: "platform",
473484
question: "Select your deployment platform",
474485
options: [
475-
{
476-
label: "Workers with Assets (BETA)",
477-
value: "workers",
478-
description:
479-
"Take advantage of the full Developer Platform, including R2, Queues, Durable Objects and more.",
480-
},
481-
{
482-
label: "Pages",
483-
value: "pages",
484-
description: "Great for simple websites and applications.",
485-
},
486+
...(args.platform === "workers" ||
487+
!frameworkConfig.platformVariants.workers.hidden
488+
? [
489+
{
490+
label: "Workers with Assets",
491+
value: "workers",
492+
description:
493+
"Take advantage of the full Developer Platform, including R2, Queues, Durable Objects and more.",
494+
},
495+
]
496+
: []),
497+
...(args.platform === "pages" ||
498+
!frameworkConfig.platformVariants.pages.hidden
499+
? [
500+
{
501+
label: "Pages",
502+
value: "pages",
503+
description: "Great for simple websites and applications.",
504+
},
505+
]
506+
: []),
486507
backOption,
487508
],
488509
defaultValue: "workers",

packages/create-cloudflare/templates/angular/pages/c3.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ const config: TemplateConfig = {
9595
frameworkCli: "@angular/create",
9696
displayName: "Angular",
9797
platform: "pages",
98+
hidden: true,
9899
copyFiles: {
99100
path: "./templates",
100101
},

packages/create-cloudflare/templates/astro/pages/c3.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const config: TemplateConfig = {
6363
id: "astro",
6464
frameworkCli: "create-astro",
6565
platform: "pages",
66+
hidden: true,
6667
displayName: "Astro",
6768
path: "templates/astro/pages",
6869
copyFiles: {

packages/create-cloudflare/templates/docusaurus/pages/c3.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const config: TemplateConfig = {
1414
id: "docusaurus",
1515
frameworkCli: "create-docusaurus",
1616
platform: "pages",
17+
hidden: true,
1718
displayName: "Docusaurus",
1819
path: "templates/docusaurus/pages",
1920
generate,

packages/create-cloudflare/templates/gatsby/pages/c3.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const config: TemplateConfig = {
3434
id: "gatsby",
3535
frameworkCli: "gatsby",
3636
platform: "pages",
37+
hidden: true,
3738
displayName: "Gatsby",
3839
path: "templates/gatsby/pages",
3940
generate,

packages/create-cloudflare/templates/hono/pages/c3.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const config: TemplateConfig = {
2929
},
3030
path: "templates/hono/pages",
3131
platform: "pages",
32+
hidden: true,
3233
generate,
3334
transformPackageJson: async () => ({
3435
scripts: {

packages/create-cloudflare/templates/next/pages/c3.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ export default {
161161
id: "next",
162162
frameworkCli: "create-next-app",
163163
platform: "pages",
164+
hidden: true,
164165
displayName: "Next.js",
165166
path: "templates/next/pages",
166167
generate,

0 commit comments

Comments
 (0)