mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-01-12 22:46:30 +08:00
Move adding flow to its own file
This commit is contained in:
21
docusaurus/docs/adding-flow.md
Normal file
21
docusaurus/docs/adding-flow.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
id: adding-flow
|
||||
title: Adding Flow
|
||||
---
|
||||
|
||||
Flow is a static type checker that helps you write code with fewer bugs. Check out this [introduction to using static types in JavaScript](https://medium.com/@preethikasireddy/why-use-static-types-in-javascript-part-1-8382da1e0adb) if you are new to this concept.
|
||||
|
||||
Recent versions of [Flow](https://flow.org/) work with Create React App projects out of the box.
|
||||
|
||||
To add Flow to a Create React App project, follow these steps:
|
||||
|
||||
1. Run `npm install --save flow-bin` (or `yarn add flow-bin`).
|
||||
2. Add `"flow": "flow"` to the `scripts` section of your `package.json`.
|
||||
3. Run `npm run flow init` (or `yarn flow init`) to create a [`.flowconfig` file](https://flow.org/en/docs/config/) in the root directory.
|
||||
4. Add `// @flow` to any files you want to type check (for example, to `src/App.js`).
|
||||
|
||||
Now you can run `npm run flow` (or `yarn flow`) to check the files for type errors.
|
||||
You can optionally use an IDE like [Nuclide](https://nuclide.io/docs/languages/flow/) for a better integrated experience.
|
||||
In the future we plan to integrate it into Create React App even more closely.
|
||||
|
||||
To learn more about Flow, check out [its documentation](https://flow.org/).
|
||||
@@ -11,7 +11,6 @@ You can find the most recent version of this guide [here](https://github.com/fac
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Adding Flow](#adding-flow)
|
||||
- [Adding Relay](#adding-relay)
|
||||
- [Adding a Router](#adding-a-router)
|
||||
- [Adding Custom Environment Variables](#adding-custom-environment-variables)
|
||||
@@ -34,25 +33,6 @@ You can find the most recent version of this guide [here](https://github.com/fac
|
||||
- [Advanced Configuration](#advanced-configuration)
|
||||
- [Alternatives to Ejecting](#alternatives-to-ejecting)
|
||||
|
||||
## Adding Flow
|
||||
|
||||
Flow is a static type checker that helps you write code with fewer bugs. Check out this [introduction to using static types in JavaScript](https://medium.com/@preethikasireddy/why-use-static-types-in-javascript-part-1-8382da1e0adb) if you are new to this concept.
|
||||
|
||||
Recent versions of [Flow](https://flow.org/) work with Create React App projects out of the box.
|
||||
|
||||
To add Flow to a Create React App project, follow these steps:
|
||||
|
||||
1. Run `npm install --save flow-bin` (or `yarn add flow-bin`).
|
||||
2. Add `"flow": "flow"` to the `scripts` section of your `package.json`.
|
||||
3. Run `npm run flow init` (or `yarn flow init`) to create a [`.flowconfig` file](https://flow.org/en/docs/config/) in the root directory.
|
||||
4. Add `// @flow` to any files you want to type check (for example, to `src/App.js`).
|
||||
|
||||
Now you can run `npm run flow` (or `yarn flow`) to check the files for type errors.
|
||||
You can optionally use an IDE like [Nuclide](https://nuclide.io/docs/languages/flow/) for a better integrated experience.
|
||||
In the future we plan to integrate it into Create React App even more closely.
|
||||
|
||||
To learn more about Flow, check out [its documentation](https://flow.org/).
|
||||
|
||||
## Adding Relay
|
||||
|
||||
Relay is a framework for building data-driven React applications powered by GraphQL. The current release candidate of Relay works with Create React App projects out of the box using Babel Macros. Simply set up your project as laid out in the [Relay documentation](https://facebook.github.io/relay/), then make sure you have a version of the babel plugin providing the macro.
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
"adding-images-fonts-and-files",
|
||||
"using-the-public-folder",
|
||||
"using-global-variables",
|
||||
"adding-bootstrap"
|
||||
"adding-bootstrap",
|
||||
"adding-flow"
|
||||
],
|
||||
"Testing": ["running-tests", "debugging-tests"],
|
||||
"Deployment": ["publishing-components-to-npm", "deployment"],
|
||||
|
||||
Reference in New Issue
Block a user