
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
flow-scripts
Advanced tools
Utility tools for Flow. Provides a few helpful functions like generating stubs and finding files that are not covered by Flow. Refer to the commands section for more.
If you have suggestions for further commands, feel free to create an issue.
$ npm install -g flow-scripts
$ flow-scripts <command> [options]
Stub$ flow-scripts stub
Generates naive stubs for the packages that your project requires. To be used with flowignore-ing of node_modules for faster start up times.
If you are:
flowignore the node_modules folderIt also possible to combine usage of flow-typed install with flow-scripts stub as stubs for existing libdefs found in flow-typed/npm/ will not be generated.
By default, running Flow on start up will read all the files under node_modules. This takes very very long and it is a huge pain to be waiting that long each time your web app starts. According to Facebook, ignoring the node_modules directory isn't a good idea because Flow looks in there to a) ensure you've actually installed your dependencies and b) find Flow libdefs for packages which might have included them, and Flow will throw a Required module not found error. Refer to this issue for an in-depth discussion on the topic.
However, combined with the inclusion of libdefs (or stubs) for external libraries, ignoring node_modules might not seem like that bad an idea after all.
The workaround is to flowignore the node_modules directory and include the libdefs inside the flow-typed/ directory or provide a stub for it. This can be done manually or automatically via the flow-typed install command.
The flow-typed install command does fetch community libdefs and generates stubs pretty well, but has a few problems:
flow-typed/npm/, such as immutable because it is already present in node_modules/immutable. This is not picked up because we flowignore the node_modules.The flow-scripts stub command fixes some of these problems by generating the stubs required for the dependencies in package.json. If there are existing libdef files in the flow-typed/npm directory, the stubs for these libraries will not be generated.
In .flowconfig, add:
[ignore]
.*node_modules/.*
In the project directory, run:
$ flow-scripts stub
This will do the following:
node_modules.dependencies in package.json that are not present in flow-typed/npm/ and write them into flow-typed/package-dep-libdefs.js.Optional: By adding the script to an npm script postinstall hook, when new packages are installed, it will be automatically added into flow-typed/. It would be recommended to save flow-scripts as a devDependency rather than a global dependency in this case.
In package.json, add this postinstall hook:
"scripts": {
"postinstall": "flow-scripts stub"
},
lodash and want to import a specific function like lodash/omit, it will not work as the stub generated by flow-scripts stub is for lodash and not lodash/omit. In that case, you might want to pull in a community libdef from flow-typed instead.immutable.Unmonitored$ flow-scripts unmonitored [options] [pattern]
Searches for files matching the specified glob pattern and lists the files that do not contain @flow. Files that have @noflow are ignored. If pattern is not specified, it defaults to ./**/*.{js,jsx}. Please note that this commands works on files only, and not directories, hence you will have to explicitly specify a file extension. You will also have to quote your parameter (use double quotes if you need it to run in Windows). An example as follows:
$ flow-scripts unmonitored "src/**/*.js"
--fix: Automatically fix those files by adding // @flow at the top.Testing this library is tricky because it relies on a real project that has multiple dependencies in package.json. Hence we create a mock project in the fixtures folder that has some common JS dependencies defined and symlink the flow-scripts library within that project to our development file in the root folder. Run the commands within that mock project to test that the library is actually working as intended.
$ cd test-project
$ npm install # or yarn install
$ npm link ../
$ flow-scripts stub # flow-typed/package-dep-libdefs.js file should be generated
FAQs
Utility scripts for Flowtypes
We found that flow-scripts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.