Scope is a collaboration server for components. It is where components are exported to and imported from. Scopes provide a Web UI and expose a GraphQL API. They can be extended and customized using Bit aspects.
Choose between hosting a scope on bit.cloud (for free) and self-hosting:
Bit uses bit.cloud as its default hosting provider. To register or sign in from your terminal, run the following:
Once an account has been created successfully, your terminal will greet you with the following message:
Now that you have set up your account and logged in, head over to the create scope page to create a new scope. Choose a name for your scope that describes the common purpose or functionality of your components.
Now that you've created a remote scope on bit.cloud, verify that the defaultScope
property in the workspace.jsonc
config file, is set to the correct username/org and scope name.
{ "teambit.workspace/workspace": { /* set a scope with this pattern: <username-or-org>.<scope-name> */ "defaultScope": "my-org.tasks-scope" } }
The scope name is part of the component ID. When the scope name changes, the relevant component IDs change. To reflect that change in the component package names, run the following:
Maintaining components of different scopes in the same workspace
The defaultScope
property defines the default scope name for components in that workspace.
However, components in the same workspace can be configured to use different scopes.
You can set a scope on a component (directly) when creating a new component, or after a component was created:
Once a component is snapped, its scope name can no longer be changed. To reset all components (which exist only locally) back to their 'new' and un-versioned state, run:
Alternatively, use the scope
command shown above, to change the scope name while still retaining the components' history.