Skip to content

Commit

Permalink
Update dependencies + Add support for new flow format
Browse files Browse the repository at this point in the history
  • Loading branch information
charliedowler committed Aug 4, 2016
1 parent 57236db commit ab1be03
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@
$ npm install --save-dev gulp-flowtype
```

### Running Windows?

Flow hasn't provided an official binary as of yet, you can follow the issue here [#6](https://github.com/facebook/flow/issues/6).

If you do manage to compile flow and get it running. You can set the path to your own executable using an environment variable.

``` sh
$ set FLOW_BIN=/path/to/flow
```

### Usage

```js
Expand Down Expand Up @@ -74,10 +64,11 @@ Default: `false`
##### options.reporter
Type: `function`
Default: [sindresorhus/jshint-stylish](https://github.com/sindresorhus/jshint-stylish)
>Optionally specify a custom reporter. This needs to conform to the specifications in http://jshint.com/docs/reporters/
Default: [charliedowler/flow-reporter](https://github.com/charliedowler/flow-reporter)
>Optionally specify a custom reporter.
## Release History
* 2016-08-04 v1.0.0 [Improvement] Update dependencies + Add support for new flow format
* 2016-01-18 v0.4.9 [Improvement] Update dependencies + fix broken code [#38](https://github.com/charliedowler/gulp-flowtype/pull/38)
* 2015-09-13 v0.4.8 [Fix] Downgrade flow
* 2015-05-05 v0.4.7 [Improvement] Add option for custom reporter
Expand Down
22 changes: 13 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ var through = require('through2');
var flowBin = require('flow-bin');
var logSymbols = require('log-symbols');
var childProcess = require('child_process');
var flowToJshint = require('flow-to-jshint');
var stylishReporter = require('jshint-stylish').reporter;
var chalk = require('chalk');
var reporter = require('flow-reporter');

/**
* Flow check initialises a server per folder when run,
Expand Down Expand Up @@ -77,13 +77,18 @@ function executeFlow(_path, options) {

var stream = childProcess.spawn(getFlowBin(), args);

var dat = "";
stream.stdout.on('data', data => {
dat += data.toString();
});

stream.stdout.on('end', () =>{
var parsed;
try {
parsed = JSON.parse(data.toString());
parsed = JSON.parse(dat);
}
catch(e) {
parsed = fatalError(data.toString());
parsed = fatalError(dat);
}
var result = {};

Expand All @@ -98,10 +103,9 @@ function executeFlow(_path, options) {
if (result.errors.length) {
passed = false;

var reporter = typeof options.reporter === 'undefined' ?
stylishReporter : options.reporter.reporter;

reporter(flowToJshint(result));
var report = typeof options.reporter === 'undefined' ?
reporter : options.reporter;
report(result.errors);

if (options.abort) {
deferred.reject(new gutil.PluginError('gulp-flow', 'Flow failed'));
Expand All @@ -113,7 +117,7 @@ function executeFlow(_path, options) {
else {
deferred.resolve();
}
});
})

return deferred.promise;
}
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gulp-flowtype",
"version": "0.4.9",
"version": "1.0.0",
"description": "Run Facebook's Flow in your gulp pipeline",
"keywords": [
"gulp",
Expand All @@ -24,24 +24,25 @@
"babel-cli": "^6.3.15",
"babel-polyfill": "^6.3.14",
"babel-types": "^6.3.14",
"chalk": "^1.1.3",
"event-stream": "~3.3.0",
"flow-bin": "^0.26.0",
"flow-bin": "^0.30.0",
"flow-to-jshint": "~0.2.0",
"gulp-util": "~3.0.1",
"jshint": "^2.8.0",
"jshint-stylish": "~2.1.0",
"log-symbols": "^1.0.1",
"q": "^1.1.2",
"through2": "~2.0.0"
"through2": "~2.0.0",
"flow-reporter": "~0.1.0"
},
"devDependencies": {
"babel-preset-es2015": "^6.3.13",
"babel-preset-stage-2": "^6.3.13",
"coveralls": "~2.11.5",
"istanbul": "~0.4.1",
"mocha": "~2.3.4",
"mocha-lcov-reporter": "~1.0.0",
"should": "~8.0.0"
"mocha": "~3.0.1",
"mocha-lcov-reporter": "~1.2.0",
"should": "~10.0.0"
},
"engines": {
"node": ">=0.8.0",
Expand Down
Binary file modified screencap.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ab1be03

Please sign in to comment.