fix: make element bonus icons white
This commit is contained in:
+12
-9
@@ -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`;
|
||||
|
||||
Reference in New Issue
Block a user