Skip to content

Commit

Permalink
Fix sync-react script to handle change in release label
Browse files Browse the repository at this point in the history
  • Loading branch information
acdlite committed May 3, 2023
1 parent 4680b28 commit 354f67b
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions scripts/sync-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,16 @@ Or, run this command with no arguments to use the most recently published versio
)
}

const { sha: newSha, dateString: newDateString } = newVersionInfo
const { sha: baseSha, dateString: baseDateString } = baseVersionInfo
const {
sha: newSha,
releaseLabel: newReleaseLabel,
dateString: newDateString,
} = newVersionInfo
const {
sha: baseSha,
releaseLabel: baseReleaseLabel,
dateString: baseDateString,
} = baseVersionInfo

console.log(`Updating "react@${channel}" to ${newSha}...\n`)
if (newSha === baseSha) {
Expand All @@ -75,10 +83,10 @@ Or, run this command with no arguments to use the most recently published versio
}

for (const [dep, version] of Object.entries(devDependencies)) {
if (version.endsWith(`${baseSha}-${baseDateString}`)) {
if (version.endsWith(`${baseReleaseLabel}-${baseSha}-${baseDateString}`)) {
devDependencies[dep] = version.replace(
`${baseSha}-${baseDateString}`,
`${newSha}-${newDateString}`
`${baseReleaseLabel}-${baseSha}-${baseDateString}`,
`${newReleaseLabel}-${newSha}-${newDateString}`
)
}
}
Expand Down Expand Up @@ -164,7 +172,7 @@ function readStringArg(argv, argName) {

function extractInfoFromReactCanaryVersion(reactCanaryVersion) {
const match = reactCanaryVersion.match(
/(?<semverVersion>.*)-(?<releaseChannel>.*)-(?<sha>.*)-(?<dateString>.*)$/
/(?<semverVersion>.*)-(?<releaseLabel>.*)-(?<sha>.*)-(?<dateString>.*)$/
)
return match ? match.groups : null
}
Expand Down Expand Up @@ -202,7 +210,7 @@ async function getChangelogFromGitHub(baseSha, newSha) {
return changelog.length > 0 ? changelog.join('\n') : null
}

sync('next')
sync('canary')
.then(() => sync('experimental'))
.catch((error) => {
console.error(error)
Expand Down

0 comments on commit 354f67b

Please sign in to comment.