Skip to content

Commit

Permalink
Add --reverse option to replace-fork script (#20249)
Browse files Browse the repository at this point in the history
When enabled, replaces new fork with old fork.

I've done this several times by manually editing the script file, so
seems useful enough to add an option.
  • Loading branch information
acdlite committed Nov 13, 2020
1 parent 453df3f commit bd8bc5a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion scripts/merge-fork/replace-fork.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ const {promisify} = require('util');
const glob = promisify(require('glob'));
const {spawnSync} = require('child_process');
const fs = require('fs');
const minimist = require('minimist');

const stat = promisify(fs.stat);
const copyFile = promisify(fs.copyFile);

const argv = minimist(process.argv.slice(2), {
boolean: ['reverse'],
});

async function main() {
const oldFilenames = await glob('packages/react-reconciler/**/*.old.js');
await Promise.all(oldFilenames.map(unforkFile));
Expand Down Expand Up @@ -42,7 +47,11 @@ async function unforkFile(oldFilename) {
return;
}

await copyFile(newFilename, oldFilename);
if (argv.reverse) {
await copyFile(oldFilename, newFilename);
} else {
await copyFile(newFilename, oldFilename);
}
}

main();

0 comments on commit bd8bc5a

Please sign in to comment.