Skip to content

Commit c624dc3

Browse files
author
Brian Vaughn
authored
DevTools supports ENV-injected version for better internal bug reports (facebook#22635)
1 parent 26bc8ff commit c624dc3

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

packages/react-devtools-extensions/utils.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ function getGitCommit() {
3030
}
3131
}
3232

33-
function getVersionString() {
34-
const packageVersion = JSON.parse(
35-
readFileSync(
36-
resolve(__dirname, '..', 'react-devtools-core', './package.json'),
37-
),
38-
).version;
33+
function getVersionString(packageVersion = null) {
34+
if (packageVersion == null) {
35+
packageVersion = JSON.parse(
36+
readFileSync(
37+
resolve(__dirname, '..', 'react-devtools-core', './package.json'),
38+
),
39+
).version;
40+
}
3941

4042
const commit = getGitCommit();
4143

packages/react-devtools-extensions/webpack.backend.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const builtModulesDir = resolve(
3030

3131
const __DEV__ = NODE_ENV === 'development';
3232

33-
const DEVTOOLS_VERSION = getVersionString();
33+
const DEVTOOLS_VERSION = getVersionString(process.env.DEVTOOLS_VERSION);
3434

3535
const featureFlagTarget = process.env.FEATURE_FLAG_TARGET || 'extension-oss';
3636

packages/react-devtools-extensions/webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const builtModulesDir = resolve(
3030

3131
const __DEV__ = NODE_ENV === 'development';
3232

33-
const DEVTOOLS_VERSION = getVersionString();
33+
const DEVTOOLS_VERSION = getVersionString(process.env.DEVTOOLS_VERSION);
3434

3535
const LOGGING_URL = process.env.LOGGING_URL || null;
3636

0 commit comments

Comments
 (0)