Skip to content

Build your personal knowledge base with Trilium Notes

chore(scripts): process boxicons v3 icons

Elian Doran59b691d670ba
diff --git a/scripts/icon-packs/boxicons-v3.ts b/scripts/icon-packs/boxicons-v3.ts
new file mode 100644
index 0000000000..0f1ea01a99
--- /dev/null
+++ b/scripts/icon-packs/boxicons-v3.ts
@@ -0,0 +1,35 @@
+import { readFileSync, writeFileSync } from "fs";
+import { join } from "path";
+
+const inputDir = process.argv[2];
+if (!inputDir) {
+ console.error('Please provide the input directory as the first argument.');
+ process.exit(1);
+}
+
+for (const weight of [ "200", "400" ]) {
+ const jsonPath = `${inputDir}/${weight}/boxicons.json`;
+ const inputData = JSON.parse(readFileSync(jsonPath, "utf-8"));
+ const icons = {};
+
+ for (const [ key, value ] of Object.entries(inputData)) {
+ let name = key;
+ if (name.startsWith('bx-')) {
+ name = name.slice(3);
+ }
+ if (name.startsWith('bxs-')) {
+ name = name.slice(4);
+ }
+ icons[key] = {
+ glyph: String.fromCharCode(value as number),
+ terms: [ name ]
+ };
+ }
+
+ const manifest = {
+ prefix: `bx3-${weight}`,
+ icons
+ };
+ const outputPath = join(`${inputDir}/${weight}/generated-manifest.json`);
+ writeFileSync(outputPath, JSON.stringify(manifest, null, 2));
+}