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
55 lines
2.1 KiB
JavaScript
55 lines
2.1 KiB
JavaScript
import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "node:fs";
|
||||
|
|
import { basename, dirname, join } from "node:path";
|
|||
|
|
import { fileURLToPath } from "node:url";
|
|||
|
|
|
|||
|
|
const repoRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|||
|
|
const distDir = join(repoRoot, "dist", "desktop");
|
|||
|
|
const updatesDir = join(repoRoot, "updates");
|
|||
|
|
const latestYmlPath = join(distDir, "latest.yml");
|
|||
|
|
|
|||
|
|
if (!existsSync(latestYmlPath)) {
|
|||
|
|
console.error(`[publish-desktop-updates] Bulunamadı: ${latestYmlPath}. Önce 'npm run desktop:dist' çalıştırın.`);
|
|||
|
|
process.exit(1);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const yamlText = readFileSync(latestYmlPath, "utf8");
|
|||
|
|
const urlMatches = Array.from(yamlText.matchAll(/^\s*-\s*url:\s*([^\r\n]+)$/gm)).map((m) => m[1].trim());
|
|||
|
|
const pathMatch = yamlText.match(/^path:\s*([^\r\n]+)$/m)?.[1]?.trim();
|
|||
|
|
const artifactNames = new Set(urlMatches);
|
|||
|
|
if (pathMatch) artifactNames.add(pathMatch);
|
|||
|
|
|
|||
|
|
if (artifactNames.size === 0) {
|
|||
|
|
console.error("[publish-desktop-updates] latest.yml içinde kurulum dosyası referansı bulunamadı.");
|
|||
|
|
process.exit(1);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
mkdirSync(updatesDir, { recursive: true });
|
|||
|
|
|
|||
|
|
const copied = [];
|
|||
|
|
for (const rawName of artifactNames) {
|
|||
|
|
const safeName = basename(rawName);
|
|||
|
|
const srcArtifact = join(distDir, safeName);
|
|||
|
|
if (!existsSync(srcArtifact)) {
|
|||
|
|
console.error(`[publish-desktop-updates] Eksik dosya: ${srcArtifact}`);
|
|||
|
|
process.exit(1);
|
|||
|
|
}
|
|||
|
|
const destArtifact = join(updatesDir, safeName);
|
|||
|
|
copyFileSync(srcArtifact, destArtifact);
|
|||
|
|
copied.push({ name: safeName, bytes: statSync(destArtifact).size });
|
|||
|
|
|
|||
|
|
const blockmapName = `${safeName}.blockmap`;
|
|||
|
|
const srcBlockmap = join(distDir, blockmapName);
|
|||
|
|
if (existsSync(srcBlockmap)) {
|
|||
|
|
const destBlockmap = join(updatesDir, blockmapName);
|
|||
|
|
copyFileSync(srcBlockmap, destBlockmap);
|
|||
|
|
copied.push({ name: blockmapName, bytes: statSync(destBlockmap).size });
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const destYml = join(updatesDir, "latest.yml");
|
|||
|
|
copyFileSync(latestYmlPath, destYml);
|
|||
|
|
copied.push({ name: "latest.yml", bytes: statSync(destYml).size });
|
|||
|
|
|
|||
|
|
for (const item of copied) {
|
|||
|
|
console.log(`[publish-desktop-updates] Yayınlandı: updates/${item.name} (${(item.bytes / (1024 * 1024)).toFixed(2)} MB)`);
|
|||
|
|
}
|