From f59faeeeaaca24ee4ce841ca98a87daa21954543 Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 2 Feb 2016 21:14:43 -0500 Subject: [PATCH] only run flow check in CI if npm 3 --- Makefile | 2 +- package.json | 1 + scripts/run-flow-check.js | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 scripts/run-flow-check.js diff --git a/Makefile b/Makefile index e20c2faee6..ac3fbc19de 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ test-cov: clean test-ci: make lint NODE_ENV=test make bootstrap - ./node_modules/.bin/flow check + node scripts/run-flow-check.js ./scripts/test-cov.sh cat ./coverage/coverage.json | ./node_modules/codecov.io/bin/codecov.io.js diff --git a/package.json b/package.json index 013c21e8ff..26383bf313 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "babel": "5.8.21", "babel-eslint": "^4.1.8", "babel-plugin-flow-comments": "^1.0.9", + "bin-version-check": "^2.1.0", "browserify": "^11.2.0", "bundle-collapser": "^1.2.1", "chai": "^2.2.0", diff --git a/scripts/run-flow-check.js b/scripts/run-flow-check.js new file mode 100644 index 0000000000..af0db68043 --- /dev/null +++ b/scripts/run-flow-check.js @@ -0,0 +1,15 @@ +'use strict'; + +var binVersionCheck = require("bin-version-check"); +var child = require("child_process"); + +// run in npm 3+ only +binVersionCheck("npm", ">=3.3.0", function (err) { + if (!err) { + console.log("Running ./node_modules/.bin/flow check"); + var cmd = child.spawn("./node_modules/.bin/flow", ["check"], { stdio: "inherit" }); + cmd.on("exit", function(code) { + console.log(code); + }); + } +});