Flow CLI
Инструмент командной строки flow создан для простоты использования в простых случаях.
Использование команды flow позволит проверить типы в текущей директории, если файл .flowconfig присутствует. Сервер flow автоматически запустится при необходимости.
Инструмент командной строки также предоставляет несколько других опций и команд, которые позволяют управлять сервером и инструментами сборки, интегрированными с Flow. Например, так редактор Nuclide интегрируется с Flow, чтобы обеспечить автодополнение, сообщения об ошибках типов и т.д. в своём интерфейсе.
Чтобы узнать больше об инструменте командной строки, просто введите:
flow --help
Это предоставит информацию обо всём, что может делать flow. Выполнение этой команды должно вывести что-то вроде этого:
Usage: flow [COMMAND] [PROJECT_ROOT] Valid values for COMMAND: ast Print the AST autocomplete Queries autocompletion information batch-coverage Shows aggregate coverage information for a group of files or directories check Does a full Flow check and prints the results check-contents Run typechecker on contents from stdin config Read or write the .flowconfig file coverage Shows coverage information for a given file cycle Output .dot file for cycle containing the given file find-module Resolves a module reference to a file find-refs Gets the reference locations of a variable or property force-recheck Forces the server to recheck a given list of files get-def Gets the definition location of a variable or property get-imports Get names of all modules imported by one or more given modules graph Outputs dependency graphs of flow repositories init Initializes a directory to be used as a flow root directory ls Lists files visible to Flow lsp Acts as a server for the Language Server Protocol over stdin/stdout [experimental] print-signature Prints the type signature of a file as extracted in types-first mode server Runs a Flow server in the foreground start Starts a Flow server status (default) Shows current Flow errors by asking the Flow server stop Stops a Flow server type-at-pos Shows the type at a given file and position version Print version information Default values if unspecified: COMMAND status PROJECT_ROOT current folder Status command options: --color Display terminal output in color. never, always, auto (default: auto) --from Specify client (for use by editor plugins) --help This list of options --json Output results in JSON format --no-auto-start If the server is not running, do not start it; just exit --old-output-format Use old output format (absolute file names, line and column numbers) --one-line Escapes newlines so that each error prints on one line --quiet Suppresses the server-status information that would have been printed to stderr --retries Set the number of retries. (default: 3) --show-all-errors Print all errors (the default is to truncate after 50 errors) --strip-root Print paths without the root --temp-dir Directory in which to store temp files (default: /tmp/flow/) --timeout Maximum time to wait, in seconds --version Print version number and exit
Пример с настраиваемой корневой директорией проекта:
mydir ├── frontend │ ├── .flowconfig │ └── app.js └── backend
flow check frontend
Вы можете углубиться в конкретные команды, добавив --help флаг.
Например, если вы хотите узнать больше о том, как работает автодополнение, вы можете использовать эту команду:
flow autocomplete --help
© 2013–present Facebook Inc.
Licensed under the MIT License.
https://flow.org/en/docs/cli