mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
Add --reverse option to replace-fork script (#20249)
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.
This commit is contained in:
parent
453df3ff72
commit
bd8bc5afce
|
|
@ -8,10 +8,15 @@ const {promisify} = require('util');
|
||||||
const glob = promisify(require('glob'));
|
const glob = promisify(require('glob'));
|
||||||
const {spawnSync} = require('child_process');
|
const {spawnSync} = require('child_process');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const minimist = require('minimist');
|
||||||
|
|
||||||
const stat = promisify(fs.stat);
|
const stat = promisify(fs.stat);
|
||||||
const copyFile = promisify(fs.copyFile);
|
const copyFile = promisify(fs.copyFile);
|
||||||
|
|
||||||
|
const argv = minimist(process.argv.slice(2), {
|
||||||
|
boolean: ['reverse'],
|
||||||
|
});
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const oldFilenames = await glob('packages/react-reconciler/**/*.old.js');
|
const oldFilenames = await glob('packages/react-reconciler/**/*.old.js');
|
||||||
await Promise.all(oldFilenames.map(unforkFile));
|
await Promise.all(oldFilenames.map(unforkFile));
|
||||||
|
|
@ -42,7 +47,11 @@ async function unforkFile(oldFilename) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await copyFile(newFilename, oldFilename);
|
if (argv.reverse) {
|
||||||
|
await copyFile(oldFilename, newFilename);
|
||||||
|
} else {
|
||||||
|
await copyFile(newFilename, oldFilename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user