26 lines
1.1 KiB
JavaScript
26 lines
1.1 KiB
JavaScript
import { cp, mkdir, rm } from "node:fs/promises";
|
|
import { dirname } from "node:path";
|
|
|
|
await rm("static/vendor", { recursive: true, force: true });
|
|
|
|
for (const [source, target] of [
|
|
["@msgpack/msgpack/dist.esm", "msgpack"],
|
|
["@msgpack/msgpack/LICENSE", "msgpack/LICENSE"],
|
|
["mermaid/dist/mermaid.esm.min.mjs", "mermaid/mermaid.esm.min.mjs"],
|
|
["mermaid/dist/chunks/mermaid.esm.min", "mermaid/chunks/mermaid.esm.min"],
|
|
["mermaid/LICENSE", "mermaid/LICENSE"],
|
|
["mathjax/tex-chtml-nofont.js", "mathjax/tex-chtml-nofont.js"],
|
|
...["a11y", "input", "output", "sre", "ui", "LICENSE"].map((path) => [
|
|
`mathjax/${path}`,
|
|
`mathjax/${path}`,
|
|
]),
|
|
["@mathjax/mathjax-fira-font/chtml.js", "fonts/mathjax-fira-font/chtml.js"],
|
|
["@mathjax/mathjax-fira-font/chtml", "fonts/mathjax-fira-font/chtml"],
|
|
["mathjax/LICENSE", "fonts/mathjax-fira-font/LICENSE"],
|
|
]) {
|
|
await mkdir(dirname(`static/vendor/${target}`), { recursive: true });
|
|
await cp(`node_modules/${source}`, `static/vendor/${target}`, {
|
|
recursive: true,
|
|
filter: (path) => !path.endsWith(".map"),
|
|
});
|
|
}
|