9d876de930
- Complete refactoring of old frontend into Next.js App Router workspace - Redesigned sidebar collapsing animation with absolute toggle positioning - Resolved visual canvas bleed transitions between light/dark themes - Added custom dark theme variant for toggle switch buttons - Implemented full localization across Indonesian, English, Spanish, Japanese, and Chinese - Synchronized HTML document themes to apply dark mode styles to portals/overlays
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const srcDir = path.join(__dirname, 'out');
|
|
const destDir = path.join(__dirname, '..', 'frontend');
|
|
|
|
function copyDirSync(src, dest) {
|
|
fs.mkdirSync(dest, { recursive: true });
|
|
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
|
|
for (let entry of entries) {
|
|
const srcPath = path.join(src, entry.name);
|
|
const destPath = path.join(dest, entry.name);
|
|
|
|
if (entry.isDirectory()) {
|
|
copyDirSync(srcPath, destPath);
|
|
} else {
|
|
fs.copyFileSync(srcPath, destPath);
|
|
}
|
|
}
|
|
}
|
|
|
|
function cleanDirSync(dir) {
|
|
if (!fs.existsSync(dir)) return;
|
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
for (let entry of entries) {
|
|
if (entry.name === '.git' || entry.name === '.antigravitycli') continue;
|
|
const fullPath = path.join(dir, entry.name);
|
|
if (entry.isDirectory()) {
|
|
fs.rmSync(fullPath, { recursive: true, force: true });
|
|
} else {
|
|
fs.unlinkSync(fullPath);
|
|
}
|
|
}
|
|
}
|
|
|
|
try {
|
|
console.log('Wiping old static files in frontend/ ...');
|
|
cleanDirSync(destDir);
|
|
|
|
console.log('Copying static Next.js assets to frontend/ ...');
|
|
if (fs.existsSync(srcDir)) {
|
|
copyDirSync(srcDir, destDir);
|
|
console.log('Build output synchronization successful!');
|
|
} else {
|
|
console.error('Error: "out/" directory not found. Compile the Next.js build first.');
|
|
}
|
|
} catch (err) {
|
|
console.error('Synchronization failed:', err);
|
|
}
|