Skip to main content

Ottoman CLI

Goals:

  • Provide some useful tools while working with Ottoman.
  • Speed up the Ottoman setup process.
  • Help keep databases in sync across Development and Production environments.
  • Automate Ottoman's setup process.

Install

npm install -g ottoman-cli

Usage:

ottoman-cli generate

or

npx ottoman-cli generate <do not required previous installation>

Commands:

  • generate
  • migrate

Generate command

The Ottoman CLI's generate command will bootstrap an Ottoman app for you in no time! Simply follow the steps in the wizard. Happy Coding!

ottoman-cli generate

generate.png

Migrate command

ottoman-cli migrate

The Ottoman CLI's migrate command will sync your database with the information took from your models. Scopes, Collections and Indexes will be created automatically after run the migrate command.

Constraints:

  1. You should build your app before run the migrate command
npm run build
ottoman-cli migrate
  1. env variables should point to the built code

Correct

OTTOMAN_CLI_MODEL_PATTERN="dist/**/*.model.js"

Incorrect

OTTOMAN_CLI_MODEL_PATTERN="src/**/*.model.ts"
  1. OTTOMAN_CLI_ENTRY="dist/config/ottoman.js" entry point file should export an ottoman instance
import { Ottoman } from "ottoman";

const ottoman = new Ottoman(...);

export { ottoman };