Bit - Organize reusable components from your existing source-code into shared-collections. Shared collections are like "playlists" that allow you to share your components with you team, and install or update individual components from any project. You and your team can find and use these 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.
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:
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
# Tracked utils/pad-left with files You can use glob patterns to track a vast amount of components at once:
bit add src/utils/*.js
# Tracked 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
# username.scope_name is your Scope nameBit 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 componentsBuilding software out of smaller components makes for better software. Today, this becomes truer than ever before- entire applications are built using React or Angular components, and independent functionalities are scattered across repositories and microservices.
Still, as developers, we often struggle to organize, find and share our existing components of code to build new things. However, organizing and making our existing source-code components reusable - within a single project or across projects and teams - can become a real problem. To solve this, Bit allows us to turn any part of our source-code into a beautiful collection of reusable components with 2-3 simple commands.
This means we can create and organize a playlist-like collection of our favorite components, and use the ones we need wherever we need them. Bit has many more features, from collaboration to component CI, but the best way to learn more is simply to get started.
- Learn more: Coding in the age of code components
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