npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grunt-flowbin

v0.2.0

Published

Grunt command to work with flow-bin

Downloads

33

Readme

grunt-flowbin

Greenkeeper badge

This is a thin grunt wrapper around the flow-bin command line tool.

Build Status

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.

Installation

npm install --save-dev grunt-flowbin

Configuration

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:

grunt.initConfig({
  flowbin: {
    check: {},
  },
});

flow options

If you're too solarized and need to run flow check --color=never as grunt flowbin:check then you can add target options for it like:

grunt.initConfig({
  flowbin: {
    check: {
      color: 'never',
    },
  },
});

If you want to pass a flag (an option without a value) like flow check --quiet, give the option a value of null:

grunt.initConfig({
  flowbin: {
    check: {
      quiet: null,
    },
  },
});

If you want to see the way flow check is invoked (the default options, etc), run grunt --verbose ....

Supported flow commands

Here are the Grunt targets you can define for all the flow commands currently supported. If you define a target that's not supported, the Grunt task will attempt to run it just like flow yourtarget but that may or may not work.

grunt.initConfig({
  flowbin: {
    check: {},
    start: {},
    stop: {},
    status: {},
  },
});

Run flow --help for info on what these commands do.

Continuous flow checks

Since grunt flowbin:check checks all files (which can be slow), you will probably want to use grunt-contrib-watch to only check files as they change in your source tree. flow-bin 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:

grunt.initConfig({
  // Configure your `grunt flowbin` task:
  flowbin: {
    // Define targets for the flow commands you need.
    start: {},
    status: {},
  },
  // Configure your `grunt watch:develop` 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 develop that calls flowbin:start to start the server then watch:develop to watch for file changes. When a file changes, this configuration calls your custom test command and then flowbin:status to only check the status on newer files.

Contributing

Grab a clone and get started like this:

npm install
npm test