flow-status-webpack-plugin
Advanced tools
Comparing version 0.1.2 to 0.1.3
29
index.js
@@ -1,3 +0,3 @@ | ||
const colors = require('colors'); | ||
const shell = require('shelljs'); | ||
const colors = require('colors'), | ||
shell = require('shelljs'); | ||
@@ -9,12 +9,15 @@ function FlowStatusWebpackPlugin(options) { | ||
FlowStatusWebpackPlugin.prototype.apply = function(compiler) { | ||
const options = this.options; | ||
const flowArgs = options.flowArgs || ''; | ||
const options = this.options, | ||
flowArgs = options.flowArgs || '', | ||
flow = options.binaryPath || 'flow'; | ||
var firstRun = true, | ||
waitingForFlow = false; | ||
function startFlow(cb) { | ||
if (options.restartFlow === false) { | ||
shell.exec('flow start ' + flowArgs, () => cb()); | ||
} | ||
else { | ||
shell.exec('flow stop', () => { | ||
shell.exec('flow start ' + flowArgs, () => cb()); | ||
shell.exec(flow + ' start ' + flowArgs, () => cb()); | ||
} else { | ||
shell.exec(flow + ' stop', () => { | ||
shell.exec(flow + ' start ' + flowArgs, () => cb()); | ||
}); | ||
@@ -24,3 +27,2 @@ } | ||
var firstRun = true; | ||
function startFlowIfFirstRun(compiler, cb) { | ||
@@ -36,8 +38,7 @@ if (firstRun) { | ||
// restart flow if interfacesPath was provided regardless of whether webpack is in normal or watch mode | ||
// restart flow if interfacesPath was provided regardless | ||
// of whether webpack is in normal or watch mode | ||
compiler.plugin('run', startFlowIfFirstRun); | ||
compiler.plugin('watch-run', startFlowIfFirstRun); | ||
var waitingForFlow = false; | ||
function flowStatus() { | ||
@@ -48,3 +49,3 @@ if (!waitingForFlow) { | ||
// this will start a flow server if it was not running | ||
shell.exec('flow status --color always', {silent: true}, (code, stdout, stderr) => { | ||
shell.exec(flow + ' status --color always', {silent: true}, (code, stdout, stderr) => { | ||
const hasErrors = code !== 0; | ||
@@ -51,0 +52,0 @@ |
{ | ||
"name": "flow-status-webpack-plugin", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"author": "Diego Durli <dgodurli@gmail> (https://github.com/diegodurli)", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -74,5 +74,19 @@ Flow Status Webpack Plugin | ||
If provided a binary path, will run Flow from this path instead of running it from any global installation. | ||
```js | ||
var FlowStatusWebpackPlugin = require('flow-status-webpack-plugin'); | ||
module.exports = { | ||
... | ||
plugins: [ | ||
new FlowStatusWebpackPlugin({ | ||
binaryPath: '/path/to/your/flow/installation' | ||
}) | ||
] | ||
} | ||
``` | ||
License | ||
------- | ||
This plugin is released under the [MIT License](https://opensource.org/licenses/MIT). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6572
58
91