Giter Club home page Giter Club logo

flow-status-webpack-plugin's Introduction

Flow Status Webpack Plugin

This webpack plugin will automatically start a Flow server (or restart if one is running) when webpack starts up, and run flow status after each webpack build. Still experimental.

If you have any idea on how to get it better, you're welcome to contribute!

Requirements

You need to have Flow installed. To do that, follow these steps.

Installation

npm install flow-status-webpack-plugin --save-dev

Usage

var FlowStatusWebpackPlugin = require('flow-status-webpack-plugin');

module.exports = {
    ...
    plugins: [
        new FlowStatusWebpackPlugin()
    ]
}

Configuration

If you want to pass additional command-line arguments to flow start, you can pass a flowArgs option to the plugin:

var FlowStatusWebpackPlugin = require('flow-status-webpack-plugin');

module.exports = {
    ...
    plugins: [
        new FlowStatusWebpackPlugin({
            flowArgs: '--lib path/to/interfaces/directory'
        })
    ]
}

If you don't want the plugin to automatically restart any running Flow server, pass restartFlow: false:

var FlowStatusWebpackPlugin = require('flow-status-webpack-plugin');

module.exports = {
    ...
    plugins: [
        new FlowStatusWebpackPlugin({
            restartFlow: false
        })
    ]
}

If provided a binary path, will run Flow from this path instead of running it from any global installation.

var FlowStatusWebpackPlugin = require('flow-status-webpack-plugin');

module.exports = {
    ...
    plugins: [
        new FlowStatusWebpackPlugin({
            binaryPath: '/path/to/your/flow/installation'
        })
    ]
}

If you want the plugin to fail the build if the code doesn't type check, pass failOnError = true, and include the NoErrorsPlugin:

var FlowStatusWebpackPlugin = require('flow-status-webpack-plugin');

module.exports = {
    ...
    plugins: [
        new webpack.NoErrorsPlugin(),
        new FlowStatusWebpackPlugin({
            failOnError: true
        })
    ]
}

If you want to perform an action on successful/failed Flow checks, use the onSucess/onError callbacks:

var FlowStatusWebpackPlugin = require('flow-status-webpack-plugin');
var notifier = require('node-notifier');

module.exports = {
    ...
    plugins: [
        new webpack.NoErrorsPlugin(),
        new FlowStatusWebpackPlugin({
            onSuccess: function(stdout) { notifier.notify({ title: 'Flow', message: 'Flow is happy!' }); },
            onError: function(stdout) { notifier.notify({ title: 'Flow', message: 'Flow is sad!' }); }
        })
    ]
}

License

This plugin is released under the MIT License.

flow-status-webpack-plugin's People

Contributors

diegodurli avatar farneman avatar jedwards1211 avatar moljac024 avatar prewk avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.