mirror of
https://github.com/zadam/trilium.git
synced 2025-12-31 11:44:23 +01:00
chore(scripts): process boxicons v3 icons
This commit is contained in:
parent
ecec661b72
commit
59b691d670
35
scripts/icon-packs/boxicons-v3.ts
Normal file
35
scripts/icon-packs/boxicons-v3.ts
Normal file
@ -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));
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user