Commands and CLI
A key part of using Factor is working with its command-line-interface (CLI). The CLI is used to help orchestrate tasks across the system.
- Start a Factor app with
@factor/coreas a dependency
- Run the initial
yarn installon the directory to install dependencies
- You should now have the CLI available in that directory using
yarn factor [command]
Primary Factor Commands
Run Development Server
The aptly named
dev command starts your local development server and runs Factor in development mode.
# Run dev server $ yarn factor dev
Run Production Server
Running your application on your Node server takes two steps:
factor buildBuild the production app (creates
factor serveServe the app
# Build your production app $ yarn factor build # Serve your built app $ yarn factor serve [NODE_ENV] # Build and serve your app $ yarn factor start
Factor provides a special
setup helper command that helps you configure any keys or information needed by Factor and/or plugins you've installed.
# Run setup utility $ yarn factor setup
Common CLI Options
--PORT - Set the desired port to serve your application. Defaults to
--ENV - Set the FACTORENV environmental variable. _Defaults to
# If a callback is added as "cli-run-my-custom-cli" $ yarn factor run my-custom-cli
This command runs various operations that have been added by extensions and components. Reference their documentation for specifics, read about creating a custom command below.
$ yarn factor setup
Starts the Factor setup utility. The setup utility is used to configure setting and is commonly extended by plugins to help reduce guesswork in setting things up.
$ yarn factor help
Displays available commands in the CLI (from both the framework and your installed extensions).