MCPcopy Index your code
hub / github.com/react/react / getBuildInfo

Function getBuildInfo

scripts/release/utils.js:60–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

58};
59
60const getBuildInfo = async () => {
61 const cwd = join(__dirname, '..', '..');
62
63 const isExperimental = process.env.RELEASE_CHANNEL === 'experimental';
64
65 const branch = await execRead('git branch | grep \\* | cut -d " " -f2', {
66 cwd,
67 });
68 const commit = await execRead('git show -s --no-show-signature --format=%h', {
69 cwd,
70 });
71 const checksum = await getChecksumForCurrentRevision(cwd);
72 const dateString = await getDateStringForCommit(commit);
73 const version = isExperimental
74 ? `0.0.0-experimental-${commit}-${dateString}`
75 : `0.0.0-${commit}-${dateString}`;
76
77 // React version is stored explicitly, separately for DevTools support.
78 // See updateVersionsForNext() below for more info.
79 const packageJSON = await readJson(
80 join(cwd, 'packages', 'react', 'package.json')
81 );
82 const reactVersion = isExperimental
83 ? `${packageJSON.version}-experimental-${commit}-${dateString}`
84 : `${packageJSON.version}-${commit}-${dateString}`;
85
86 return {branch, checksum, commit, reactVersion, version};
87};
88
89const getChecksumForCurrentRevision = async cwd => {
90 const packagesDir = join(cwd, 'packages');

Callers 2

runFunction · 0.85
runFunction · 0.85

Calls 3

execReadFunction · 0.70
getDateStringForCommitFunction · 0.70

Tested by

no test coverage detected