Separate `yarn flow` and `yarn flow-ci` (#12841)
Dan Abramov committed
May 17, 2018 at 14:29 UTC
2d20dc47a399873fd7ac2118e75bd75696cc7b3b
5 files changed
+36
-3
package.json
+1
@@ -118,6 +118,7 @@
118
"test-build": "cross-env NODE_ENV=development jest --config ./scripts/jest/config.build.js",
119
"test-build-prod": "cross-env NODE_ENV=production jest --config ./scripts/jest/config.build.js",
120
"flow": "node ./scripts/tasks/flow.js",
121
+ "flow-ci": "node ./scripts/tasks/flow-ci.js",
122
"prettier": "node ./scripts/prettier/index.js write-changed",
123
"prettier-all": "node ./scripts/prettier/index.js write",
124
"version-check": "node ./scripts/tasks/version-check.js"
scripts/circleci/test_entry_point.sh
+1
-1
@@ -8,7 +8,7 @@ COMMANDS_TO_RUN=()
8
9
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
10
COMMANDS_TO_RUN+=('node ./scripts/prettier/index')
11
- COMMANDS_TO_RUN+=('node ./scripts/tasks/flow')
11
+ COMMANDS_TO_RUN+=('node ./scripts/tasks/flow-ci')
12
COMMANDS_TO_RUN+=('node ./scripts/tasks/eslint')
13
COMMANDS_TO_RUN+=('yarn test --maxWorkers=2')
14
COMMANDS_TO_RUN+=('./scripts/circleci/check_license.sh')
scripts/release/build-commands/run-automated-tests.js
+1
-1
@@ -7,7 +7,7 @@ const {logPromise, runYarnTask} = require('../utils');
7
module.exports = async ({cwd}) => {
8
await logPromise(runYarnTask(cwd, 'lint', 'Lint failed'), 'Running ESLint');
9
await logPromise(
10
- runYarnTask(cwd, 'flow', 'Flow failed'),
10
+ runYarnTask(cwd, 'flow-ci', 'Flow failed'),
11
'Running Flow checks'
12
);
13
await logPromise(
scripts/tasks/flow-ci.js
new
+29
@@ -0,0 +1,29 @@
1
+/**
2
+ * Copyright (c) 2013-present, Facebook, Inc.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+'use strict';
9
+
10
+const path = require('path');
11
+const spawn = require('child_process').spawn;
12
+
13
+const extension = process.platform === 'win32' ? '.cmd' : '';
14
+
15
+// This script forces a complete check.
16
+// Use it for the CI.
17
+
18
+spawn(path.join('node_modules', '.bin', 'flow' + extension), ['check', '.'], {
19
+ // Allow colors to pass through
20
+ stdio: 'inherit',
21
+}).on('close', function(code) {
22
+ if (code !== 0) {
23
+ console.error('Flow failed');
24
+ } else {
25
+ console.log('Flow passed');
26
+ }
27
+
28
+ process.exit(code);
29
+});
scripts/tasks/flow.js
+4
-1
@@ -12,7 +12,10 @@ const spawn = require('child_process').spawn;
12
13
const extension = process.platform === 'win32' ? '.cmd' : '';
14
15
-spawn(path.join('node_modules', '.bin', 'flow' + extension), ['check', '.'], {
15
+// This script is using `flow status` for a quick check with a server.
16
+// Use it for local development.
17
+
18
+spawn(path.join('node_modules', '.bin', 'flow' + extension), ['status', '.'], {
19
// Allow colors to pass through
20
stdio: 'inherit',
21
}).on('close', function(code) {