DevTools supports ENV-injected version for better internal bug reports (#22635)

This commit is contained in:
Brian Vaughn
2021-10-27 17:18:48 -04:00
committed by GitHub
parent 26bc8ff9bf
commit c624dc3598
3 changed files with 10 additions and 8 deletions

View File

@@ -30,12 +30,14 @@ function getGitCommit() {
}
}
function getVersionString() {
const packageVersion = JSON.parse(
readFileSync(
resolve(__dirname, '..', 'react-devtools-core', './package.json'),
),
).version;
function getVersionString(packageVersion = null) {
if (packageVersion == null) {
packageVersion = JSON.parse(
readFileSync(
resolve(__dirname, '..', 'react-devtools-core', './package.json'),
),
).version;
}
const commit = getGitCommit();

View File

@@ -30,7 +30,7 @@ const builtModulesDir = resolve(
const __DEV__ = NODE_ENV === 'development';
const DEVTOOLS_VERSION = getVersionString();
const DEVTOOLS_VERSION = getVersionString(process.env.DEVTOOLS_VERSION);
const featureFlagTarget = process.env.FEATURE_FLAG_TARGET || 'extension-oss';

View File

@@ -30,7 +30,7 @@ const builtModulesDir = resolve(
const __DEV__ = NODE_ENV === 'development';
const DEVTOOLS_VERSION = getVersionString();
const DEVTOOLS_VERSION = getVersionString(process.env.DEVTOOLS_VERSION);
const LOGGING_URL = process.env.LOGGING_URL || null;