Skip to content

Commit 2d9d5f5

Browse files
authored
chore: add automatic font generation and fix VSCode settings (#893)
1 parent 7ea659c commit 2d9d5f5

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Place your settings in this file to overwrite default and user settings.
22
{
3-
"editor.formatOnSave": false,
43
"editor.codeActionsOnSave": {
54
"source.fixAll.eslint": "explicit"
65
},

package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,7 @@
12281228
"@types/mkdirp": "^2.0.0",
12291229
"@types/mocha": "^8.2.3",
12301230
"@types/node": "^14.18.63",
1231+
"@types/prettier": "^2.7.3",
12311232
"@types/react": "^17.0.83",
12321233
"@types/react-dom": "^17.0.25",
12331234
"@types/sinon": "^9.0.11",

scripts/generate-icon-font.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import webfont from 'webfont';
22
import fs from 'fs/promises';
33
import { GlyphData } from 'webfont/dist/src/types';
4+
import prettier from 'prettier';
45

56
/** Icons to include in the generated icon font */
67
const INCLUDED_ICONS = ['connection-active', 'connection-inactive'];
@@ -40,14 +41,19 @@ async function main(): Promise<void> {
4041
});
4142

4243
// Prints out the VSCode configuration package.json
43-
console.info(
44-
JSON.stringify(
45-
{
46-
icons: iconsConfig,
47-
},
48-
undefined,
49-
2
50-
)
44+
const currentConfiguration = JSON.parse(
45+
await fs.readFile('./package.json', 'utf8')
46+
);
47+
48+
currentConfiguration.contributes.icons = iconsConfig;
49+
50+
const prettierConfig = await prettier.resolveConfig('./.prettierrc.json');
51+
await fs.writeFile(
52+
'./package.json',
53+
prettier.format(JSON.stringify(currentConfiguration), {
54+
...prettierConfig,
55+
parser: 'json-stringify',
56+
})
5157
);
5258
}
5359

0 commit comments

Comments
 (0)