mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-29 16:57:00 +08:00
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:
committed by
Commit Bot
parent
fde9938b0e
commit
1d1253c7c9
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"eslint.runtime": "third_party/node/node.py"
|
||||
}
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user