mirror of
https://github.com/zebrajr/react.git
synced 2025-12-07 00:20:28 +01:00
* Generate Flow config on install We'll need to do pre-renderer Flow passes with different configs. This is the first step to get it working. We only want the original version checked in. * Create multiple Flow configs from a template * Run Flow per renderer * Lint * Revert the environment consolidation I thought this would be a bit cleaner at first because we now have non-environment files in this directory. But Sebastian is changing these files at the same time so I want to avoid conflicts and keep the PR more tightly scoped. Undo. * Misc
38 lines
1017 B
JavaScript
38 lines
1017 B
JavaScript
'use strict';
|
|
|
|
const chalk = require('chalk');
|
|
const spawn = require('child_process').spawn;
|
|
const extension = process.platform === 'win32' ? '.cmd' : '';
|
|
|
|
require('./createFlowConfigs');
|
|
|
|
async function runFlow(renderer, args) {
|
|
return new Promise(resolve => {
|
|
console.log(
|
|
'Running Flow for the ' + chalk.cyan(renderer) + ' renderer...',
|
|
);
|
|
spawn('../../../node_modules/.bin/flow' + extension, args, {
|
|
// Allow colors to pass through:
|
|
stdio: 'inherit',
|
|
// Use a specific renderer config:
|
|
cwd: process.cwd() + '/scripts/flow/' + renderer + '/',
|
|
}).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',
|
|
);
|
|
console.log();
|
|
resolve();
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
module.exports = runFlow;
|