-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3bb02d6
Showing
29 changed files
with
5,054 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"env": { | ||
"test": { | ||
"presets": [ | ||
"flow", ["env", { | ||
"loose": true, | ||
"targets": { | ||
"node": "current" | ||
} | ||
}] | ||
], | ||
"plugins": [ | ||
"transform-class-properties", | ||
"transform-object-rest-spread", | ||
"transform-runtime" | ||
] | ||
}, | ||
"legacy": { | ||
"presets": [ | ||
"flow", ["env", { | ||
"loose": true, | ||
"targets": { | ||
"node": 4 | ||
} | ||
}] | ||
], | ||
"plugins": [ | ||
"transform-class-properties", | ||
"transform-object-rest-spread", | ||
"transform-runtime" | ||
] | ||
}, | ||
"modern": { | ||
"presets": [ | ||
"flow", ["env", { | ||
"loose": true, | ||
"targets": { | ||
"node": 8 | ||
} | ||
}] | ||
], | ||
"plugins": [ | ||
"transform-class-properties", | ||
"transform-object-rest-spread", | ||
"transform-runtime" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[ignore] | ||
|
||
[include] | ||
|
||
[libs] | ||
|
||
[lints] | ||
|
||
[options] | ||
|
||
[strict] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
*.log | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
git: | ||
depth: 1 | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- '4' | ||
- '6' | ||
- '8' | ||
cache: | ||
yarn: true | ||
directories: | ||
- node_modules | ||
script: yarn test && yarn flow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2018-present James Kyle <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<img src="https://raw.githubusercontent.com/thejameskyle/glow/master/logo.jpg" alt="Glow logo"/> | ||
|
||
# Glow | ||
|
||
> Make your Flow errors GLOW | ||
## Installation | ||
|
||
```sh | ||
# globally | ||
yarn global add glow | ||
# or in your project | ||
yarn add --dev glow | ||
``` | ||
|
||
<img src="https://raw.githubusercontent.com/thejameskyle/glow/master/video.jpg" alt="Preview"/> | ||
|
||
## Usage | ||
|
||
In your existing Flow project, instead of running: | ||
|
||
```sh | ||
flow | ||
``` | ||
|
||
Simply run: | ||
|
||
```sh | ||
glow | ||
``` | ||
|
||
You can also filter errors down to a specific set of files by running: | ||
|
||
```sh | ||
glow path/to/whatever | ||
``` | ||
|
||
There's even an awesome watch mode: | ||
|
||
```sh | ||
glow --watch | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
var ver = process.versions.node; | ||
var majorVer = parseInt(ver.split('.')[0], 10); | ||
var cli; | ||
|
||
if (majorVer < 4) { | ||
throw new Error( | ||
'Node version ' + | ||
ver + | ||
' is not supported in Glow, please use Node.js 4.0 or higher.' | ||
); | ||
} else if (majorVer < 8) { | ||
cli = require('./dist/legacy/cli').default; | ||
} else { | ||
cli = require('./dist/modern/cli').default; | ||
} | ||
|
||
cli(process.cwd(), process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
var ver = process.versions.node; | ||
var majorVer = parseInt(ver.split('.')[0], 10); | ||
|
||
if (majorVer < 4) { | ||
console.error( | ||
'Node version ' + | ||
ver + | ||
' is not supported in Bolt, please use Node.js 4.0 or higher.' | ||
); | ||
process.exit(1); | ||
} else if (majorVer < 8) { | ||
module.exports = require('./dist/legacy/index'); | ||
} else { | ||
module.exports = require('./dist/modern/index'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"name": "glow", | ||
"version": "0.0.0", | ||
"description": "Make your Flow errors GLOW", | ||
"main": "index.js", | ||
"bin": { | ||
"glow": "cli.js" | ||
}, | ||
"repository": "https://github.com/thejameskyle/glow", | ||
"author": "James Kyle <[email protected]>", | ||
"license": "MIT", | ||
"keywords": ["flow", "cli", "bin", "errors", "reporter", "ui", "interface"], | ||
"files": ["index.js", "cli.js"], | ||
"engines": { | ||
"node": ">=8.4.0" | ||
}, | ||
"scripts": { | ||
"flow": "flow", | ||
"test": "ava", | ||
"format": "prettier --write **/*.{md,json,js}", | ||
"clean": "rm -rf dist", | ||
"build:legacy": "BABEL_ENV=legacy babel src -d dist/legacy", | ||
"build:modern": "BABEL_ENV=modern babel src -d dist/modern", | ||
"build": "yarn run clean && yarn build:legacy && yarn build:modern", | ||
"prepublish": "yarn build", | ||
"precommit": "lint-staged" | ||
}, | ||
"dependencies": { | ||
"@babel/code-frame": "^7.0.0-beta.38", | ||
"babel-runtime": "^6.26.0", | ||
"beeper": "^1.1.1", | ||
"blessed": "^0.1.81", | ||
"chalk": "^2.3.0", | ||
"clear": "^0.0.1", | ||
"find-up": "^2.1.0", | ||
"lodash.debounce": "^4.0.8", | ||
"meow": "^4.0.0", | ||
"multimatch": "^2.1.0", | ||
"read-pkg-up": "^3.0.0", | ||
"signal-exit": "^3.0.2", | ||
"spawndamnit": "^1.0.0", | ||
"strip-ansi": "^4.0.0" | ||
}, | ||
"peerDependencies": { | ||
"flow-bin": "^0.63.1" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.24.0", | ||
"babel-cli": "^6.26.0", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-flow": "^6.23.0", | ||
"fixturez": "^1.1.0", | ||
"flow-bin": "^0.63.1", | ||
"husky": "^0.14.3", | ||
"lint-staged": "^6.0.1", | ||
"prettier": "^1.10.2" | ||
}, | ||
"lint-staged": { | ||
"*.{js,json,md}": ["prettier --write", "git add"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// @flow | ||
import { type GlowOptions } from './types'; | ||
import { Logger } from './Logger'; | ||
import { Printer } from './Printer'; | ||
import { Interface } from './Interface'; | ||
import { LOG_LEVELS } from './constants'; | ||
import { Lang } from './Lang'; | ||
import EventEmitter from 'events'; | ||
|
||
export type EnvOptions = GlowOptions & { | ||
flowConfigPath: string, | ||
flowRootDir: string, | ||
flowBinPath: string | ||
}; | ||
|
||
export class Env extends EventEmitter { | ||
cwd: string; | ||
filters: Array<string>; | ||
watch: boolean; | ||
interactive: boolean; | ||
logLevel: number; | ||
|
||
flowConfigPath: string; | ||
flowRootDir: string; | ||
flowBinPath: string; | ||
|
||
lang: Lang; | ||
|
||
logger: Logger; | ||
printer: Printer; | ||
interface: Interface | null; | ||
|
||
constructor(opts: EnvOptions) { | ||
super(); | ||
|
||
this.cwd = opts.cwd; | ||
this.filters = opts.filters || []; | ||
this.watch = opts.watch || false; | ||
this.interactive = opts.interactive || this.watch; | ||
this.logLevel = opts.debug | ||
? LOG_LEVELS.debug | ||
: opts.quiet ? LOG_LEVELS.error : LOG_LEVELS.info; | ||
|
||
this.flowConfigPath = opts.flowConfigPath; | ||
this.flowRootDir = opts.flowRootDir; | ||
this.flowBinPath = opts.flowBinPath; | ||
|
||
this.lang = new Lang('en'); | ||
this.logger = new Logger({ env: this }); | ||
this.printer = new Printer({ env: this }); | ||
|
||
if (this.interactive) { | ||
this.interface = new Interface({ env: this }); | ||
this.interface.on('close', () => { | ||
process.exit(0); | ||
}); | ||
} else { | ||
this.interface = null; | ||
} | ||
} | ||
|
||
setFilters(filters: Array<string>) { | ||
this.filters = filters; | ||
this.emit('filter', this.filters); | ||
} | ||
} |
Oops, something went wrong.