GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - admmasters/flow: Adds static typing to JavaScript to improve developer productivity and code quality.

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

4,313 Commits
4,313 Commits

Folders and files

NameName
Last commit message
Last commit date
examples
examples
 
 
flow-typed
flow-typed
 
 
hack
hack
 
 
js
js
 
 
lib
lib
 
 
newtests
newtests
 
 
npm-flow-lib
npm-flow-lib
 
 
resources
resources
 
 
scripts
scripts
 
 
src
src
 
 
tests
tests
 
 
tsrc
tsrc
 
 
website
website
 
 
.flowconfig
.flowconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.merlin
.merlin
 
 
.travis.yml
.travis.yml
 
 
00_config.ocp
00_config.ocp
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Changelog.md
Changelog.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
PATENTS
PATENTS
 
 
README.md
README.md
 
 
README.win32
README.win32
 
 
_tags
_tags
 
 
appveyor.yml
appveyor.yml
 
 
make.bat
make.bat
 
 
ocp_build_flow.ocp.fb
ocp_build_flow.ocp.fb
 
 
ocp_build_hack.ocp.fb
ocp_build_hack.ocp.fb
 
 
opam
opam
 
 
package.json
package.json
 
 
runtests.sh
runtests.sh
 
 
tool
tool
 
 
yarn.lock
yarn.lock
 
 

Repository files navigation

Flow Build Status Windows Build Status

Flow is a static typechecker for JavaScript. To find out more about Flow, check out flow.org.

For a background on the project, please read this overview.

Requirements

Flow works with:

  • Mac OS X
  • Linux (64-bit)
  • Windows (64-bit)

There are binary distributions for each of these platforms and you can also build it from source on any of them as well.

Installing Flow

Flow is simple to install: all you need is the flow binary on your PATH and you're good to go.

Installing Flow Per Project

The recommended way to install Flow is via the flow-bin npm package. Adding flow-bin to your project's package.json:

  • provides a smoother upgrade experience, since the correct version of Flow is automatically used based on the revision you check out
  • installs Flow as part of your existing npm install workflow
  • lets you use different versions of Flow on different projects
npm install --save-dev flow-bin
node_modules/.bin/flow

Installing Flow Globally

Although not recommended, you can also install Flow globally (for example, perhaps you don't use npm or package.json).

The best way to install globally is via flow-bin:

npm install -g flow-bin
flow # make sure `npm bin -g` is on your path

On Mac OS X, you can install Flow via the Homebrew package manager:

brew update
brew install flow

You can also build and install Flow via the OCaml OPAM package manager. Since Flow has some non-OCaml dependencies, you need to use the depext package like so:

opam install depext
opam depext --install flowtype

If you don't have a new enough version of OCaml to compile Flow, you can also use OPAM to bootstrap a modern version. Install OPAM via the binary packages for your operating system and run:

opam init --comp=4.03.0
opam install flowtype
eval `opam config env`
flow --help

Getting started

Getting started with flow is super easy.

  • Initialize Flow by running the following command in the root of your project
flow init
  • Add the following to the top of all the files you want to typecheck
/* @flow */
  • Run and see the magic happen
flow check

More thorough documentation and many examples can be found at https://flow.org.

Building Flow

Flow is written in OCaml (OCaml 4.03.0 or higher is required) and (on Linux) requires libelf. You can install OCaml on Mac OS X and Linux by following the instructions at ocaml.org.

For example, on Ubuntu 16.04 and similar systems:

sudo apt-get install opam libelf-dev
opam init --comp 4.03.0

On OS X, using the brew package manager:

brew install libelf opam
opam init --comp 4.03.0

Then, restart your shell and install these additional libraries:

opam update
opam install -y ocamlfind sedlex

Once you have these dependencies, building Flow just requires running

make

This produces a bin folder containing the flow binary.

In order to make the flow.js file, you first need to install js_of_ocaml:

opam install -y js_of_ocaml

After that, making flow.js is easy:

make js

The new flow.js file will also live in the bin folder.

Note: at this time, the OCaml dependency prevents us from adding Flow to npm. Try flow-bin if you need a npm binary wrapper.

Flow can also compile its parser to JavaScript. Read how here.

Using Flow's parser from JavaScript

While Flow is written in OCaml, its parser is available as a compiled-to-JavaScript module published to npm, named flow-parser. Most end users of Flow will not need to use this parser directly (and should install flow-bin from npm above), but JavaScript packages which make use of parsing Flow-typed JavaScript can use this to generate Flow's syntax tree with annotated types attached.

Running the tests

To run the tests, first compile flow using make. Then run bash ./runtests.sh bin/flow

There is a make test target that compiles and runs tests.

To run a subset of the tests you can pass a second argument to the runtests.sh file.

For example: bash runtests.sh bin/flow class | grep -v 'SKIP'

Join the Flow community

  • Website: https://flow.org/
  • irc: #flowtype on Freenode
  • Twitter: follow @flowtype and #flowtype to keep up with the latest Flow news.
  • Stack Overflow: Ask a question with the flowtype tag

License

Flow is BSD-licensed. We also provide an additional patent grant.

About

Adds static typing to JavaScript to improve developer productivity and code quality.

flow.org/

Resources

Readme
License

Contributing

Contributing
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.