Giter Club home page Giter Club logo

flow_study's Introduction

这篇是介绍如何配置 Atom、Nuclide、flow

  1. 安装 Atom
  2. 再 Atom 的 Preferences 中选择 install,搜索 Nuclide,然后安装
  3. 按照flow,可以运行如下命令:
  brew install flow
``
这里安装 flow 主要是由于 Nuclide 能够在后台运行 flow,实时(其实是文件保存时候)的使用 flow 检查。
当然同样可以使用 flow-bin 这个可以自己去搜
4. 创建一个目录,使用 npm init 创建一个工程。
5. 安装 babel-cli、babel-preset-flow
yarn add --dev babel-cli babel-preset-flow
由于 flow 在原生的 js 上面添加了一些类型信息,这些类型信息需要在执行之前去掉,否则无法执行。babel-preset-flow 主要是用于去掉这些信息的。所以也就说明,使用了 flow 之后,我们的 js 必须babel 转换后才能执行。
6. 添加 babel 编译配置文件。创建 .babelrc, 内容如下:
{
  "presets": ["flow"]
}
7. 启用 flow 检查。
在 js 文件的开始添加如下注释,就能够启用 flow 检查。
// @flow
8. 编译
在 package.js 中添加如下内容:
"scripts": {
  "build": "babel src/ -d lib/",
  "prepublish": "yarn run build"
},
然后运行 yarn run build, 就能够在 lib 文件夹中看到编译后的js了。

剩下的东西就看对应的js文件,一般都有注释。

flow_study's People

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.