From efe7ad6027c1b8063dfc315767c3d29b44a90fb2 Mon Sep 17 00:00:00 2001 From: Diego Resendez Date: Thu, 24 Sep 2026 12:58:16 -0500 Subject: [PATCH] feat(new): scaffold core 26.9.0-beta.2, and boot before binding on Deno and Bun beta.2 made serveDeno and serveBun boot the app before they bind. The starters called Deno.serve and Bun.serve with app.fetch directly, so a provider that failed left an open port answering 500 to everything. Signed-off-by: Diego Resendez --- src/template.rs | 11 ++++++++--- template/runtimes/bun/src/main.ts | 6 +++++- template/runtimes/deno/src/main.ts | 6 +++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/template.rs b/src/template.rs index 03d28e2..a5b3e08 100644 --- a/src/template.rs +++ b/src/template.rs @@ -14,7 +14,7 @@ use crate::runtime::Runtime; /// reaches a stable major this becomes a range (`^27`) and the exactness stops /// mattering; until then the `core-freshness` CI job fails when this falls /// behind the `beta` dist-tag, which is what keeps it current. -pub const CORE_VERSION: &str = "26.9.0-beta.1"; +pub const CORE_VERSION: &str = "26.9.0-beta.2"; pub static SHARED: Dir = include_dir!("$CARGO_MANIFEST_DIR/template/shared"); pub static RUNTIME_DENO: Dir = include_dir!("$CARGO_MANIFEST_DIR/template/runtimes/deno"); @@ -137,7 +137,10 @@ mod tests { assert!(d.path().join("deno.json").exists()); assert!(d.path().join("matcha.toml").exists()); let main = std::fs::read_to_string(d.path().join("src/main.ts")).unwrap(); - assert!(main.contains("Deno.serve")); + // serveDeno boots before it binds; Deno.serve(app.fetch) bound first and + // left a port answering 500 when a provider failed. + assert!(main.contains("await serveDeno(app")); + assert!(!main.contains("Deno.serve(")); assert!(!d.path().join("package.json").exists()); let deno_json = std::fs::read_to_string(d.path().join("deno.json")).unwrap(); @@ -177,7 +180,9 @@ mod tests { assert!(pkg.contains("\"name\": \"my-api\"")); assert!(!pkg.contains("{{project_name}}")); let main = std::fs::read_to_string(d.path().join("src/main.ts")).unwrap(); - assert!(main.contains("Bun.serve")); + // Same reason as Deno: serveBun boots first. + assert!(main.contains("await serveBun(app")); + assert!(!main.contains("Bun.serve(")); assert!(!d.path().join("deno.json").exists()); } } diff --git a/template/runtimes/bun/src/main.ts b/template/runtimes/bun/src/main.ts index af63cac..d4c9594 100644 --- a/template/runtimes/bun/src/main.ts +++ b/template/runtimes/bun/src/main.ts @@ -1,4 +1,8 @@ +import { serveBun } from '@green-tea/core/bun'; + import { app } from './app'; -Bun.serve({ port: 8000, fetch: app.fetch }); +// Boots before it binds: a provider that fails stops the process here, instead +// of leaving an open port that answers 500 to everything. +await serveBun(app, { port: 8000 }); console.log('🍵 green-tea running on http://localhost:8000'); diff --git a/template/runtimes/deno/src/main.ts b/template/runtimes/deno/src/main.ts index a2c938f..1991082 100644 --- a/template/runtimes/deno/src/main.ts +++ b/template/runtimes/deno/src/main.ts @@ -1,4 +1,8 @@ +import { serveDeno } from '@green-tea/core/deno'; + import { app } from './app'; -Deno.serve({ port: 8000 }, app.fetch); +// Boots before it binds: a provider that fails stops the process here, instead +// of leaving an open port that answers 500 to everything. +await serveDeno(app, { port: 8000 }); console.log('🍵 green-tea running on http://localhost:8000');