| 182 | } |
| 183 | |
| 184 | async function downloadLatestReactBuild() { |
| 185 | const releaseScriptPath = join(ROOT_PATH, 'scripts', 'release'); |
| 186 | const installPromise = exec('yarn install', {cwd: releaseScriptPath}); |
| 187 | |
| 188 | await logger( |
| 189 | installPromise, |
| 190 | `Installing release script dependencies. ${chalk.dim( |
| 191 | '(this may take a minute if CI is still running)' |
| 192 | )}`, |
| 193 | { |
| 194 | estimate: 5000, |
| 195 | } |
| 196 | ); |
| 197 | |
| 198 | console.log(''); |
| 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 | |
| 205 | const {commit} = await inquirer.prompt([ |
| 206 | { |
| 207 | type: 'input', |
| 208 | name: 'commit', |
| 209 | message: 'Which React version (commit) should be used?', |
| 210 | default: currentCommitHash, |
| 211 | }, |
| 212 | ]); |
| 213 | console.log(''); |
| 214 | |
| 215 | const downloadScriptPath = join( |
| 216 | releaseScriptPath, |
| 217 | 'download-experimental-build.js' |
| 218 | ); |
| 219 | const downloadPromise = execRead( |
| 220 | `"${downloadScriptPath}" --commit=${commit}` |
| 221 | ); |
| 222 | |
| 223 | await logger(downloadPromise, 'Downloading React artifacts from CI.', { |
| 224 | estimate: 15000, |
| 225 | }); |
| 226 | |
| 227 | return currentCommitHash; |
| 228 | } |
| 229 | |
| 230 | function printFinalInstructions() { |
| 231 | const publishReleaseScriptPath = join(__dirname, 'publish-release.js'); |