@@ -98,9 +98,29 @@ function processStable(buildDir) { |
98 | 98 | updatePackageVersions( |
99 | 99 | buildDir + '/node_modules', |
100 | 100 | versionsMap, |
101 | | - defaultVersionIfNotFound |
| 101 | + defaultVersionIfNotFound, |
| 102 | + true |
102 | 103 | ); |
103 | 104 | fs.renameSync(buildDir + '/node_modules', buildDir + '/oss-stable'); |
| 105 | + |
| 106 | + // Identical to `oss-stable` but with real, semver versions. This is what |
| 107 | + // will get published to @latest. |
| 108 | + spawnSync('cp', [ |
| 109 | + '-r', |
| 110 | + buildDir + '/oss-stable', |
| 111 | + buildDir + '/oss-stable-semver', |
| 112 | + ]); |
| 113 | + const semverVersionsMap = new Map(); |
| 114 | + for (const moduleName in stablePackages) { |
| 115 | + const version = stablePackages[moduleName]; |
| 116 | + semverVersionsMap.set(moduleName, version); |
| 117 | + } |
| 118 | + updatePackageVersions( |
| 119 | + buildDir + '/oss-stable-semver', |
| 120 | + semverVersionsMap, |
| 121 | + defaultVersionIfNotFound, |
| 122 | + false |
| 123 | + ); |
104 | 124 | } |
105 | 125 |
|
106 | 126 | if (fs.existsSync(buildDir + '/facebook-www')) { |
@@ -131,7 +151,8 @@ function processExperimental(buildDir, version) { |
131 | 151 | updatePackageVersions( |
132 | 152 | buildDir + '/node_modules', |
133 | 153 | versionsMap, |
134 | | - defaultVersionIfNotFound |
| 154 | + defaultVersionIfNotFound, |
| 155 | + true |
135 | 156 | ); |
136 | 157 | fs.renameSync(buildDir + '/node_modules', buildDir + '/oss-experimental'); |
137 | 158 | } |
@@ -179,7 +200,8 @@ function crossDeviceRenameSync(source, destination) { |
179 | 200 | function updatePackageVersions( |
180 | 201 | modulesDir, |
181 | 202 | versionsMap, |
182 | | - defaultVersionIfNotFound |
| 203 | + defaultVersionIfNotFound, |
| 204 | + pinToExactVersion |
183 | 205 | ) { |
184 | 206 | for (const moduleName of fs.readdirSync(modulesDir)) { |
185 | 207 | let version = versionsMap.get(moduleName); |
@@ -199,14 +221,18 @@ function updatePackageVersions( |
199 | 221 | if (packageInfo.dependencies) { |
200 | 222 | for (const dep of Object.keys(packageInfo.dependencies)) { |
201 | 223 | if (versionsMap.has(dep)) { |
202 | | - packageInfo.dependencies[dep] = version; |
| 224 | + packageInfo.dependencies[dep] = pinToExactVersion |
| 225 | + ? version |
| 226 | + : '^' + version; |
203 | 227 | } |
204 | 228 | } |
205 | 229 | } |
206 | 230 | if (packageInfo.peerDependencies) { |
207 | 231 | for (const dep of Object.keys(packageInfo.peerDependencies)) { |
208 | 232 | if (versionsMap.has(dep)) { |
209 | | - packageInfo.peerDependencies[dep] = version; |
| 233 | + packageInfo.peerDependencies[dep] = pinToExactVersion |
| 234 | + ? version |
| 235 | + : '^' + version; |
210 | 236 | } |
211 | 237 | } |
212 | 238 | } |
|