Skip to content

Commit

Permalink
Merge pull request joarwilk#134 from acusti/patch-1
Browse files Browse the repository at this point in the history
Add example to README of how to run flowgen as an npm script
  • Loading branch information
orta authored Apr 3, 2021
2 parents b8441fe + 5c9efb0 commit 25b03f3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ done;

So if you have definition files in different dir, you can rename `lib` and run the script.

Here’s an example of the above as an npm script in `package.json` that excludes any typescript definition files found inside `node_modules`:
```json
"scripts": {
"build:flowtypes": "find . -type f -not -path './node_modules/*' -name '*.d.ts' -exec sh -c 'yarn flowgen --add-flow-header $1 -o ${1%.*.*}.js.flow' _ '{}' \\;"
}
```

You can then have a `build` script that generates flow types along the lines of `tsc --build && npm run build:flowtypes`.

## Contributing

Expand Down

0 comments on commit 25b03f3

Please sign in to comment.