"Fossies" - the Fresh Open Source Software Archive

Member "flow-0.149.0/README.md" (14 Apr 2021, 4642 Bytes) of package /linux/www/flow-0.149.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field. See also the latest Fossies "Diffs" side-by-side code changes report for "README.md": 0.148.0_vs_0.149.0.

Flow

CircleCI Follow @flowtype GitHub GitHub contributors GitHub top language Join Discord Chat

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.

Contents

Requirements

Flow works with:

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

Using Flow

Check out the installation instructions, and then how to get started.

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, but JavaScript packages which make use of parsing Flow-typed JavaScript can use this to generate Flow's syntax tree with annotated types attached.

Building Flow from source

Flow is written in OCaml (OCaml 4.09.1 is required).

  1. Install opam:
  1. Validate the opam version is 2.x.x:
opam --version

The following instructions expect 2.x.x. Should your package manager have installed a 1.x.x version, please refer to the opam docs to install a newer version manually.

  1. Initialize opam:
opam init
  1. Install OCaml and Flow's dependencies:
# from within this git checkout
opam switch create . --deps-only -y
  1. Build the flow binary:
eval $(opam env)
make

This produces the bin/flow binary.

  1. Build flow.js (optional):
opam install -y js_of_ocaml.3.7.1
make js

This produces bin/flow.js.

The Flow parser can also be compiled to JavaScript. Read how here.

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

License

Flow is MIT-licensed (LICENSE). The website and documentation are licensed under the Creative Commons Attribution 4.0 license (website/LICENSE-DOCUMENTATION).