From ecec661b72b93d75bbc028422c3768339f33efbf Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 26 Dec 2025 22:43:03 +0200 Subject: [PATCH] chore(scripts): add icon to process phosphor meta --- scripts/icon-packs/phosphor.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 scripts/icon-packs/phosphor.js diff --git a/scripts/icon-packs/phosphor.js b/scripts/icon-packs/phosphor.js new file mode 100644 index 000000000..36e6d0206 --- /dev/null +++ b/scripts/icon-packs/phosphor.js @@ -0,0 +1,28 @@ +import { join } from "node:path"; +import { readFileSync } from "node:fs"; + +function processIconPack(packName, prefix) { + const path = join(packName); + const selectionMeta = JSON.parse(readFileSync(join(path, "selection.json"), "utf-8")); + const icons = {}; + + for (const icon of selectionMeta.icons) { + let name = icon.properties.name; + if (name.endsWith(`-${packName}`)) { + name = name.split("-").slice(0, -1).join("-"); + } + + const id = `ph-${name}`; + icons[id] = { + glyph: `${String.fromCharCode(icon.properties.code)}`, + terms: [ name ] + }; + } + + return JSON.stringify({ + prefix, + icons + }, null, 2); +} + +console.log(processIconPack("light", "ph-light")); \ No newline at end of file