Files
snapcad-studio/scripts/sync-laragon-static.mjs
Enes Yakıştır ee28672e23
Build and Push Docker Images / build (push) Canceled after 0s
Desktop Release / Build linux desktop (push) Canceled after 0s
Desktop Release / Build windows desktop (push) Canceled after 0s
Desktop Release / Attach packages to release (push) Canceled after 0s
Desktop Release / Build macos desktop (push) Canceled after 0s
CI / Typecheck and unit tests (push) Canceled after 0s
release: SnapCAD Studio 1.0.10 (desktop menuler, macOS kisayollari, YakNet SSO)
2026-11-12 10:12:35 +03:00

45 lines
1.4 KiB
JavaScript

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { cpSync, existsSync, readdirSync, rmSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
const repoRoot = dirname(dirname(fileURLToPath(import.meta.url)));
const exportDir = join(repoRoot, "apps", "web", ".next-export");
const htaccessSrc = join(repoRoot, "apps", "web", "public", ".htaccess");
// Sunucu tarafı PHP dosyaları depo kökünde tutulur ve statik dışa aktarma
// tarafından asla ezilmemelidir. .env de aynı şekilde korunur.
const protectedEntries = new Set([
".env",
".env.local",
".env.production",
".htaccess",
"snap-config.php",
"cloud-api.php",
"callback.php",
"login.php",
"logout.php",
"updates",
]);
if (!existsSync(exportDir)) {
console.error(`[sync-laragon-static] Static export directory not found: ${exportDir}`);
process.exit(1);
}
const entries = readdirSync(exportDir).filter((entry) => !protectedEntries.has(entry));
for (const entry of entries) {
const srcPath = join(exportDir, entry);
const destPath = join(repoRoot, entry);
if (existsSync(destPath)) {
rmSync(destPath, { recursive: true, force: true });
}
cpSync(srcPath, destPath, { recursive: true });
}
if (existsSync(htaccessSrc)) {
cpSync(htaccessSrc, join(repoRoot, ".htaccess"));
cpSync(htaccessSrc, join(exportDir, ".htaccess"));
}
console.log(`[sync-laragon-static] Synced ${entries.length} static items + .htaccess to ${repoRoot}`);