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
47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
import { readdir, readFile } from "node:fs/promises";
|
|||
|
|
import { dirname, join } from "node:path";
|
||
|
|
import { fileURLToPath } from "node:url";
|
||
|
|
|
||
|
|
const repositoryRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
||
|
|
const exportRoot = join(repositoryRoot, "apps", "web", ".next-export");
|
||
|
|
const chunksRoot = join(exportRoot, "_next", "static", "chunks");
|
||
|
|
|
||
|
|
async function listJavaScriptFiles(directory) {
|
||
|
|
const entries = await readdir(directory, { withFileTypes: true });
|
||
|
|
const files = await Promise.all(
|
||
|
|
entries.map((entry) => {
|
||
|
|
const path = join(directory, entry.name);
|
||
|
|
return entry.isDirectory() ? listJavaScriptFiles(path) : [path];
|
||
|
|
}),
|
||
|
|
);
|
||
|
|
|
||
|
|
return files.flat().filter((path) => path.endsWith(".js"));
|
||
|
|
}
|
||
|
|
|
||
|
|
const indexHtml = await readFile(join(exportRoot, "index.html"), "utf8");
|
||
|
|
if (indexHtml.includes('="./_next/')) {
|
||
|
|
throw new Error(
|
||
|
|
"Static HTML uses a relative ./_next asset prefix. Worker chunks resolve that prefix " +
|
||
|
|
"relative to their own directory and request a duplicated /_next/static/chunks path.",
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
const workerChunks = [];
|
||
|
|
for (const path of await listJavaScriptFiles(chunksRoot)) {
|
||
|
|
const source = await readFile(path, "utf8");
|
||
|
|
if (source.includes("importScripts(") && source.includes("static/chunks/")) {
|
||
|
|
workerChunks.push({ path, source });
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if (workerChunks.length === 0) {
|
||
|
|
throw new Error("Could not find the generated CAD worker runtime to verify its public path.");
|
||
|
|
}
|
||
|
|
|
||
|
|
for (const { path, source } of workerChunks) {
|
||
|
|
if (!source.includes('.p="/_next/"') && !source.includes(".p='/_next/'")) {
|
||
|
|
throw new Error(`Worker runtime ${path} does not use the root-relative /_next/ public path.`);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
console.log(`Verified ${workerChunks.length} static worker runtime(s) use /_next/.`);
|