1import { existsSync, mkdirSync } from "node:fs";2import { execSync } from "node:child_process";3import path from "node:path";4import { fileURLToPath } from "node:url";56const __filename = fileURLToPath(import.meta.url);7const __dirname = path.dirname(__filename);8const rootDir = path.resolve(__dirname, "..");9const sourceDir = path.join(rootDir, "dist-chrome");10const targetDir = path.join(rootDir, "dist");1112if (!existsSync(sourceDir)) {13 console.error(`Chrome build output not found: ${sourceDir}`);14 process.exit(1);15}161718mkdirSync(targetDir, { recursive: true });19try {20 execSync(`cp -r ${sourceDir}/. ${targetDir}/`, { stdio: "pipe" });21} catch {22 23}2425console.log(`Synced ${path.relative(rootDir, sourceDir)} -> ${path.relative(rootDir, targetDir)}`);