Skip to content

Commit

Permalink
DevTools supports ENV-injected version for better internal bug reports (
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn authored Oct 27, 2021
1 parent 26bc8ff commit c624dc3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions packages/react-devtools-extensions/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion packages/react-devtools-extensions/webpack.backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 1 addition & 1 deletion packages/react-devtools-extensions/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit c624dc3

Please sign in to comment.