/bit

Turn your existing source code into a collection of reusable components. Develop and compose components from any application environment.

Primary LanguageJavaScriptOtherNOASSERTION

Bit

apache prs Appveyor Status Circle Status

Bit turns your existing source code into a collection of reusable components. You can easily develop and compose components from any application environment, without changing your source code. Bit works great for utility functions, web components (native, React, Angular etc.), small node.js modules and more.

  • Turn any subset of files into a component without changing your source code or file-system structure. Create multiple components with a single command.
  • Develop and compose components locally from any project, build and test them in any application environment.
  • Discover components you and your team love and trust. Measure and monitor components quality through auto-generated docs and test results.
  • Universal control over your dependency graph. Commit and test vast changes of dependencies and dependents at once. Bit components are also immutable.

Bit is an Apache 2.0 open-source project, actively maintained by a full-time, venture-backed team. It's also being used by popular open source communities.

Supported Languages

Bit is language agnostic. Still, It requires binding and additional programming language sensitive features for different programming languages. To do so, Bit uses language-specific drivers:

Quick start

Install Bit

See different install methods for different operation systems.

Initialize Bit for your project

Initializing Bit on an existing project adds Bit’s virtualization.

bit init

Add components

Bit add allows 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 nodejs module.

bit add src/utils/pad-left.js
# Tracked utils/left pad with files 

You can use glob patterns to track a vast amount of components at once:

bit add src/utils/*.js
# Tracked 24 new components

Commit

Bit commit, commits changes to new and existing components in your application.

To check which components were changed or added and about to be committed, you can use bit status:

bit status
# New components:
#   utils/pad-left
# Modified components:
#   utils/is-string

To 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.

Export

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 bit.utils
# bit.utils is your Scope name

Import

Bit import enables to install component (as an application part) you’ve tracked in any destination on your project’s file system.

Let's import the component we just created to a new project.

  1. Create a new project.
  2. Initialize a new scope using the bit init command.
  3. Import the component
bit import my-scope/pad-left

The component is now it in the components directory, ready to be used in your code.

Use:

const component = require('./components/utils/pad-left');

Why Bit - Built for code components

Because we believe code should be written once, and evolve over time. Atomic pieces of code should be composed together as lego bricks to form any functionality. Yet, as software development is being scaled, creating, finding and composing these atomic components is getting harder. Having the right tool to develop and compose components with simplicity, predictability and ease of use is the key to bringing this philosophy from theory to practice. With Bit, you can turn existing source code into a beautiful collection of reusable components- for you or your team. You can develop and compose components in any application environment, making them the perfect building blocks for your different projects.

Contributing

Contributions are always welcome, no matter how large or small. Before contributing, please read the code of conduct.

See Contributing.

Feedback

Feedbacks are more than welcome: team@bitsrc.io

License

Apache License, Version 2.0

Analytics