Grunt command to work with flow-bin
npm install grunt-flowbin
This is a thin grunt wrapper around the
flow-bin command line tool.

It allows you to integrate Flow's
static JavaScript analysis into your Grunt toolchain.
Unlike other solutions, this one attempts to pass off as much work
to flow-bin as possible and get out of your way.
npm install --save-dev grunt-flowbin
Add a target to your grunt configuration for each flow command you'd
like to run. If you wanted to run flow check as grunt flowbin:check
you'd add this:
```javascript``
grunt.initConfig({
flowbin: {
check: {},
},
});
If you're too solarized and need to run flow check --color=nevergrunt flowbin:check
as then you can add target options for it like:
``javascript``
grunt.initConfig({
flowbin: {
check: {
color: 'never',
},
},
});
If you want to pass a flag (an option without a value) like flow check --quiet,null
give the option a value of :
``javascript``
grunt.initConfig({
flowbin: {
check: {
quiet: null,
},
},
});
If you want to see the way flow check is invoked (the default options, etc),grunt --verbose ...
run .
Here are the Grunt targets you can define for all the flow commands currentlyflow yourtarget
supported. If you define a target that's not supported, the Grunt task will
attempt to run it just like but that may or may not work.
``javascript``
grunt.initConfig({
flowbin: {
check: {},
start: {},
stop: {},
status: {},
},
});
Run flow --help for info on what these commands do.
Since grunt flowbin:check checks all files (which can be slow), youflow-bin
will probably want to use
grunt-contrib-watch
to only check files as they change in your source tree. provides support for this with a standalone server that
caches a bunch of things.
Here's an example of how to start a server, watch for file changes, and
check files as they change:
``javascriptgrunt flowbin
grunt.initConfig({
// Configure your task:grunt watch:develop
flowbin: {
// Define targets for the flow commands you need.
start: {},
status: {},
},
// Configure your task:
watch: {
develop: {
files: [
// Watch all your source files. Your path may be different.
'src/*/.js',
],
tasks: [
// Run your custom test command (assuming it exists as such):
'test',
// Ask the flow server for status on recently changed files:
'flowbin:status',
],
},
},
});
// Register a custom command that starts a flow server then watches
// for file changes:
grunt.registerTask('develop', [
'flowbin:start',
'watch:develop',
]);
``
With this configuration, you can start a custom task as grunt developflowbin:start
that calls to start the server then watch:develop totest
watch for file changes. When a file changes, this configuration calls
your custom command and then flowbin:status` to only check the
status on newer files.
Grab a clone and get started like this:
npm install
npm test