Skip to content

Genesis CLI

The command line tool for all things Genesis.

  • Run pnpm scripts with specific environments defined in theme-settings.json with run.
  • Execute plop generators with genesis create to quickly and efficiently scaffold content. See create for a list of available generators.

View in BitBucket

Installation & Usage

Installation:

Terminal
pnpm add -g @mvps-genesis/cli

Example Usage:

Terminal
genesis --help

Installation:

Terminal
pnpm add -D @mvps-genesis/cli

Example Usage:

Terminal
pnpm exec genesis --help

Commands

run

Run pnpm commands defined in your themes/genesis/package.json using the environment variables from your theme-settings.json

Usage:

Terminal
genesis run [pnpmScript] [env]
  • [pnpmScript]
    • Corresponds to the PNPM Scripts availabile in your themes/genesis/package.json.
  • [env]
    • Corresponds to the environments defined in your themes/genesis/themes-settings.json > environments object.
      • Typically this is something like: live, staging, dev, etc.

Example:

Terminal
cd themes/genesis

# Examples
genesis run start dev
genesis run build live

create

Automate the scaffolding of Genesis features by using plop generators.

Terminal
genesis create [generatorName]

The following generators are available to run:

  • extension - Create genesis, custom or optional extensions.
  • package - Create a new package in the genesis monorepo.
  • page - Create a new Genesis page.

Local Testing & Development

When working on this package in the monorepo you need to install it locally using the following command:

Terminal
pnpm add -g @mvps-genesis/cli
cd packages/cli
pnpm link -g

Once installed you can use the packages/cli/package.json > pnpm run watch command to have webpack automatically update the dist/cli.js when changing source code.

Terminal
cd packages/cli
pnpm run watch

Alternatively, you can use run the $ _genesis command to run off of lib/cli.js and leverage VS Code's JavaScript Debug Terminal to debug the local source code; rather than the compiled dist/cli.js.

Terminal
_genesis quickstart

Bash/Zsh Tab-Completion

Powered by the tabtab package.

Installation

Terminal
genesis install-completion

Note

You only have to run install-completion once per machine.

This will inject something like this into your .bashrc / .zshrc file:

Terminal
# tabtab source for packages
# uninstall by removing these lines
[[ -f ~/.config/tabtab/__tabtab.zsh ]] && . ~/.config/tabtab/__tabtab.zsh || true

After restarting your terminal window you should be able to get tab-completions for all commands, options and sub-commands for the genesis CLI. Just hit the Tab key after typing genesis in your terminal.

Un-Installation

Terminal
genesis uninstall-completion