Separate `yarn flow` and `yarn flow-ci` (#12841)

This commit is contained in:
Dan Abramov 2018-05-17 14:29:37 +01:00 committed by GitHub
parent d4123b4784
commit 2d20dc47a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 3 deletions

View File

@ -118,6 +118,7 @@
"test-build": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.build.js", "test-build": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.build.js",
"test-build-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.build.js", "test-build-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.build.js",
"flow": "node ./scripts/tasks/flow.js", "flow": "node ./scripts/tasks/flow.js",
"flow-ci": "node ./scripts/tasks/flow-ci.js",
"prettier": "node ./scripts/prettier/index.js write-changed", "prettier": "node ./scripts/prettier/index.js write-changed",
"prettier-all": "node ./scripts/prettier/index.js write", "prettier-all": "node ./scripts/prettier/index.js write",
"version-check": "node ./scripts/tasks/version-check.js" "version-check": "node ./scripts/tasks/version-check.js"

View File

@ -8,7 +8,7 @@ COMMANDS_TO_RUN=()
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
COMMANDS_TO_RUN+=('node ./scripts/prettier/index') COMMANDS_TO_RUN+=('node ./scripts/prettier/index')
COMMANDS_TO_RUN+=('node ./scripts/tasks/flow') COMMANDS_TO_RUN+=('node ./scripts/tasks/flow-ci')
COMMANDS_TO_RUN+=('node ./scripts/tasks/eslint') COMMANDS_TO_RUN+=('node ./scripts/tasks/eslint')
COMMANDS_TO_RUN+=('yarn test --maxWorkers=2') COMMANDS_TO_RUN+=('yarn test --maxWorkers=2')
COMMANDS_TO_RUN+=('./scripts/circleci/check_license.sh') COMMANDS_TO_RUN+=('./scripts/circleci/check_license.sh')

View File

@ -7,7 +7,7 @@ const {logPromise, runYarnTask} = require('../utils');
module.exports = async ({cwd}) => { module.exports = async ({cwd}) => {
await logPromise(runYarnTask(cwd, 'lint', 'Lint failed'), 'Running ESLint'); await logPromise(runYarnTask(cwd, 'lint', 'Lint failed'), 'Running ESLint');
await logPromise( await logPromise(
runYarnTask(cwd, 'flow', 'Flow failed'), runYarnTask(cwd, 'flow-ci', 'Flow failed'),
'Running Flow checks' 'Running Flow checks'
); );
await logPromise( await logPromise(

29
scripts/tasks/flow-ci.js Normal file
View File

@ -0,0 +1,29 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
const path = require('path');
const spawn = require('child_process').spawn;
const extension = process.platform === 'win32' ? '.cmd' : '';
// This script forces a complete check.
// Use it for the CI.
spawn(path.join('node_modules', '.bin', 'flow' + extension), ['check', '.'], {
// Allow colors to pass through
stdio: 'inherit',
}).on('close', function(code) {
if (code !== 0) {
console.error('Flow failed');
} else {
console.log('Flow passed');
}
process.exit(code);
});

View File

@ -12,7 +12,10 @@ const spawn = require('child_process').spawn;
const extension = process.platform === 'win32' ? '.cmd' : ''; const extension = process.platform === 'win32' ? '.cmd' : '';
spawn(path.join('node_modules', '.bin', 'flow' + extension), ['check', '.'], { // This script is using `flow status` for a quick check with a server.
// Use it for local development.
spawn(path.join('node_modules', '.bin', 'flow' + extension), ['status', '.'], {
// Allow colors to pass through // Allow colors to pass through
stdio: 'inherit', stdio: 'inherit',
}).on('close', function(code) { }).on('close', function(code) {