Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
43 lines
1.4 KiB
JavaScript
43 lines
1.4 KiB
JavaScript
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",
|
|||
|
|
]);
|
|||
|
|
|
|||
|
|
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}`);
|