Exporting components

Components are exported to remote scopes to make them available for other consumers and collaborators. A component is decoupled from its workspace and ready to be exported ('staged') when its latest changes are snapped.

Check your workspace status to review which snaps are ready to be exported:

$bit
Copiedcopy

The output lists components, grouped by their status:

staged components

> apps/to-do versions: 0.0.1 ... ok

Run the following to export all staged components:

$bit
Copiedcopy
See command synopsis

The output summarizes the number of exported components and their target remote scopes:

1 components were exported to scope my-org.tasks-scope

Viewing exported components

Exported components are hosted on their target remote scopes. Each remote scope stores the component versions and features a web UI similar to the workspace UI, in which all components are showcased.
To see all exported components open your browser and navigate to the Bit scope URL.

Ejecting components

To stop maintaining a component after it has been exported, 'eject' it from your workspace. This will remove the component from the workspace and install its package, instead (for consumption only).

$bit
Copiedcopy

Alternatively, component can be ejected, directly, at any time:

$bit
Copiedcopy
See command synopsis

Post export

The export process updates your workspace's .bitmap file. If you're using a traditional VCS like git to source-control your workspace, make sure to commit these changes.

$git commit -am 'updated .bitmap file after a successful export'
Copiedcopy

Export during CI

To learn how to use your CI to export components see the 'integrating Bit with your existing CI' blog.

Merge conflicts

You may encounter merge conflicts when trying to export a component. That happens when the version you are trying to export already exists in the remote scope.

Solve this by running the following steps:

  1. Reset the components' latest unexported snaps (this will remove the latest snaps but will keep latest local changes):
$bit
Copiedcopy
  1. Update your component and merge latest changes

  2. Snap and export the component