-
Notifications
You must be signed in to change notification settings - Fork 7
/
copy-assets.mjs
53 lines (49 loc) · 2.27 KB
/
copy-assets.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import fs from "node:fs/promises";
import path from "node:path";
const assets = Object.freeze([
"node_modules/@artichokeruby/logo/favicons/favicon-32x32.png",
"node_modules/@artichokeruby/logo/favicons/favicon-128x128.png",
"node_modules/@artichokeruby/logo/favicons/favicon-192x192.png",
"node_modules/@artichokeruby/logo/favicons/favicon-196x196.png",
"node_modules/@artichokeruby/logo/favicons/favicon-152x152.png",
"node_modules/@artichokeruby/logo/favicons/favicon-180x180.png",
"node_modules/@artichokeruby/logo/favicons/safari-pinned-tab.svg",
"node_modules/@artichokeruby/logo/favicons/mstile-150x150.png",
"node_modules/@artichokeruby/logo/optimized/artichoke-logo.png",
"node_modules/@artichokeruby/logo/optimized/artichoke-logo.svg",
"node_modules/@artichokeruby/logo/optimized/artichoke-logo-inverted.png",
"node_modules/@artichokeruby/logo/optimized/artichoke-logo-inverted.svg",
"node_modules/@artichokeruby/logo/optimized/artichoke-playground-safari-revision-4938-dark-mode.png",
"node_modules/@artichokeruby/logo/optimized/artichoke-playground-safari-revision-4938-light-mode.png",
"node_modules/@artichokeruby/logo/optimized/artichoke-social-logo.png",
"node_modules/@artichokeruby/logo/optimized/nav-white.svg",
"node_modules/@artichokeruby/logo/optimized/playground.png",
"node_modules/@artichokeruby/logo/optimized/playground-social-logo.png",
"node_modules/@artichokeruby/logo/optimized/wordmark-black.svg",
"node_modules/@artichokeruby/logo/social/twitter-logo-black.svg",
"node_modules/@artichokeruby/logo/social/github-logo.svg",
"node_modules/@artichokeruby/logo/social/discord-logo.svg",
]);
const build = async () => {
await fs.mkdir("src/public/social", { recursive: true });
await Promise.all(
assets.map(async (asset) => {
const file = path.basename(asset);
if (asset.includes("/social/")) {
await fs.copyFile(asset, path.join("src", "public", "social", file));
} else if (asset.includes("/logos/")) {
await fs.copyFile(asset, path.join("src", "public", "logos", file));
} else {
await fs.copyFile(asset, path.join("src", "public", file));
}
}),
);
};
(async function main() {
try {
await build();
} catch (error) {
console.error(error);
process.exit(1);
}
})();