Bojagi Docs

Bojagi Docs

  • Docs

›DOCUMENTATION

GETTING STARTED

  • Quick Start
  • Frequently Asked Questions

TUTORIALS

  • Setup Bojagi With React and Storybook
  • Setup Bojagi With React and Without Storybook

DOCUMENTATION

  • Write Stories
  • CLI
  • .bojagirc
  • Continuous Integration

Command Line Interface (CLI)

The Bojagi CLI is a toolchain which assists in previewing local stories and deploying them to the Bojagi service.

Installation

Bojagi CLI requirements:

  • React 16.8+
  • Webpack 4+
  • Node.js 12+

The @bojagi/cli CLI is to be installed within your repositories devDependencies:

Yarn
NPM
$ yarn add -D @bojagi/cli
$ npm install --save-dev @bojagi/cli

The preview command

Yarn
NPM
$ yarn bojagi preview
$ npx bojagi preview

Opens a local preview of how stories render inside the Bojagi webapp.

The deploy command

The easiest way to do this is with the following command:

Yarn
NPM
$ yarn bojagi deploy
$ npx bojagi deploy

This command does component analysis, builds the components with webpack and uploads them to Bojagi.

The above command works without specifying the commit. In the case your CI is not supported or the commit couldn't be received through the git client, use the --commit argument:

Yarn
NPM
$ yarn bojagi deploy --commit commit-sha1-id
$ npx bojagi deploy --commit commit-sha1-id

The deploy command is an all-in-one command that does the same as the following commands

  • bojagi build
  • bojagi upload

Because of this, the deploy command accepts all arguments, that you can pass to these commands. For more detailed descriptions see further below.

Going through the process step by step

In some cases you need to have more control over the deploy process. For those cases, the process can be split into smaller subtasks with the following commands:

  • bojagi build
  • bojagi upload

The build command

Yarn
NPM
$ yarn bojagi build
$ npx bojagi build

The build command scans the repository for stories and bundles the matching components. Currently, the supported module bundler is webpack.

This creates the components JavaScript files and a commons.js file that includes all JavaScript code that is shared by all components.

The upload command

Yarn
NPM
$ yarn bojagi upload
$ npx bojagi upload

After the components build they can be uploaded. The upload command optionally accepts the commit ID with the --commit argument. The commit is automatically retrieved from the environment variables. When the commit can't be detected, it needs to be passed specifically. Note that when specifying the commit via an argument, it overrides the commit detected from your CI or Git.

The scan command

Yarn
NPM
$ yarn bojagi scan
$ npx bojagi scan

Lists the number of found stories. Convenient when testing a custom storyPath configuration.

← Write Stories.bojagirc →
  • Installation
  • The preview command
  • The deploy command
    • Going through the process step by step
  • The build command
  • The upload command
  • The scan command
Bojagi
HomepageWeb AppGitHubIssue Tracker
Copyright © 2021 Bojagi