Moose CLI

Installation

MooseJS comes with a handy CLI for managing your MooseJS application. Navigate to your project's directory to run commands. There are a few ways to run the CLI:

The simplest method to run the CLI is via NPX. No extra installation is necessary for this method.

Terminal
npx @514labs/moose-cli <command>

Moose CLI commands

Init

Instead of using create-moose-app, you can initialize your project manually with the CLI, if you'd like more flexibility and control. Either option will initialize a new MooseJS project for you, with all the necessary directories including temporary ones for data storage.

Terminal
moose init <name> --language <language> <--location <location>> <--no-fail-already-exists>
  • <name>: Name of your app or service.
  • --language <language>: Language of your app or service. We currently only support Typescript.
  • --location <location>: Location of your app or service. The default is the name of the project.
  • --no-fail-already-exists: By default, the init command fails if location exists, to prevent accidental reruns. This flag disables the check.
  • Build

    Builds your moose project. Syncs model changes, performs cleanup and prepares your project for use and deployment.

    When the --docker flag is used, the Moose build command also packages your project into local Docker containers.

    Terminal
    moose build <--docker>

    Dev

    Starts a development environment running the full stack of your MooseJS application locally. As you develop your MooseJS application locally, changes you make to your codebase will be automatically reflected here in real-time (when you save changes).

    Terminal
    moose dev

    Prod

    Starts Moose in production mode. This command is automatically invoked from a packaged Moose Docker container.

    Terminal
    moose prod

    Flow

    Flow Init

    Generates a new Flow for you, including creating and structuring the necessary directories and files based on your specified data models. Learn more in the Flows docs.

    Terminal
    moose flow init --source <YourSourceDataModel> --destination <YourDestinationDataModel>

    Generate

    Generate Migrations

    Generates migration scripts for models that are different from the previous version. Learn more in the Data Change Management docs.

    Terminal
    moose generate migrations

    Bump Version

    Bumps the version field in package.json, and adds an entry of the current version and commit hash to [supported_old_versions] section in project.toml. Learn more in the Data Change Management docs.

    Terminal
    moose bump-version <new_version>
  • <new_version>: optional parameter, if omitted, moose will default to bumping the minor version.
  • Clean

    Clears all temporary data and stops development infrastructure.

    Terminal
    moose clean