runFlow() — react Function Reference
Architecture documentation for the runFlow() function in runFlow.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD cc012cd2_2b9d_4513_f08e_6ff05ecbf3c0["runFlow()"] d56e8a1b_b694_3e8a_3613_8251d0dd1c73["runFlow.js"] cc012cd2_2b9d_4513_f08e_6ff05ecbf3c0 -->|defined in| d56e8a1b_b694_3e8a_3613_8251d0dd1c73 style cc012cd2_2b9d_4513_f08e_6ff05ecbf3c0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/flow/runFlow.js lines 21–85
async function runFlow(renderer, args) {
return new Promise(resolve => {
let cmd = __dirname + '/../../node_modules/.bin/flow';
if (process.platform === 'win32') {
cmd = cmd.replace(/\//g, '\\') + '.cmd';
}
// Copy renderer flowconfig file to the root of the project so that it
// works with editor integrations. This means that the Flow config used by
// the editor will correspond to the last renderer you checked.
const srcPath =
process.cwd() + '/scripts/flow/' + renderer + '/.flowconfig';
const srcStat = fs.statSync(__dirname + '/config/flowconfig');
const destPath = './.flowconfig';
if (fs.existsSync(destPath)) {
const oldConfig = String(fs.readFileSync(destPath));
const newConfig = String(fs.readFileSync(srcPath));
if (oldConfig !== newConfig) {
// Use the mtime to detect if the file was manually edited. If so,
// log an error.
const destStat = fs.statSync(destPath);
if (destStat.mtimeMs - srcStat.mtimeMs > 1) {
console.error(
chalk.red(
'Detected manual changes to .flowconfig, which is a generated ' +
'file. These changes have been discarded.\n\n' +
'To change the Flow config, edit the template in ' +
'scripts/flow/config/flowconfig. Then run this command again.\n',
),
);
}
fs.unlinkSync(destPath);
fs.copyFileSync(srcPath, destPath);
// Set the mtime of the copied file to be same as the original file,
// so that the above check works.
fs.utimesSync(destPath, srcStat.atime, srcStat.mtime);
}
} else {
fs.copyFileSync(srcPath, destPath);
fs.utimesSync(destPath, srcStat.atime, srcStat.mtime);
}
console.log(
'Running Flow on the ' + chalk.yellow(renderer) + ' renderer...',
);
spawn(cmd, args, {
// Allow colors to pass through:
stdio: 'inherit',
}).on('close', function (code) {
if (code !== 0) {
console.error(
'Flow failed for the ' + chalk.red(renderer) + ' renderer',
);
console.log();
process.exit(code);
} else {
console.log(
'Flow passed for the ' + chalk.green(renderer) + ' renderer',
);
resolve();
}
});
});
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does runFlow() do?
runFlow() is a function in the react codebase, defined in scripts/flow/runFlow.js.
Where is runFlow() defined?
runFlow() is defined in scripts/flow/runFlow.js at line 21.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free