LogoRobo.js
Framework

Mode

Variable: Mode

const Mode: Readonly<{
  color: (text) => string;
  get: {};
  is: (mode) => boolean;
  isDev: () => boolean;
}>;

Modes are a way to define "profiles" for your Robo session. Each with its own config(s), envionment variables, and code.

import { Mode } from 'robo.js'

// Get the current mode
const mode = Mode.get()

// Check if the current mode is "dev"
if (Mode.is('dev')) {
 // Do something
}

// Check if running via `robo dev` CLI (regardless of --mode)
if (Mode.isDev()) {
 // Development tooling is available
}

// Colorize text based on the current mode
console.log(Mode.color('Hello, world!'))

Everything is granular. You can even run multiple modes at the same time!

Learn more: Mode

On this page