The workspace.jsonc
serves as the main configuration file for the workspace and its components.
workspace.jsonc
is composed of a list of Bit aspects, and their corresponding configurations.
For example, the following configuration is used to configure two Aspects:
teambit.workspace/workspace
: The Workspace Aspect (responsible for the Workspace)teambit.dependencies/dependency-resolver
: The Dependency Resolver Aspect (responsible for dependency management)
Since each Aspect is a component, it uses the Component ID pattern.
{ "teambit.workspace/workspace": { "name": "my-workspace", "defaultDirectory": "{scope}/{name}", "defaultScope": "company.scope" }, "teambit.dependencies/dependency-resolver": { "packageManager": "teambit.dependencies/pnpm", "policy": { "dependencies": { "classnames": "2.3.1", "text-transform": "^0.1.2" } } } }
The workspace configuration is extensible. It is not limited to a pre-configured list of Aspects.
teambit.workspace/workspace
receives configurations for the workspace itself, as well as default values for components managed by the workspace.
name: string;
The name of the workspace. This name will be displayed in the workspace UI.
icon: string;
Th path to an icon (svg, jpeg, etc.). The icon wll be displayed in the workspace UI.
defaultScope: string;
The default scope for all components in the workspace. This will be overridden by any other source of configuration, for example, variant.
defaultDirectory: string;
The default directory (relative path) to place a component during bit import
and bit create
.
The following placeholders are available:
name
- the component full namescopeId
- the scope-idscope
- scope nameowner
- owner name
For example:
{ "defaultDirectory": "{scope}/{name}" }
Aspects are fullstack components that implement the various features that make Bit. Aspects are composed together by consuming each others services.
Your workspace already uses the services of a various of aspects. Add an aspect to your workspace to extend it with new features that add Bit commands, UI tabs, and so on.
For example, to use a custom aspect that extracts the 'todo' comments of components in that workspace, run the following commands:
Install the aspect's peer dependencies in your workspace:
Run the following to add the custom aspect to your workspace:
The output notifies the aspect was added to your workspace config:
Now that this aspect is added to your workspace, components in that workspace will have their 'todos' as their metadata.
Try the custom 'todos' feature by running the newly-added bit todos COMPONENT_NAME
command in your terminal, or by exploring the newly-added 'To-dos' tab, in the UI. Make sure to restart your UI server, if it is already running.
