
Head over to the component/module page ( Example). npm config set Īny package can now be installed using your native NPM/Yarn client. Now that our packages are ready, let’s learn how to install them.įirst, configure bit.dev as a scoped registry to your NPM client. Install packages using the NPM/Yarn client Piece of cake, and we can use this workflow to quickly publish large numbers of packages in very little time. $ bit export llection-name exported 3 components to scope llection-nameĪll your packages will now be available in your collection, ready to install using NPM/Yarn in any project. $ bit login Your browser has been opened to visit. $ bit tag -all 1.0.0 3 components tagged | 3 added, 0 changed, 0 auto-tagged added components: use bit login to authenticate your machine to Bit’s platform. Now, let’s tag a version for the packages we are about to publish (following the previous example). For assistance, visit Bit’s Gitter channel or Discourse board. You can also implement your own environments using Bit’s extension system. $ bit import bit.envs/compilers/babel -compiler $ bit import bit.envs/testers/mocha -tester Here’s a recommended example for React components. You can find a list of pre-made environments here. Now, let’s add build and test environments so that Bit can build and test your packages (on the cloud) and present the results for every package. Note that Bit will automatically run through the module’s file & package dependancies, and create and isolate environment for the code which contains everything it needs in order to run in other projects. $ bit add src/components/* tracking 3 new components To track these files as components we can use bit add with a glob pattern, pointing Bit to the path in which the modules we want to publish are found. Let’s track the components button, login and logo in the following project’s directory structure. Let’s point Bit to the right packages in the project using the bit add command. Instead of having to create a new repository, configure the package etc, let’s use Bit to isolate components and modules from existing projects and publish them as packages. #1 Install Bit npm install bit-bin -g #2 Create a local workspace for your project $ cd project-directory $ bit init Note that since we are using Bit, you can publish packages right from any existing project without refactoring.

Then, head over to the project in which you have the packages you want to publish.
