()
| 15 | const VERSION = '1.2.3'; |
| 16 | |
| 17 | const run = async () => { |
| 18 | const defaultOptions = { |
| 19 | cwd, |
| 20 | env: process.env, |
| 21 | }; |
| 22 | |
| 23 | try { |
| 24 | // Start with a known build/revision: |
| 25 | // https://circleci.com/gh/facebook/react/12707 |
| 26 | let promise = spawn( |
| 27 | 'node', |
| 28 | [ |
| 29 | './scripts/release/prepare-release-from-ci.js', |
| 30 | `--build=${CIRCLE_CI_BUILD}`, |
| 31 | ], |
| 32 | defaultOptions |
| 33 | ); |
| 34 | logPromise( |
| 35 | promise, |
| 36 | theme`Checking out "next" build {version ${CIRCLE_CI_BUILD}}` |
| 37 | ); |
| 38 | await promise; |
| 39 | |
| 40 | const dateString = await getDateStringForCommit(COMMIT); |
| 41 | |
| 42 | // Upgrade the above build top a known React version. |
| 43 | // Note that using the --local flag skips NPM checkout. |
| 44 | // This isn't totally necessary but is useful if we want to test an unpublished "next" build. |
| 45 | promise = spawn( |
| 46 | 'node', |
| 47 | [ |
| 48 | './scripts/release/prepare-release-from-npm.js', |
| 49 | `--version=0.0.0-${COMMIT}-${dateString}`, |
| 50 | '--local', |
| 51 | ], |
| 52 | defaultOptions |
| 53 | ); |
| 54 | promise.childProcess.stdin.setEncoding('utf-8'); |
| 55 | promise.childProcess.stdout.setEncoding('utf-8'); |
| 56 | promise.childProcess.stdout.on('data', data => { |
| 57 | if (data.includes('✓ Version for')) { |
| 58 | // Update all packages to a stable version |
| 59 | promise.childProcess.stdin.write(VERSION); |
| 60 | } else if (data.includes('(y/N)')) { |
| 61 | // Accept all of the confirmation prompts |
| 62 | promise.childProcess.stdin.write('y'); |
| 63 | } |
| 64 | }); |
| 65 | logPromise(promise, theme`Preparing stable release {version ${VERSION}}`); |
| 66 | await promise; |
| 67 | |
| 68 | const beforeContents = readFileSync( |
| 69 | join(cwd, 'scripts/release/snapshot-test.snapshot'), |
| 70 | 'utf-8' |
| 71 | ); |
| 72 | await exec('cp build/temp.diff scripts/release/snapshot-test.snapshot', { |
| 73 | cwd, |
| 74 | }); |
no test coverage detected