mirror of
https://github.com/zadam/trilium.git
synced 2025-12-29 10:44:25 +01:00
chore(scripts): update boxicons script to use packs instead of weights
This commit is contained in:
parent
dbfaad6c06
commit
ed229e0578
@ -7,12 +7,15 @@ if (!inputDir) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
for (const weight of [ "200", "400" ]) {
|
||||
const jsonPath = `${inputDir}/${weight}/boxicons.json`;
|
||||
for (const pack of [ "basic", "brands" ]) {
|
||||
const fileName = pack === "basic" ? "boxicons" : `boxicons-${pack}`;
|
||||
const jsonPath = `${inputDir}/${pack}/${fileName}.json`;
|
||||
const inputData = JSON.parse(readFileSync(jsonPath, "utf-8"));
|
||||
const icons = {};
|
||||
|
||||
for (const [ key, value ] of Object.entries(inputData)) {
|
||||
if (key.startsWith("variable-selector")) continue;
|
||||
|
||||
let name = key;
|
||||
if (name.startsWith('bx-')) {
|
||||
name = name.slice(3);
|
||||
@ -21,15 +24,14 @@ for (const weight of [ "200", "400" ]) {
|
||||
name = name.slice(4);
|
||||
}
|
||||
icons[key] = {
|
||||
glyph: String.fromCharCode(value as number),
|
||||
glyph: String.fromCodePoint(value as number),
|
||||
terms: [ name ]
|
||||
};
|
||||
}
|
||||
|
||||
const manifest = {
|
||||
prefix: `bx3-${weight}`,
|
||||
icons
|
||||
};
|
||||
const outputPath = join(`${inputDir}/${weight}/generated-manifest.json`);
|
||||
const outputPath = join(`${inputDir}/${pack}/generated-manifest.json`);
|
||||
writeFileSync(outputPath, JSON.stringify(manifest, null, 2));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user