Skip to content

Commit edc37a4

Browse files
emily-shenpetebacondarwin
authored andcommitted
graduate hello world workers assets templates
1 parent 3536670 commit edc37a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+51
-51
lines changed

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

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,35 @@ type WorkerTestConfig = RunnerConfig & {
3232

3333
function getWorkerTests(opts: { experimental: boolean }): WorkerTestConfig[] {
3434
if (opts.experimental) {
35+
// none currently
36+
return [];
37+
} else {
3538
return [
39+
{
40+
template: "hello-world",
41+
variants: ["ts", "js"],
42+
verifyDeploy: {
43+
route: "/",
44+
expectedText: "Hello World!",
45+
},
46+
verifyPreview: {
47+
route: "/",
48+
expectedText: "Hello World!",
49+
},
50+
verifyTest: true,
51+
},
52+
{
53+
template: "hello-world",
54+
variants: ["python"],
55+
verifyDeploy: {
56+
route: "/",
57+
expectedText: "Hello World!",
58+
},
59+
verifyPreview: {
60+
route: "/",
61+
expectedText: "Hello World!",
62+
},
63+
},
3664
{
3765
template: "hello-world-with-assets",
3866
variants: ["ts", "js"],
@@ -78,34 +106,6 @@ function getWorkerTests(opts: { experimental: boolean }): WorkerTestConfig[] {
78106
verifyPreview: null,
79107
argv: ["--category", "hello-world"],
80108
},
81-
];
82-
} else {
83-
return [
84-
{
85-
template: "hello-world",
86-
variants: ["ts", "js"],
87-
verifyDeploy: {
88-
route: "/",
89-
expectedText: "Hello World!",
90-
},
91-
verifyPreview: {
92-
route: "/",
93-
expectedText: "Hello World!",
94-
},
95-
verifyTest: true,
96-
},
97-
{
98-
template: "hello-world",
99-
variants: ["python"],
100-
verifyDeploy: {
101-
route: "/",
102-
expectedText: "Hello World!",
103-
},
104-
verifyPreview: {
105-
route: "/",
106-
expectedText: "Hello World!",
107-
},
108-
},
109109
{
110110
template: "common",
111111
variants: ["ts", "js"],

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const isUpdateAvailable = async () => {
4848
export const C3_DEFAULTS: C3Args = {
4949
projectName: new Haikunator().haikunate({ tokenHex: true }),
5050
category: "hello-world",
51-
type: "hello-world",
51+
type: "hello-world-with-assets",
5252
framework: "analog",
5353
experimental: false,
5454
autoUpdate: true,

packages/create-cloudflare/src/templates.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ import {
1919
writeJSON,
2020
} from "helpers/files";
2121
import astroTemplateExperimental from "templates-experimental/astro/c3";
22-
import assetsOnlyTemplateExperimental from "templates-experimental/hello-world-assets-only/c3";
23-
import helloWorldWithDurableObjectAssetsTemplateExperimental from "templates-experimental/hello-world-durable-object-with-assets/c3";
24-
import helloWorldWithAssetsTemplateExperimental from "templates-experimental/hello-world-with-assets/c3";
2522
import honoTemplateExperimental from "templates-experimental/hono/c3";
2623
import nextTemplateExperimental from "templates-experimental/next/c3";
2724
import qwikTemplateExperimental from "templates-experimental/qwik/c3";
@@ -34,8 +31,11 @@ import astroTemplate from "templates/astro/c3";
3431
import commonTemplate from "templates/common/c3";
3532
import docusaurusTemplate from "templates/docusaurus/c3";
3633
import gatsbyTemplate from "templates/gatsby/c3";
34+
import assetsOnlyTemplate from "templates/hello-world-assets-only/c3";
35+
import helloWorldWithDurableObjectAssetsTemplate from "templates/hello-world-durable-object-with-assets/c3";
3736
import helloWorldDurableObjectTemplate from "templates/hello-world-durable-object/c3";
38-
import helloWorldTemplate from "templates/hello-world/c3";
37+
import helloWorldWithAssetsTemplate from "templates/hello-world-with-assets/c3";
38+
import helloWorldWorkerTemplate from "templates/hello-world/c3";
3939
import honoTemplate from "templates/hono/c3";
4040
import nextTemplate from "templates/next/c3";
4141
import nuxtTemplate from "templates/nuxt/c3";
@@ -206,19 +206,18 @@ export function getFrameworkMap({ experimental = false }): TemplateMap {
206206

207207
export function getTemplateMap({ experimental = false }) {
208208
if (experimental) {
209-
return {
210-
"hello-world-assets-only": assetsOnlyTemplateExperimental,
211-
"hello-world-with-assets": helloWorldWithAssetsTemplateExperimental,
212-
"hello-world-durable-object-with-assets":
213-
helloWorldWithDurableObjectAssetsTemplateExperimental,
214-
} as Record<string, TemplateConfig>;
209+
return {} as Record<string, TemplateConfig>;
215210
} else {
216211
return {
217-
"hello-world": helloWorldTemplate,
212+
"hello-world": helloWorldWorkerTemplate,
213+
"hello-world-assets-only": assetsOnlyTemplate,
214+
"hello-world-with-assets": helloWorldWithAssetsTemplate,
215+
"hello-world-durable-object": helloWorldDurableObjectTemplate,
216+
"hello-world-durable-object-with-assets":
217+
helloWorldWithDurableObjectAssetsTemplate,
218218
common: commonTemplate,
219219
scheduled: scheduledTemplate,
220220
queues: queuesTemplate,
221-
"hello-world-durable-object": helloWorldDurableObjectTemplate,
222221
openapi: openapiTemplate,
223222
"pre-existing": preExistingTemplate,
224223
} as Record<string, TemplateConfig>;
@@ -366,9 +365,10 @@ export const createContext = async (
366365

367366
const categoryOptions = [
368367
{
369-
label: "Hello World example",
368+
label: "Hello World Starter",
370369
value: "hello-world",
371-
description: "Select from barebones examples to get started with Workers",
370+
description:
371+
"Select from basic scaffolds to get started with Workers, Assets and Durable Objects",
372372
},
373373
{
374374
label: "Framework Starter",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import type { TemplateConfig } from "../../src/templates";
33
const config: TemplateConfig = {
44
configVersion: 1,
55
id: "hello-world-assets-only",
6-
path: "templates-experimental/hello-world-assets-only",
7-
displayName: "Hello World - Assets-only",
6+
path: "templates/hello-world-assets-only",
7+
displayName: "Static Assets only",
88
description: "Get started with a basic Worker that only serves static assets",
99
platform: "workers",
1010
copyFiles: {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import type { TemplateConfig } from "../../src/templates";
33
const config: TemplateConfig = {
44
configVersion: 1,
55
id: "hello-world-durable-object-with-assets",
6-
path: "templates-experimental/hello-world-durable-object-with-assets",
7-
displayName: "Hello World - Worker Using Durable Objects with Assets",
6+
path: "templates/hello-world-durable-object-with-assets",
7+
displayName: "Worker + Static Assets + Durable Object",
88
description:
99
"Get started with a basic stateful app to build projects like real-time chats, collaborative apps, and multiplayer games, which hosts assets",
1010
platform: "workers",

0 commit comments

Comments
 (0)