LogoWidgetbook

Builds

When you create a new commit in Git, a new version of your code is created. With Widgetbook builds developers make the new version of their local Widgetbook accessible for the whole team. If set up with CI/CD, you can have a build for each commit, for each pull-request and for each branch.

Build process#

Widgetbook Cloud builds have to be uploaded based on a Flutter web build. To create a Flutter web build, follow these steps:

  1. Locate your Widgetbook project
  2. Run the build runner by using flutter pub run build_runner build -d
  3. Run flutter build web -t widgetbook.dart

Publish a build#

A Flutter web build of Widgetbook is published by using the Widgetbook CLI. An API key is required to publish a build. See How to Create an API Key for more information.

To publish a build, follow these steps:

  1. Activate the CLI by running pub global activate widgetbook_cli
  2. Run widgetbook publish --api-key API-KEY

Feel free to customize the publish command by reading into the CLI arguments.

Publishing builds with the CI/CD is recommended as the setup is less error prone and more autonomous. See CI/CD Setup for more information.

Example#

# Install dependencies
flutter pub get
# Optional: Run the build runner
flutter pub run build_runner build --delete-conflicting-outputs
# Build the Widgetbook
flutter build web -t lib/ui_catalogs.widgetbook.dart
# Install the CLI
dart pub global activate widgetbook_cli
# Run the CLI
widgetbook publish --api-key API-KEY