-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproduction-build.js
More file actions
52 lines (43 loc) · 1.44 KB
/
Copy pathproduction-build.js
File metadata and controls
52 lines (43 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env node
// Production build script with optimizations
import { execSync } from 'child_process';
import fs from 'fs';
import path from 'path';
console.log('🚀 Starting production build...');
try {
// Clean existing dist
if (fs.existsSync('dist')) {
fs.rmSync('dist', { recursive: true, force: true });
}
// Build frontend with optimizations
console.log('📦 Building frontend...');
execSync('vite build --mode production', { stdio: 'inherit' });
// Build backend
console.log('🔧 Building backend...');
execSync('esbuild server/index.ts --platform=node --packages=external --bundle --format=esm --outdir=dist --minify', { stdio: 'inherit' });
// Copy package.json for deployment
const packageJson = {
"name": "boomchain-labs",
"version": "1.0.0",
"type": "module",
"scripts": {
"start": "NODE_ENV=production node dist/index.js"
},
"dependencies": {
"@neondatabase/serverless": "^0.10.4",
"drizzle-orm": "^0.36.1",
"express": "^4.19.2",
"express-session": "^1.18.1",
"connect-pg-simple": "^9.0.1",
"passport": "^0.7.0",
"passport-local": "^1.0.0",
"zod": "^3.23.8"
}
};
fs.writeFileSync('dist/package.json', JSON.stringify(packageJson, null, 2));
console.log('✅ Production build complete!');
console.log('📁 Files ready in ./dist directory');
} catch (error) {
console.error('❌ Build failed:', error.message);
process.exit(1);
}