Skip to content

Instantly share code, notes, and snippets.

@jimmi-joensson
Last active February 19, 2020 12:06
Show Gist options
  • Save jimmi-joensson/348e2b4d8a35b7caa36996c3324a9e0f to your computer and use it in GitHub Desktop.
Save jimmi-joensson/348e2b4d8a35b7caa36996c3324a9e0f to your computer and use it in GitHub Desktop.
Bit Workflow

Working with Bit

The bit-cli has to be installed and initialized in the project

There are two ways to import and work with Bit components.

  • npm install for just using the component
  • bit import to work and change the component

NPM

First make sure @bit:registry=https://node.bit.dev is added to client/.npmrc. This registers bit's scope to npm.

The naming convention for Bit components is like this: npm i @bit/user.collection.button

Bit

When it is necessary to work on a component, the component has to be imported using bit import.

The naming convention for Bit components is like this: bit import user.collection/button --dependents

The --dependents flag imports all dependents together with the specified component. This is usefull to update all dependents with the new version of [button]

The command is both used when importing a component for the first time and when a component is already installed with npm.

When a component is done changing it can be returned to the npm installation with bit eject user.collection/button

The component needs to be ejected before the current branch is pushed to the develop, release or master branch, so that there never is a bit imported component in the Aszure devOps build process

Usecase

A new feature is started by making the feature branch git checkout -b feature/new-feature

In the feature it is necessarry to make changes to [button] from our Bit repository.

  • [button] is already used and installed with npm i @bit/user.collection.button.
  • [button] is then imported with bit import user.collection/button --dependents.
  • [button]'s source files can afterwards be found at client/bit/button.

After finishing the changes and [button] + dependents are tagged with bit tag -a, the components are then reverted back to npm installs by using bit export --eject.

Check that everything is working before merging the feature back into develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment