From 2d9d5f5be1512616dadd9c12197ec714dbdc25d8 Mon Sep 17 00:00:00 2001 From: Gagik Amaryan Date: Tue, 3 Dec 2024 16:23:58 +0100 Subject: [PATCH 1/2] chore: add automatic font generation and fix VSCode settings (#893) --- .vscode/settings.json | 1 - package-lock.json | 8 ++++++++ package.json | 1 + scripts/generate-icon-font.ts | 22 ++++++++++++++-------- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 732bb7406..32baf6163 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,5 @@ // Place your settings in this file to overwrite default and user settings. { - "editor.formatOnSave": false, "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit" }, 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/package.json b/package.json index 61d274e83..f1680a02c 100644 --- a/package.json +++ b/package.json @@ -1228,6 +1228,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", diff --git a/scripts/generate-icon-font.ts b/scripts/generate-icon-font.ts index da65d96b2..089dbf8d1 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 = ['connection-active', 'connection-inactive']; @@ -40,14 +41,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', + }) ); } From 684708f0254b3ec58cd0917147cecc7ec48a1a8c Mon Sep 17 00:00:00 2001 From: Gagik Amaryan Date: Wed, 4 Dec 2024 14:24:00 +0100 Subject: [PATCH 2/2] fix(playground): hide playground export menu item if GitHub Copilot is not active VSCODE-660 (#896) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f1680a02c..f147a1d2a 100644 --- a/package.json +++ b/package.json @@ -736,7 +736,7 @@ "mdb.copilot": [ { "command": "mdb.exportCodeToPlayground", - "when": "mdb.isPlayground == false" + "when": "mdb.isPlayground == false && mdb.isCopilotActive == true" } ], "editor/context": [