sync-vscode-settings now copies from devtools-workspace-settings.json

This CL upgrades the sync-vscode-settings.js script to copy from the
`.vscode/devtools-workspace-settings.json` into
`.vscode/settings.json`, rather than have it hardcode the settings
into the script.

Bug: none
Change-Id: I250b122b47decc8fad937c9030e38603c4f0c403
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2902818
Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
This commit is contained in:
Jack Franklin
2021-05-18 14:04:41 +00:00
committed by Commit Bot
parent fde9938b0e
commit 1d1253c7c9
2 changed files with 13 additions and 6 deletions
+3
View File
@@ -0,0 +1,3 @@
{
"eslint.runtime": "third_party/node/node.py"
}
+10 -6
View File
@@ -5,19 +5,23 @@
const path = require('path');
const fs = require('fs');
const VSCODE_SETTINGS_LOCATION = path.join(__dirname, '..', '..', '.vscode', 'settings.json');
const DEFAULT_VS_CODE_SETTINGS = {
'eslint.runtime': 'third_party/node/node.py',
};
const DEVTOOLS_SETTINGS_LOCATION = path.join(process.cwd(), '.vscode', 'devtools-workspace-settings.json');
const VSCODE_SETTINGS_LOCATION = path.join(process.cwd(), '.vscode', 'settings.json');
if (!fs.existsSync(DEVTOOLS_SETTINGS_LOCATION)) {
// If there are no settings to copy and paste, return and do nothing.
return;
}
const devtoolsSettings = require(DEVTOOLS_SETTINGS_LOCATION);
let preExistingSettings = {};
if (fs.existsSync(VSCODE_SETTINGS_LOCATION)) {
preExistingSettings = require(VSCODE_SETTINGS_LOCATION);
}
const updatedSettings = {
...DEFAULT_VS_CODE_SETTINGS,
...devtoolsSettings,
// Any setting specified by the engineer will always take precedence over the defaults
...preExistingSettings,
};