Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/ilyalesik/gen-flow-files

Script for transform javascript files to flowtype definition files
https://github.com/ilyalesik/gen-flow-files

flow flowtype

Last synced: about 1 month ago
JSON representation

Script for transform javascript files to flowtype definition files

Lists

README

        

# gen-flow-files

[![npm version](https://img.shields.io/npm/v/gen-flow-files.svg)](https://www.npmjs.com/package/gen-flow-files)
[![npm downloads](https://img.shields.io/npm/dt/gen-flow-files.svg)](https://www.npmjs.com/package/gen-flow-files)

This is a script which finds `.js` files with @flow annotation, extract flow definitions and save to specific folder.

As example, `/example.js`
```javascript
// @flow

extract function foo(arg1: number, arg2: string): string {
// some code here
}
```
will be transformed to `/example.js.flow`:
```javascript
// @flow

declare extract function foo(arg1: number, arg2: string): string;
```

## Installation

Install it with yarn:

```
yarn add gen-flow-files
```

Or with npm:

```
npm i gen-flow-files --save
```

## Usage
#### As part of build process

```json
scripts": {
...
"flow": "flow",
"build:flow": "gen-flow-files src --out-dir dist",
...
},
```
transfrom all *.js* files from `src` to *.js.flow* files and save them at `dist`.

#### As command
```
npx gen-flow-files --out-dir
```
transfrom all *.js* files from `` to *.js.flow* files and save them at ``.