fix: make element bonus icons white

This commit is contained in:
2026-03-20 13:38:01 +07:00 Unverified
parent 61fd58ab56
commit b497eac249
2 changed files with 18 additions and 15 deletions
+12 -9
View File
@@ -1,4 +1,5 @@
import { write } from "bun";
import { join } from "node:path";
import { $, write } from "bun";
import { libraryRaw } from "@/assets/icons";
function toJsx(
@@ -27,11 +28,12 @@ function toJsx(
.split(";")
.filter((e) => !e.startsWith("-"))
.map((r) => r.split(":"))
.map(([name, value]) => [
name.replace(/-([a-z])/g, (_, m: string) =>
m.toUpperCase(),
),
value,
.map(([key, value]) => [
key.replace(/-([a-z])/g, (_, m: string) => m.toUpperCase()),
name.endsWith("_ADD_HURT") && key === "fill"
? "white"
: value,
]),
),
)}}`,
@@ -40,14 +42,15 @@ function toJsx(
`;
}
console.log(toJsx("Const", libraryRaw.Const));
const target = join(__dirname, "../src/assets/icons-library.tsx");
write(
"result.tsx",
target,
`import { SVGProps } from "react";
const library = {
export const library = {
${Object.entries(libraryRaw)
.map(([name, p]) => toJsx(name, p))
.join("\n")}
};`,
);
await $`bun biome format ${target} --fix`;