From c9504d99a55d544b38ad452a776250e3ea6ee68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Tue, 3 May 2016 18:16:38 -0700 Subject: [PATCH] Setup grunt flow task and run on travis (#6684) --- .travis.yml | 1 + Gruntfile.js | 2 ++ grunt/tasks/flow.js | 22 ++++++++++++++++++++++ package.json | 3 ++- packages/react/package.json | 2 +- 5 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 grunt/tasks/flow.js diff --git a/.travis.yml b/.travis.yml index 420e840251074..5824e1564be5a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -87,6 +87,7 @@ env: - TEST_TYPE=build - TEST_TYPE=test - TEST_TYPE=lint + - TEST_TYPE=flow - TEST_TYPE=build_website global: # SERVER diff --git a/Gruntfile.js b/Gruntfile.js index f1f3c435670d3..9562542441e2f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -56,6 +56,8 @@ module.exports = function(grunt) { grunt.registerTask('lint', ['eslint']); + grunt.registerTask('flow', require('./grunt/tasks/flow')); + grunt.registerTask('delete-build-modules', function() { // Use gulp here. spawnGulp(['react:clean'], null, this.async()); diff --git a/grunt/tasks/flow.js b/grunt/tasks/flow.js new file mode 100644 index 0000000000000..767fc4eea65b4 --- /dev/null +++ b/grunt/tasks/flow.js @@ -0,0 +1,22 @@ +'use strict'; + +var grunt = require('grunt'); + +var extension = process.platform === 'win32' ? '.cmd': ''; + +module.exports = function() { + var done = this.async(); + grunt.util.spawn({ + cmd: 'node_modules/.bin/flow' + extension, + args: ['check', '.'], + opts: {stdio: 'inherit'}, + }, function(err, result, code) { + if (err) { + grunt.log.error('Flow failed'); + } else { + grunt.log.ok('Flow passed'); + } + + done(code === 0); + }); +}; diff --git a/package.json b/package.json index cb0464bf8db1c..748f17e1900f0 100644 --- a/package.json +++ b/package.json @@ -36,8 +36,9 @@ "eslint": "1.10.3", "eslint-plugin-react": "4.1.0", "eslint-plugin-react-internal": "file:eslint-rules", - "fbjs": "^0.8.0", + "fbjs": "^0.8.1", "fbjs-scripts": "^0.6.0", + "flow-bin": "0.24.0", "glob": "^6.0.1", "grunt": "^0.4.5", "grunt-cli": "^0.1.13", diff --git a/packages/react/package.json b/packages/react/package.json index 32cd9e44b7880..0c7f04eed8dec 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -23,7 +23,7 @@ "node": ">=0.10.0" }, "dependencies": { - "fbjs": "^0.8.0", + "fbjs": "^0.8.1", "loose-envify": "^1.1.0", "object-assign": "^4.1.0" },