Repository navigation
Expand file tree
/
Copy pathbuild-deploy.js
More file actions
67 lines (59 loc) · 1.47 KB
/
Copy pathbuild-deploy.js
File metadata and controls
67 lines (59 loc) · 1.47 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const fs = require('fs');
const path = require('path');
// Create dist directory
const distDir = path.join(__dirname, 'dist');
if (fs.existsSync(distDir)) {
fs.rmSync(distDir, { recursive: true });
}
fs.mkdirSync(distDir, { recursive: true });
// Files and directories to copy
const itemsToCopy = [
'index.html',
'about',
'how-it-works',
'login',
'leaderboard',
'models',
'faq',
'js',
'css',
'components',
'assets',
'admin-email-system',
'config.js',
'theme.js',
'arena-core.js',
'arena-redesign.css',
'performance-monitor.js',
'manifest.json',
'robots.txt',
'sitemap.xml',
'js/ui/app.js' // Add the new app file
];
function copyRecursive(src, dest) {
if (!fs.existsSync(src)) {
console.log(`Skipping ${src} (not found)`);
return;
}
const stats = fs.statSync(src);
if (stats.isDirectory()) {
if (!fs.existsSync(dest)) {
fs.mkdirSync(dest, { recursive: true });
}
const files = fs.readdirSync(src);
files.forEach(file => {
copyRecursive(path.join(src, file), path.join(dest, file));
});
} else {
fs.copyFileSync(src, dest);
console.log(`Copied: ${src}`);
}
}
console.log('Building deployment package...\n');
itemsToCopy.forEach(item => {
const srcPath = path.join(__dirname, item);
const destPath = path.join(distDir, item);
copyRecursive(srcPath, destPath);
});
console.log('\n✅ Build complete! Files copied to dist/');
console.log('Run: wrangler deploy --config wrangler-dist.toml');