Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --reverse option to replace-fork script #20249

Merged
merged 1 commit into from
Nov 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion scripts/merge-fork/replace-fork.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@
const {promisify} = require('util');
const glob = promisify(require('glob'));
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 @@ -38,7 +43,11 @@ async function unforkFile(oldFilename) {
return;
}

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

main();