GeezerVison is showing github.com — fix: update release scripts for react devtools · react/react@77b48dc
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: scripts/devtools/build-and-test.js +12-20Lines changed: 12 additions & 20 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,13 +50,13 @@ async function main() { | 50 | 50 | }); | 51 | 51 |
| 52 | 52 | const archivePath = await archiveGitRevision(); | 53 | | - const buildID = await downloadLatestReactBuild(); | | 53 | + const currentCommitHash = await downloadLatestReactBuild(); | 54 | 54 |
| 55 | 55 | await buildAndTestInlinePackage(); | 56 | 56 | await buildAndTestStandalonePackage(); | 57 | 57 | await buildAndTestExtensions(); | 58 | 58 |
| 59 | | - saveBuildMetadata({archivePath, buildID}); | | 59 | + saveBuildMetadata({archivePath, currentCommitHash}); | 60 | 60 |
| 61 | 61 | printFinalInstructions(); | 62 | 62 | } | @@ -197,12 +197,17 @@ async function downloadLatestReactBuild() { | 197 | 197 |
| 198 | 198 | console.log(''); | 199 | 199 |
| | 200 | + const currentCommitHash = (await exec('git rev-parse HEAD')).stdout.trim(); | | 201 | + if (!currentCommitHash) { | | 202 | + throw new Error('Failed to get current commit hash'); | | 203 | + } | | 204 | + | 200 | 205 | const {commit} = await inquirer.prompt([ | 201 | 206 | { | 202 | 207 | type: 'input', | 203 | 208 | name: 'commit', | 204 | 209 | message: 'Which React version (commit) should be used?', | 205 | | - default: 'main', | | 210 | + default: currentCommitHash, | 206 | 211 | }, | 207 | 212 | ]); | 208 | 213 | console.log(''); | @@ -215,24 +220,11 @@ async function downloadLatestReactBuild() { | 215 | 220 | `"${downloadScriptPath}" --commit=${commit}` | 216 | 221 | ); | 217 | 222 |
| 218 | | - const output = await logger( | 219 | | - downloadPromise, | 220 | | - 'Downloading React artifacts from CI.', | 221 | | - {estimate: 15000} | 222 | | - ); | 223 | | - | 224 | | - const match = output.match('--build=([0-9]+)'); | 225 | | - if (match.length === 0) { | 226 | | - console.error(chalk.red(`No build ID found in "${output}"`)); | 227 | | - process.exit(1); | 228 | | - } | 229 | | - | 230 | | - const buildID = match[1]; | 231 | | - | 232 | | - console.log(''); | 233 | | - console.log(`Downloaded artifacts for CI build ${chalk.bold(buildID)}.`); | | 223 | + await logger(downloadPromise, 'Downloading React artifacts from CI.', { | | 224 | + estimate: 15000, | | 225 | + }); | 234 | 226 |
| 235 | | - return buildID; | | 227 | + return currentCommitHash; | 236 | 228 | } | 237 | 229 |
| 238 | 230 | function printFinalInstructions() { | |
Collapse file Copy file name to clipboardExpand all lines: scripts/devtools/publish-release.js +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -29,16 +29,16 @@ async function main() { | 29 | 29 | console.log(chalk.bold.green(' ' + pathToPrint)); | 30 | 30 | }); | 31 | 31 |
| 32 | | - const {archivePath, buildID} = readSavedBuildMetadata(); | | 32 | + const {archivePath, currentCommitHash} = readSavedBuildMetadata(); | 33 | 33 |
| 34 | 34 | await checkNPMPermissions(); | 35 | 35 |
| 36 | 36 | await publishToNPM(); | 37 | 37 |
| 38 | | - await printFinalInstructions(buildID, archivePath); | | 38 | + await printFinalInstructions(currentCommitHash, archivePath); | 39 | 39 | } | 40 | 40 |
| 41 | | -async function printFinalInstructions(buildID, archivePath) { | | 41 | +async function printFinalInstructions(currentCommitHash, archivePath) { | 42 | 42 | console.log(''); | 43 | 43 | console.log( | 44 | 44 | 'You are now ready to publish the extension to Chrome, Edge, and Firefox:' | @@ -50,7 +50,7 @@ async function printFinalInstructions(buildID, archivePath) { | 50 | 50 | ); | 51 | 51 | console.log(''); | 52 | 52 | console.log('When publishing to Firefox, remember the following:'); | 53 | | - console.log(` Build id: ${chalk.bold(buildID)}`); | | 53 | + console.log(` Commit Hash: ${chalk.bold(currentCommitHash)}`); | 54 | 54 | console.log(` Git archive: ${chalk.bold(archivePath)}`); | 55 | 55 | console.log(''); | 56 | 56 | console.log('Also consider syncing this release to Facebook:'); | |
Collapse file Copy file name to clipboardExpand all lines: scripts/devtools/utils.js +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -101,19 +101,19 @@ function readSavedBuildMetadata() { | 101 | 101 | process.exit(1); | 102 | 102 | } | 103 | 103 |
| 104 | | - const {archivePath, buildID} = readJsonSync(path); | | 104 | + const {archivePath, currentCommitHash} = readJsonSync(path); | 105 | 105 |
| 106 | | - return {archivePath, buildID}; | | 106 | + return {archivePath, currentCommitHash}; | 107 | 107 | } | 108 | 108 |
| 109 | | -function saveBuildMetadata({archivePath, buildID}) { | | 109 | +function saveBuildMetadata({archivePath, currentCommitHash}) { | 110 | 110 | const path = join(BUILD_METADATA_TEMP_DIRECTORY, 'metadata'); | 111 | 111 |
| 112 | 112 | if (!existsSync(BUILD_METADATA_TEMP_DIRECTORY)) { | 113 | 113 | mkdirSync(BUILD_METADATA_TEMP_DIRECTORY); | 114 | 114 | } | 115 | 115 |
| 116 | | - writeJsonSync(path, {archivePath, buildID}, {spaces: 2}); | | 116 | + writeJsonSync(path, {archivePath, currentCommitHash}, {spaces: 2}); | 117 | 117 | } | 118 | 118 |
| 119 | 119 | module.exports = { | |
|