Skip to content

Commit

Permalink
add automatic font generation
Browse files Browse the repository at this point in the history
  • Loading branch information
gagik committed Dec 2, 2024
1 parent 68255cf commit 95bb2ee
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 14 additions & 8 deletions scripts/generate-icon-font.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import webfont from 'webfont';
import fs from 'fs/promises';
import { GlyphData } from 'webfont/dist/src/types';
import prettier from 'prettier';

/** Icons to include in the generated icon font */
const INCLUDED_ICONS = [
Expand Down Expand Up @@ -51,14 +52,19 @@ async function main(): Promise<void> {
});

// Prints out the VSCode configuration package.json
console.info(
JSON.stringify(
{
icons: iconsConfig,
},
undefined,
2
)
const currentConfiguration = JSON.parse(
await fs.readFile('./package.json', 'utf8')
);

currentConfiguration.contributes.icons = iconsConfig;

const prettierConfig = await prettier.resolveConfig('./.prettierrc.json');
await fs.writeFile(
'./package.json',
prettier.format(JSON.stringify(currentConfiguration), {
...prettierConfig,
parser: 'json-stringify',
})
);
}

Expand Down

0 comments on commit 95bb2ee

Please sign in to comment.