13
stablePackages,
14
experimentalPackages,
15
canaryChannelLabel,
16
+ rcNumber,
17
} = require('../../ReactVersions');
18
19
// Runs the build script for both stable and experimental release channels,
119
// Identical to `oss-stable` but with real, semver versions. This is what
120
// will get published to @latest.
121
shell.cp('-r', buildDir + '/node_modules', buildDir + '/oss-stable-semver');
122
+ if (canaryChannelLabel === 'rc') {
123
+ // During the RC phase, we also generate an RC build that pins to exact
124
+ // versions but does not include a SHA, e.g. `19.0.0-rc.0`. This is purely
125
+ // for signaling purposes — aside from the version, it's no different from
126
+ // the corresponding canary.
127
+ shell.cp('-r', buildDir + '/node_modules', buildDir + '/oss-stable-rc');
128
+ }
129
130
const defaultVersionIfNotFound = '0.0.0' + '-' + sha + '-' + dateString;
131
const versionsMap = new Map();
149
ReactVersion + '-' + canaryChannelLabel + '-' + sha + '-' + dateString
150
);
151
152
+ if (canaryChannelLabel === 'rc') {
153
+ const rcVersionsMap = new Map();
154
+ for (const moduleName in stablePackages) {
155
+ const version = stablePackages[moduleName];
156
+ rcVersionsMap.set(moduleName, version + `-rc.${rcNumber}`);
157
+ }
158
+ updatePackageVersions(
159
+ buildDir + '/oss-stable-rc',
160
+ rcVersionsMap,
161
+ defaultVersionIfNotFound,
162
+ // For RCs, we pin to exact versions, like we do for canaries.
163
+ true
164
+ );
165
+ updatePlaceholderReactVersionInCompiledArtifacts(
166
+ buildDir + '/oss-stable-rc',
167
+ ReactVersion
168
+ );
169
+ }
170
+
171
// Now do the semver ones
172
const semverVersionsMap = new Map();
173
for (const moduleName in stablePackages) {
178
buildDir + '/oss-stable-semver',
179
semverVersionsMap,
180
defaultVersionIfNotFound,
181
+ // Use ^ only for non-prerelease versions
182
false
183
);
184
updatePlaceholderReactVersionInCompiledArtifacts(