@@ -15,6 +15,9 @@ const {
1515 canaryChannelLabel,
1616 rcNumber,
1717} = require ( '../../ReactVersions' ) ;
18+ const yargs = require ( 'yargs' ) ;
19+ const Bundles = require ( './bundles' ) ;
20+ const { buildEverything} = require ( './build-ghaction' ) ;
1821
1922// Runs the build script for both stable and experimental release channels,
2023// by configuring an environment variable.
@@ -53,7 +56,48 @@ fs.writeFileSync(
5356 `export default '${ PLACEHOLDER_REACT_VERSION } ';\n`
5457) ;
5558
56- if ( process . env . CIRCLE_NODE_TOTAL ) {
59+ const argv = yargs . wrap ( yargs . terminalWidth ( ) ) . options ( {
60+ releaseChannel : {
61+ alias : 'r' ,
62+ describe : 'Build the given release channel.' ,
63+ requiresArg : true ,
64+ type : 'string' ,
65+ default : 'experimental' ,
66+ choices : [ 'experimental' , 'stable' ] ,
67+ } ,
68+ bundleType : {
69+ alias : 'b' ,
70+ describe : 'Build the given bundle type.' ,
71+ requiresArg : true ,
72+ type : 'string' ,
73+ choices : Object . values ( Bundles . bundleTypes ) ,
74+ } ,
75+ ci : {
76+ describe : 'Run tests in CI' ,
77+ requiresArg : false ,
78+ type : 'choices' ,
79+ choices : [ 'circleci' , 'github' ] ,
80+ } ,
81+ } ) . argv ;
82+
83+ if ( argv . ci === 'github' ) {
84+ // ./scripts/rollup/build was being used by spawning a new process and passing via ENV variables
85+ // so let's just preserve this for now and rewrite it later to just take a function arg
86+ process . env . RELEASE_CHANNEL = argv . releaseChannel ;
87+ buildEverything ( argv . bundleType ) ;
88+ switch ( argv . releaseChannel ) {
89+ case 'stable' : {
90+ processStable ( './build' ) ;
91+ break ;
92+ }
93+ case 'experimental' : {
94+ processExperimental ( './build' ) ;
95+ break ;
96+ }
97+ default :
98+ throw new Error ( `Unknown release channel ${ argv . releaseChannel } ` ) ;
99+ }
100+ } else if ( argv . ci === 'circleci' ) {
57101 // In CI, we use multiple concurrent processes. Allocate half the processes to
58102 // build the stable channel, and the other half for experimental. Override
59103 // the environment variables to "trick" the underlying build script.
0 commit comments