Skip to content

Commit

Permalink
fix: add missing experimental templates to C3 for asset Workers (#6760)
Browse files Browse the repository at this point in the history
  • Loading branch information
petebacondarwin authored Sep 23, 2024
1 parent 1ca313f commit ba4ac82
Show file tree
Hide file tree
Showing 34 changed files with 1,311 additions and 42 deletions.
5 changes: 5 additions & 0 deletions .changeset/fast-rocks-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-cloudflare": patch
---

fix: add missing experimental templates to C3 for asset Workers
5 changes: 5 additions & 0 deletions packages/create-cloudflare/src/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import angularTemplateExperimental from "templates-experimental/angular/c3";
import astroTemplateExperimental from "templates-experimental/astro/c3";
import docusaurusTemplateExperimental from "templates-experimental/docusaurus/c3";
import gatsbyTemplateExperimental from "templates-experimental/gatsby/c3";
import assetsOnlyTemplateExperimental from "templates-experimental/hello-world-assets-only/c3";
import helloWorldWithDurableObjectAssetsTemplateExperimental from "templates-experimental/hello-world-durable-object-with-assets/c3";
import helloWorldWithAssetsTemplateExperimental from "templates-experimental/hello-world-with-assets/c3";
import nuxtTemplateExperimental from "templates-experimental/nuxt/c3";
import qwikTemplateExperimental from "templates-experimental/qwik/c3";
Expand Down Expand Up @@ -192,7 +194,10 @@ export function getFrameworkMap({ experimental = false }): TemplateMap {
export function getTemplateMap({ experimental = false }) {
if (experimental) {
return {
"hello-world-assets-only": assetsOnlyTemplateExperimental,
"hello-world-with-assets": helloWorldWithAssetsTemplateExperimental,
"hello-world-durable-object-with-assets":
helloWorldWithDurableObjectAssetsTemplateExperimental,
} as Record<string, TemplateConfig>;
} else {
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { TemplateConfig } from "../../src/templates";

const config: TemplateConfig = {
configVersion: 1,
id: "hello-world-assets-only",
path: "templates-experimental/hello-world-assets-only",
displayName: "Hello World - Assets-only",
description: "Get started with a basic Worker that only serves static assets",
platform: "workers",
copyFiles: {
path: "./templates",
},
};

export default config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "<TBD>",
"version": "0.0.0",
"private": true,
"scripts": {
"deploy": "wrangler deploy",
"dev": "wrangler dev",
"start": "wrangler dev"
},
"devDependencies": {
"wrangler": "^3.78.5"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hello, World!</title>
</head>
<body>
<h1 id="heading">Hello, World!</h1>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#:schema node_modules/wrangler/config-schema.json
name = "<TBD>"
compatibility_date = "<TBD>"
experimental_assets = { directory = "./public" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { TemplateConfig } from "../../src/templates";

const config: TemplateConfig = {
configVersion: 1,
id: "hello-world-durable-object-with-assets",
path: "templates-experimental/hello-world-durable-object-with-assets",
displayName: "Hello World - Worker Using Durable Objects with Assets",
description:
"Get started with a basic stateful app to build projects like real-time chats, collaborative apps, and multiplayer games, which hosts assets",
platform: "workers",
copyFiles: {
variants: {
js: {
path: "./js",
},
ts: {
path: "./ts",
},
},
},
};

export default config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# http://editorconfig.org
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.yml]
indent_style = space
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
# Logs

logs
_.log
npm-debug.log_
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)

report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# Runtime data

pids
_.pid
_.seed
\*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover

lib-cov

# Coverage directory used by tools like istanbul

coverage
\*.lcov

# nyc test coverage

.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)

.grunt

# Bower dependency directory (https://bower.io/)

bower_components

# node-waf configuration

.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)

build/Release

# Dependency directories

node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)

web_modules/

# TypeScript cache

\*.tsbuildinfo

# Optional npm cache directory

.npm

# Optional eslint cache

.eslintcache

# Optional stylelint cache

.stylelintcache

# Microbundle cache

.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history

.node_repl_history

# Output of 'npm pack'

\*.tgz

# Yarn Integrity file

.yarn-integrity

# dotenv environment variable files

.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)

.cache
.parcel-cache

# Next.js build output

.next
out

# Nuxt.js build / generate output

.nuxt
dist

# Gatsby files

.cache/

# Comment in the public line in if your project uses Gatsby and not Next.js

# https://nextjs.org/blog/next-9-1#public-directory-support

# public

# vuepress build output

.vuepress/dist

# vuepress v2.x temp and cache directory

.temp
.cache

# Docusaurus cache and generated files

.docusaurus

# Serverless directories

.serverless/

# FuseBox cache

.fusebox/

# DynamoDB Local files

.dynamodb/

# TernJS port file

.tern-port

# Stores VSCode versions used for testing VSCode extensions

.vscode-test

# yarn v2

.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.\*

# wrangler project

.dev.vars
.wrangler/
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 140,
"singleQuote": true,
"semi": true,
"useTabs": true
}
Loading

0 comments on commit ba4ac82

Please sign in to comment.