@@ -64,7 +64,7 @@ if (process.env.CIRCLE_NODE_TOTAL) {
64
64
// will have already removed conflicting files.
65
65
//
66
66
// In CI, merging is handled automatically by CircleCI's workspace feature.
67
- spawnSync ( 'rsync' , [ '-ar' , experimentalDir + '/' , stableDir + '/' ] ) ;
67
+ mergeDirsSync ( experimentalDir + '/' , stableDir + '/' ) ;
68
68
69
69
// Now restore the combined directory back to its original name
70
70
// TODO: Currently storing artifacts as `./build2` so that it doesn't conflict
@@ -186,3 +186,23 @@ function updateTheReactVersionThatDevToolsReads(version) {
186
186
`export default '${ version } ';\n`
187
187
) ;
188
188
}
189
+
190
+ /**
191
+ * cross-platform alternative to `rsync -ar`
192
+ * @param {string } source
193
+ * @param {string } destination
194
+ */
195
+ function mergeDirsSync ( source , destination ) {
196
+ for ( const sourceFileBaseName of fs . readdirSync ( source ) ) {
197
+ const sourceFileName = path . join ( source , sourceFileBaseName ) ;
198
+ const targetFileName = path . join ( destination , sourceFileBaseName ) ;
199
+
200
+ const sourceFile = fs . statSync ( sourceFileName ) ;
201
+ if ( sourceFile . isDirectory ( ) ) {
202
+ fse . ensureDirSync ( targetFileName ) ;
203
+ mergeDirsSync ( sourceFileName , targetFileName ) ;
204
+ } else {
205
+ fs . copyFileSync ( sourceFileName , targetFileName ) ;
206
+ }
207
+ }
208
+ }
0 commit comments