diff --git a/package-lock.json b/package-lock.json index dba1496a3..370471ccd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -63,6 +63,7 @@ "@types/mkdirp": "^2.0.0", "@types/mocha": "^8.2.3", "@types/node": "^14.18.63", + "@types/prettier": "^2.7.3", "@types/react": "^17.0.83", "@types/react-dom": "^17.0.25", "@types/sinon": "^9.0.11", @@ -5666,6 +5667,13 @@ "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" }, + "node_modules/@types/prettier": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz", + "integrity": "sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/prop-types": { "version": "15.7.5", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", diff --git a/scripts/generate-icon-font.ts b/scripts/generate-icon-font.ts index 30b5be0aa..79ad286c9 100644 --- a/scripts/generate-icon-font.ts +++ b/scripts/generate-icon-font.ts @@ -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 = [ @@ -51,14 +52,19 @@ async function main(): Promise { }); // 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', + }) ); }