Skip to content

Commit efca957

Browse files
committed
graduate hello world workers assets templates
1 parent b24497d commit efca957

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
@@ -21,9 +21,6 @@ import {
2121
import angularTemplateExperimental from "templates-experimental/angular/c3";
2222
import astroTemplateExperimental from "templates-experimental/astro/c3";
2323
import gatsbyTemplateExperimental from "templates-experimental/gatsby/c3";
24-
import assetsOnlyTemplateExperimental from "templates-experimental/hello-world-assets-only/c3";
25-
import helloWorldWithDurableObjectAssetsTemplateExperimental from "templates-experimental/hello-world-durable-object-with-assets/c3";
26-
import helloWorldWithAssetsTemplateExperimental from "templates-experimental/hello-world-with-assets/c3";
2724
import honoTemplateExperimental from "templates-experimental/hono/c3";
2825
import nextTemplateExperimental from "templates-experimental/next/c3";
2926
import nuxtTemplateExperimental from "templates-experimental/nuxt/c3";
@@ -38,8 +35,11 @@ import astroTemplate from "templates/astro/c3";
3835
import commonTemplate from "templates/common/c3";
3936
import docusaurusTemplate from "templates/docusaurus/c3";
4037
import gatsbyTemplate from "templates/gatsby/c3";
38+
import assetsOnlyTemplate from "templates/hello-world-assets-only/c3";
39+
import helloWorldWithDurableObjectAssetsTemplate from "templates/hello-world-durable-object-with-assets/c3";
4140
import helloWorldDurableObjectTemplate from "templates/hello-world-durable-object/c3";
42-
import helloWorldTemplate from "templates/hello-world/c3";
41+
import helloWorldWithAssetsTemplate from "templates/hello-world-with-assets/c3";
42+
import helloWorldWorkerTemplate from "templates/hello-world/c3";
4343
import honoTemplate from "templates/hono/c3";
4444
import nextTemplate from "templates/next/c3";
4545
import nuxtTemplate from "templates/nuxt/c3";
@@ -214,19 +214,18 @@ export function getFrameworkMap({ experimental = false }): TemplateMap {
214214

215215
export function getTemplateMap({ experimental = false }) {
216216
if (experimental) {
217-
return {
218-
"hello-world-assets-only": assetsOnlyTemplateExperimental,
219-
"hello-world-with-assets": helloWorldWithAssetsTemplateExperimental,
220-
"hello-world-durable-object-with-assets":
221-
helloWorldWithDurableObjectAssetsTemplateExperimental,
222-
} as Record<string, TemplateConfig>;
217+
return {} as Record<string, TemplateConfig>;
223218
} else {
224219
return {
225-
"hello-world": helloWorldTemplate,
220+
"hello-world": helloWorldWorkerTemplate,
221+
"hello-world-assets-only": assetsOnlyTemplate,
222+
"hello-world-with-assets": helloWorldWithAssetsTemplate,
223+
"hello-world-durable-object": helloWorldDurableObjectTemplate,
224+
"hello-world-durable-object-with-assets":
225+
helloWorldWithDurableObjectAssetsTemplate,
226226
common: commonTemplate,
227227
scheduled: scheduledTemplate,
228228
queues: queuesTemplate,
229-
"hello-world-durable-object": helloWorldDurableObjectTemplate,
230229
openapi: openapiTemplate,
231230
"pre-existing": preExistingTemplate,
232231
} as Record<string, TemplateConfig>;
@@ -374,9 +373,10 @@ export const createContext = async (
374373

375374
const categoryOptions = [
376375
{
377-
label: "Hello World example",
376+
label: "Hello World Starter",
378377
value: "hello-world",
379-
description: "Select from barebones examples to get started with Workers",
378+
description:
379+
"Select from basic scaffolds to get started with Workers, Assets and Durable Objects",
380380
},
381381
{
382382
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)