Skip to content

Commit 4e59768

Browse files
committed
fix: typecheck issues after demo merge
1 parent b95ca15 commit 4e59768

File tree

4 files changed

+83
-6
lines changed

4 files changed

+83
-6
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#!/bin/bash
2+
3+
# Deploy demo app to production using .env.production file
4+
5+
set -e # Exit on error
6+
set -u # Exit on undefined variable
7+
8+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
10+
ENV_FILE="$PROJECT_ROOT/.env.production"
11+
12+
# Check if .env.production exists
13+
if [ ! -f "$ENV_FILE" ]; then
14+
echo "❌ ERROR: .env.production file not found!"
15+
echo " Expected location: $ENV_FILE"
16+
echo ""
17+
echo " Please create the .env.production file with the following required variables:"
18+
echo " - VITE_SUPABASE_URL"
19+
echo " - VITE_SUPABASE_ANON_KEY"
20+
echo " - CLOUDFLARE_API_TOKEN"
21+
echo " - CLOUDFLARE_ACCOUNT_ID"
22+
exit 1
23+
fi
24+
25+
echo "✓ Found .env.production file"
26+
echo "Loading environment variables from .env.production..."
27+
set -a # Export all variables
28+
source "$ENV_FILE"
29+
set +a
30+
31+
# Validate required environment variables
32+
REQUIRED_VARS=(
33+
"VITE_SUPABASE_URL"
34+
"VITE_SUPABASE_ANON_KEY"
35+
"CLOUDFLARE_API_TOKEN"
36+
"CLOUDFLARE_ACCOUNT_ID"
37+
)
38+
39+
MISSING_VARS=()
40+
for var in "${REQUIRED_VARS[@]}"; do
41+
if [ -z "${!var:-}" ]; then
42+
MISSING_VARS+=("$var")
43+
fi
44+
done
45+
46+
if [ ${#MISSING_VARS[@]} -gt 0 ]; then
47+
echo "❌ ERROR: Missing required environment variables in .env.production:"
48+
for var in "${MISSING_VARS[@]}"; do
49+
echo " - $var"
50+
done
51+
exit 1
52+
fi
53+
54+
# Validate Supabase URL uses https
55+
if [[ ! "$VITE_SUPABASE_URL" =~ ^https:// ]]; then
56+
echo "❌ ERROR: VITE_SUPABASE_URL must use https:// (not http://)"
57+
echo " Current value: $VITE_SUPABASE_URL"
58+
exit 1
59+
fi
60+
61+
echo "✓ All required environment variables are set"
62+
63+
echo "Building demo app..."
64+
cd "$PROJECT_ROOT/../.." # Go to monorepo root
65+
pnpm nx run demo:build
66+
67+
echo "Deploying to production..."
68+
cd "$PROJECT_ROOT"
69+
wrangler deploy --env production
70+
71+
echo "✅ Deployment complete!"
72+
echo "Your app should be available at https://demo.pgflow.dev"

apps/demo/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"skipLibCheck": true,
1010
"sourceMap": true,
1111
"strict": true,
12-
"moduleResolution": "bundler"
12+
"moduleResolution": "bundler",
13+
"composite": true
1314
},
1415
"references": [
1516
{

pkgs/client/vite.config.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@ export default defineConfig({
77
root: __dirname,
88
cacheDir: '../../node_modules/.vite/pkgs/client',
99
plugins: [
10-
dts({
10+
dts({
1111
include: ['src/**/*.ts'],
1212
outDir: 'dist',
1313
rollupTypes: false, // Don't bundle for now
1414
insertTypesEntry: true,
15-
tsConfigFilePath: resolve(__dirname, 'tsconfig.lib.json'),
16-
skipDiagnostics: true // Skip TypeScript diagnostics to avoid vite-plugin-dts errors with monorepo project references.
17-
// The plugin tries to compile all imported files (including from other packages)
15+
tsconfigPath: resolve(__dirname, 'tsconfig.lib.json'),
16+
skipDiagnostics: true // Skip TypeScript diagnostics to avoid vite-plugin-dts errors with monorepo project references.
17+
// The plugin tries to compile all imported files (including from other packages)
1818
// which breaks rootDir boundaries. Nx runs proper type checking separately.
19-
})
19+
}) as any // Type cast to avoid Vite version mismatch between packages
20+
2021
],
2122
build: {
2223
lib: {

tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
},
2121
{
2222
"path": "./pkgs/client"
23+
},
24+
{
25+
"path": "./apps/demo"
2326
}
2427
]
2528
}

0 commit comments

Comments
 (0)