Run the following to rename a component:
bit rename COMPONENT_SOURCE_NAME COMPONENT_TARGET_NAME [--scope SCOPE_TARGET_NAME] [--refactor]For example, the following command renames teambit.base-ui/loaders/skeleton to teambit.base-ui/placeholders/skeleton:
bit rename loaders/skeleton placeholders/skeletonVersioned components, unlike new components, might already be used by other components outside your workspace. For that reason, Bit sets the renamed component as 'deprecated' and adds a pointer to the new component.
$ bit show teambit.base-ui/loaders/skeleton
┌───────────────────┬────────────────────────────────────────────────────────────┐
│ id │ teambit.base-ui/loaders/skeleton@0.0.1 │
├───────────────────┼────────────────────────────────────────────────────────────┤
│ deprecated │ true (new-id: teambit.base-ui/placeholders/skeleton) │
├───────────────────┼────────────────────────────────────────────────────────────┤
│ ... │ ... │
└───────────────────┴────────────────────────────────────────────────────────────┘A pointer pointing to the deprecated component is added to the new component, as well.
$ bit show teambit.base-ui/placeholders/skeleton
┌───────────────────┬────────────────────────────────────────────────────────────┐
│ id │ teambit.base-ui/placeholders/skeleton │
├───────────────────┼────────────────────────────────────────────────────────────┤
│ deprecated │ false │
├───────────────────┼────────────────────────────────────────────────────────────┤
│ renaming │ origin: teambit.base-ui/loaders/skeleton@0.0.1 │
├───────────────────┼────────────────────────────────────────────────────────────┤
│ ... │ ... │
└───────────────────┴────────────────────────────────────────────────────────────┘Use the --refactor option to update import statements across all dependent components in your workspace. For example:
bit rename loaders/skeleton placeholders/skeleton --refactorAll occurrences of import { Skeleton } from '@teambit/base-ui.loaders.skeleton' are now replaced by import { Skeleton } from '@teambit/base-ui.placeholders.skeleton'.