Website & community • Short video • Demo project • Demo collection
Bit enables you to share components from your existing source-code into shared playlist-like collections, share them with your team, and install or update them from any project with simple & curated maintenance.
You and your team can easily share and discover components, collaborate, get updates and stay in sync.
Bit works great for React or Angular components, Node modules, utility functions and more.
-
Turn any existing subset of files into a reusable component without changing your source code or file structure. Turn any bulk of source code into a shared collection of components using simple commands.
-
Great discoverability for components you and your team love and trust. Determine and monitor component quality through auto-generated docs and test results.
-
Gain universal control over your dependency graph. Commit and test vast dependency changes at once. Build and test any component in any application environment.
-
Coming soon: Install components with the tools you love - NPM, Yarn or Bit. Create and update components in seconds from any project using Bit, and use the tool of you choice to install them.
Bit is an open-source collaborative project, actively maintained by a full-time venture-backed team and used by organizations and open source teams.
-
An example of a React movie-app component library shared with Bit as a collection of individually accessible and discoverable components - without forcing source-code and filesystem changes to the repository itself.
-
A short demo video of sharing these components across applications.
Bit is language agnostic. Still, it requires binding and additional language sensitive features for different programming languages. To do this, Bit uses language-specific drivers:
You can find a list of command examples here.
See different install methods for different operation systems.
Initializing Bit on an existing project adds Bit’s virtualization.
bit initBit add allows you to track a subset of files or directories as a reusable code component. Classic use cases would be web components (native, react, angular, etc.), utility functions or any other node.js module.
bit add src/utils/left-pad.js
# tracking component utils/left-pad:
# added src/utils/left-pad.jsYou can use glob patterns to track a vast amount of components at once:
bit add src/utils/*.js
# tracking 24 new componentsBit commit commits changes to new and existing components in your application.
To check which components were changed or added and are about to be committed, you can use bit status:
bit status
# new components:
# utils/left-pad
# modified components:
# utils/is-stringTo commit all changes use:
bit commit -am ‘committed my first tracked code components'Now all your components are staged, and ready to be pushed or used from any other project.
You can push staged/committed components to any remote Scope hosted on bitsrc.io or created on any machine (and connected via SSH).
You can set up a free Bit Scope at Bit’s community hub, and follow the setup instructions.
It’s also possible to easily set up a remote scope on your own computer.
Once you have a remote scope ready, run the export command:
bit export username.scope_name
# exported 2 components to scope `username.scope_name`Bit import enables you to install a component as an application part in any destination on your project’s file system.
Let's import the component we just created to a new project.
- Create a new project.
- Initialize a new scope using the bit init command.
- Import the component
bit import username.scope_name/utils/left-padThe component is now in the components directory, ready to be used in your code.
Use:
const component = require('./components/utils/left-pad');
# 'components' is the default location for imported componentsIn today's software architecture, and with new frameworks such as React, Angular and more, it becomes increasingly important to share, discover and reuse different parts of our source code with our team and across repos.
Using shared libraries resembles in many ways to using a static CD-Rom: it contains a lot of stuff we don't need in every use, they add weight and complexity, maintaining or updating them is hard - and they make discoverability very difficult.
To solve this, we created Bit. It allows us to share any number of parts from our source-code into a playlist-like collection of reusable components, and share them with our team across projects. Individual components can be discovered, used or updated from any project.
With Bit, we can easily organize, share and discover our components, reduce our app's size and build times, use nothing but the code we need, and get useful information for choosing the rights components.
We've been using it for over 8 months, and so do many organizations and different communities. Feel free to try it out, contribute or add drivers for any language you wish.
Contributions are always welcome, no matter how large or small. Before contributing, please read the code of conduct.
See Contributing.
Feedbacks are more than welcome: [email protected]
Apache License, Version 2.0