feat: implement scan terminal dashboard with real-time opportunity tracking and visualization components
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { copyFile, mkdir, readdir, unlink } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
const serverDir = path.join(process.cwd(), ".next", "server");
|
||||
const chunksDir = path.join(serverDir, "chunks");
|
||||
const cleanRoot = process.argv.includes("--clean-root");
|
||||
|
||||
try {
|
||||
const entries = await readdir(chunksDir, { withFileTypes: true });
|
||||
await mkdir(serverDir, { recursive: true });
|
||||
await Promise.all(
|
||||
entries
|
||||
.filter((entry) => entry.isFile() && entry.name.endsWith(".js"))
|
||||
.map(async (entry) => {
|
||||
const target = path.join(serverDir, entry.name);
|
||||
if (cleanRoot) {
|
||||
await unlink(target).catch((error) => {
|
||||
if (error?.code !== "ENOENT") throw error;
|
||||
});
|
||||
return;
|
||||
}
|
||||
await copyFile(path.join(chunksDir, entry.name), target);
|
||||
}),
|
||||
);
|
||||
} catch (error) {
|
||||
if (error?.code !== "ENOENT") {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user