Flow and Continuous Integration

So you’ve decided to use Flow on your team. Congrats! Static analysis is a great way to improve code quality.



Flow-bin is an npm module which wraps Flow and its binaries for OSX and 64-bit unix.

Install it with npm i --save-dev flow-bin.

Now, devs just need to npm install as usual. Everyone will be on the same version.

Configuring Flow

flow-bin ships with examples - which will throw distracting warnings. Ignore them in .flowconfig:



When your code changes, you’ll want to check it immediately. Fast feedback loops are the key to fun productive development – especially when learning a new tool.

onchange is an npm module to trigger actions when files change. We want to run flow whenever our files change. First install it:

npm i --save-dev onchange

Then start running flow whenever files change- ./node_modules/onchange/cli.js '**/*' -- ./node_modules/.bin/flow

What about the Build Machine?

No need for apt-get to install binaries. Just run ./node_modules/.bin/flow check.

This way, Flow violations will fail the build - a guaranteed way to get people’s attention.


Using flow-bin you can distribute Flow to all dev’s machines painlessly. More importantly: executing Flow checks on the build server will keep code quality high.