[Babel](http://babeljs.io/) is a compiler for JavaScript code that has
support for Flow. Babel will take your Flow code and strip out any type
annotations.

First install `babel-cli` and `babel-preset-flow` with either
[Yarn](https://yarnpkg.com/) or [npm](https://www.npmjs.com/).

```sh
{{include.install_command}} babel-cli babel-preset-flow
```

Next you need to create a `.babelrc` file at the root of your project with
`"flow"` in your `"presets"`.

```json
{
  "presets": ["flow"]
}
```

If you then put all your source files in a `src` directory you can compile them
to another directory by running:

```sh
{{include.run_command}}babel src/ -d lib/
```

You can add this to your `package.json` scripts easily.

```json
{
  "name": "my-project",
  "main": "lib/index.js",
  "scripts": {
    "build": "babel src/ -d lib/",
    "prepublish": "{{include.package_manager}} run build"
  }
}
```

> **Note:** You'll probably want to add a `prepublish` script that runs this
> transform as well, so that it runs before you publish your code to the npm
> registry.

[Babel](http://babeljs.io/) is a compiler for JavaScript code that has
support for Flow. Babel will take your Flow code and strip out any type
annotations.

First install `babel-cli` and `babel-preset-flow` with either
[Yarn](https://yarnpkg.com/) or [npm](https://www.npmjs.com/).

```sh
{{include.install_command}} babel-cli babel-preset-flow
```

Next you need to create a `.babelrc` file at the root of your project with
`"flow"` in your `"presets"`.

```json
{
  "presets": ["flow"]
}
```

If you then put all your source files in a `src` directory you can compile them
to another directory by running:

```sh
{{include.run_command}}babel -- src/ -d lib/
```

You can add this to your `package.json` scripts easily.

```json
{
  "name": "my-project",
  "main": "lib/index.js",
  "scripts": {
    "build": "babel src/ -d lib/",
    "prepublish": "{{include.package_manager}} run build"
  }
}
```

> **Note:** You'll probably want to add a `prepublish` script that runs this
> transform as well, so that it runs before you publish your code to the npm
> registry.

Use [-- <args>] syntax with `yarn run` command
[PR] Use [-- <args>] syntax with `yarn run` command

Summary:
Running through the installation I stumbled over an issue with the example command discarding arguments. It turns out to pass multiple arguments to `yarn run` commands you need to use the `[-- <args>]` syntax as explained here: https://github.com/yarnpkg/yarn/issues/1582#issuecomment-257535540
Closes https://github.com/facebook/flow/pull/3747

Differential Revision: D4898910

Pulled By: nmote

fbshipit-source-id: 8c7bb94c9256bddb328040462f7096f87340c3c5
