File tree Expand file tree Collapse file tree 6 files changed +80
-32
lines changed
packages/create-cloudflare Expand file tree Collapse file tree 6 files changed +80
-32
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " create-cloudflare " : patch
3+ ---
4+
5+ feat(create-cloudflare): Add Waku workers template
Original file line number Diff line number Diff line change @@ -625,37 +625,22 @@ function getFrameworkTestConfig(pm: string): NamedFrameworkTestConfig[] {
625625 } ,
626626 nodeCompat : false ,
627627 } ,
628+ waku : {
629+ testCommitMessage : true ,
630+ timeout : LONG_TIMEOUT ,
631+ unsupportedOSs : [ "win32" ] ,
632+ verifyDeploy : {
633+ route : "/" ,
634+ expectedText : "Waku" ,
635+ } ,
636+ verifyPreview : {
637+ route : "/" ,
638+ expectedText : "Waku" ,
639+ } ,
640+ verifyBuildCfTypes : {
641+ outputFile : "worker-configuration.d.ts" ,
642+ envInterfaceName : "Env" ,
643+ } ,
644+ } ,
628645 ] ;
629646}
630-
631- /**
632- * Gets the list of experimental framework test configurations.
633- */
634- function getExperimentalFrameworkTestConfig ( ) {
635- return [
636- // None right now
637- ] ;
638- }
639-
640- /**
641- * Get a list of Framework test configurations based on the provided `options`.
642- *
643- * @param options - An object containing the following properties:
644- * - isExperimentalMode: A boolean indicating if experimental mode is enabled.
645- * - FrameworkTestFilter: A string that can be used to filter the tests by "name" or "name:(pages|workers)".
646- */
647- export function getFrameworksTests ( ) : NamedFrameworkTestConfig [ ] {
648- const packageManager = detectPackageManager ( ) ;
649- const frameworkTests = isExperimental
650- ? getExperimentalFrameworkTestConfig ( )
651- : getFrameworkTestConfig ( packageManager . name ) ;
652- return frameworkTests . filter ( ( testConfig ) => {
653- if ( ! frameworkToTestFilter ) {
654- return true ;
655- }
656- if ( frameworkToTestFilter . includes ( ":" ) ) {
657- return testConfig . name === frameworkToTestFilter ;
658- }
659- return testConfig . name . split ( ":" ) [ 0 ] === frameworkToTestFilter ;
660- } ) ;
661- }
Original file line number Diff line number Diff line change 1717 "create-react-router" : " 7.6.3" ,
1818 "create-solid" : " 0.6.5" ,
1919 "create-vue" : " 3.17.0" ,
20+ "create-waku" : " 0.12.2-0.23.6-0" ,
2021 "gatsby" : " 5.14.5" ,
2122 "sv" : " 0.8.18" ,
2223 "nuxi" : " 3.25.1"
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ import scheduledTemplate from "templates/scheduled/c3";
4444import solidTemplate from "templates/solid/c3" ;
4545import svelteTemplate from "templates/svelte/c3" ;
4646import vueTemplate from "templates/vue/c3" ;
47+ import wakuTemplate from "templates/waku/c3" ;
4748import { isInsideGitRepo } from "./git" ;
4849import { validateProjectDirectory , validateTemplateUrl } from "./validators" ;
4950import type { Option } from "@cloudflare/cli/interactive" ;
@@ -206,6 +207,7 @@ export function getFrameworkMap({ experimental = false }): TemplateMap {
206207 solid : solidTemplate ,
207208 svelte : svelteTemplate ,
208209 vue : vueTemplate ,
210+ waku : wakuTemplate ,
209211 } ;
210212 }
211213}
Original file line number Diff line number Diff line change 1+ import { logRaw } from "@cloudflare/cli" ;
2+ import { runFrameworkGenerator } from "frameworks/index" ;
3+ import { detectPackageManager } from "helpers/packageManagers" ;
4+ import type { TemplateConfig } from "../../../src/templates" ;
5+ import type { C3Context } from "types" ;
6+
7+ const { npm } = detectPackageManager ( ) ;
8+
9+ const generate = async ( ctx : C3Context ) => {
10+ await runFrameworkGenerator ( ctx , [
11+ "--project-name" ,
12+ ctx . project . name ,
13+ "--template" ,
14+ "07_cloudflare" ,
15+ ] ) ;
16+ } ;
17+
18+ const config : TemplateConfig = {
19+ configVersion : 1 ,
20+ id : "waku" ,
21+ frameworkCli : "create-waku" ,
22+ platform : "workers" ,
23+ displayName : "Waku" ,
24+ path : "templates/workers/waku" ,
25+ generate,
26+ transformPackageJson : async ( ) => ( {
27+ scripts : {
28+ deploy : `${ npm } run build && wrangler deploy` ,
29+ preview : `${ npm } run build && wrangler dev` ,
30+ } ,
31+ } ) ,
32+ devScript : "dev" ,
33+ deployScript : "deploy" ,
34+ previewScript : "preview" ,
35+ } ;
36+ export default config ;
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " <TBD>" ,
3+ "main" : " ./dist/worker/serve-cloudflare.js" ,
4+ // https://developers.cloudflare.com/workers/platform/compatibility-dates
5+ "compatibility_date" : " <TBD>" ,
6+ // nodejs_als is required for Waku server-side request context
7+ // It can be removed if only building static pages
8+ "compatibility_flags" : [" nodejs_als" ],
9+ // https://developers.cloudflare.com/workers/static-assets/binding/
10+ "assets" : {
11+ "binding" : " ASSETS" ,
12+ "directory" : " ./dist/assets" ,
13+ "html_handling" : " drop-trailing-slash" ,
14+ "not_found_handling" : " 404-page"
15+ },
16+ "vars" : {
17+ "MAX_ITEMS" : 10
18+ }
19+ }
You can’t perform that action at this time.
0 commit comments