import { copyFile, mkdir } from "node:fs/promises"; const root = new URL("../", import.meta.url); const assets = [ ["marked/lib/marked.esm.js", "marked/marked.esm.js"], ["marked/lib/marked.esm.js.map", "marked/marked.esm.js.map"], ["marked/LICENSE", "marked/LICENSE"], ["dompurify/dist/purify.es.mjs", "dompurify/purify.es.mjs"], ["dompurify/dist/purify.es.mjs.map", "dompurify/purify.es.mjs.map"], ["dompurify/LICENSE", "dompurify/LICENSE"], ["dompurify/LICENSE-MPL", "dompurify/LICENSE-MPL"], ]; for (const [source, destination] of assets) { const target = new URL(`vendor/${destination}`, root); await mkdir(new URL("./", target), { recursive: true }); await copyFile(new URL(`node_modules/${source}`, root), target); }