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 componentbit import
to work and change the component
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
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
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.