From 52223a8cfd309eca959163e1eaf80ac16ee66ee2 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Fri, 5 Sep 2025 17:03:25 -0600 Subject: [PATCH] Trigger a build with example wrangler --- apps/web/.gitignore | 3 +- apps/web/package.json | 2 +- apps/web/scripts/validate-env.ts | 2 ++ apps/web/wrangler.example.jsonc | 57 ++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 apps/web/wrangler.example.jsonc diff --git a/apps/web/.gitignore b/apps/web/.gitignore index b2636ac6c..5ba795ca0 100644 --- a/apps/web/.gitignore +++ b/apps/web/.gitignore @@ -17,4 +17,5 @@ storybook-static .env.production .env.staging .env.dev -.env.local \ No newline at end of file +.env.local +wrangler.jsonc \ No newline at end of file diff --git a/apps/web/package.json b/apps/web/package.json index bfa2551ad..6b1f34af3 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -4,7 +4,7 @@ "type": "module", "version": "0.0.1", "scripts": { - "prebuild": "[ \"$SKIP_ENV_CHECK\" = \"true\" ] || tsx scripts/validate-env.ts", + "prebuild": "tsx scripts/validate-env.ts", "build": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build -- --typecheck", "build:staging": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build --mode staging", "build:production": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build --mode production -- --typecheck", diff --git a/apps/web/scripts/validate-env.ts b/apps/web/scripts/validate-env.ts index 0b83a8011..043214613 100644 --- a/apps/web/scripts/validate-env.ts +++ b/apps/web/scripts/validate-env.ts @@ -13,6 +13,8 @@ const requiredEnv = { VITE_PUBLIC_URL: process.env.VITE_PUBLIC_URL, }; +console.log('🐓 The app will use this API URL:', process.env.VITE_PUBLIC_API_URL); + // Validate environment variables const { hasErrors } = validateEnv(requiredEnv); diff --git a/apps/web/wrangler.example.jsonc b/apps/web/wrangler.example.jsonc new file mode 100644 index 000000000..c1aad7322 --- /dev/null +++ b/apps/web/wrangler.example.jsonc @@ -0,0 +1,57 @@ +{ + "$schema": "node_modules/wrangler/config-schema.json", + "name": "web", + "main": "./.output/server/index.mjs", + "compatibility_date": "2025-09-02", //Happy birthday to Nate 🎉 + "compatibility_flags": ["nodejs_compat", "no_nodejs_compat_v2"], + + "assets": { + "directory": ".output/public" + }, + + "observability": { + "enabled": true + }, + + "env": { + // Development Environment + "dev": { + "name": "web-dev", + "vars": { + // Development-specific variables can be set here + // Or loaded from .env.dev file + } + }, + + // Staging Environment + "staging": { + "name": "web-staging", + "routes": [ + { + "pattern": "staging.buster.so", + "custom_domain": true + } + ], + "vars": { + // Staging-specific variables can be set here + // Or loaded from .env.staging file + } + }, + + // Production Environment + "production": { + "name": "web-production", + "routes": [ + // { + // "pattern": "app.buster.so", + // "custom_domain": true + // } + ], + "vars": { + // Production-specific variables can be set here + // Or loaded from .env.production file + } + } + } + } + \ No newline at end of file