1. #!/usr/bin/env node
    
  2. 
    
  3. 'use strict';
    
  4. 
    
  5. const {tmpdir} = require('os');
    
  6. const {join} = require('path');
    
  7. const {getBuildInfo, handleError} = require('./utils');
    
  8. 
    
  9. // This script is an escape hatch!
    
  10. // It exists for special case manual builds.
    
  11. // The typical suggested release process is to create a "next" build from a CI artifact.
    
  12. // This build script is optimized for speed and simplicity.
    
  13. // It doesn't run all of the tests that the CI environment runs.
    
  14. // You're expected to run those manually before publishing a release.
    
  15. 
    
  16. const addBuildInfoJSON = require('./build-release-locally-commands/add-build-info-json');
    
  17. const buildArtifacts = require('./build-release-locally-commands/build-artifacts');
    
  18. const confirmAutomatedTesting = require('./build-release-locally-commands/confirm-automated-testing');
    
  19. const copyRepoToTempDirectory = require('./build-release-locally-commands/copy-repo-to-temp-directory');
    
  20. const npmPackAndUnpack = require('./build-release-locally-commands/npm-pack-and-unpack');
    
  21. const printPrereleaseSummary = require('./shared-commands/print-prerelease-summary');
    
  22. const updateVersionNumbers = require('./build-release-locally-commands/update-version-numbers');
    
  23. 
    
  24. const run = async () => {
    
  25.   try {
    
  26.     const cwd = join(__dirname, '..', '..');
    
  27.     const {branch, checksum, commit, reactVersion, version} =
    
  28.       await getBuildInfo();
    
  29.     const tempDirectory = join(tmpdir(), `react-${commit}`);
    
  30.     const params = {
    
  31.       branch,
    
  32.       checksum,
    
  33.       commit,
    
  34.       cwd,
    
  35.       reactVersion,
    
  36.       tempDirectory,
    
  37.       version,
    
  38.     };
    
  39. 
    
  40.     await confirmAutomatedTesting(params);
    
  41.     await copyRepoToTempDirectory(params);
    
  42.     await updateVersionNumbers(params);
    
  43.     await addBuildInfoJSON(params);
    
  44.     await buildArtifacts(params);
    
  45.     await npmPackAndUnpack(params);
    
  46.     await printPrereleaseSummary(params, false);
    
  47.   } catch (error) {
    
  48.     handleError(error);
    
  49.   }
    
  50. };
    
  51. 
    
  52. run();