Remove Component
The blocklet remove command provides a straightforward way to remove a component dependency from your blocklet's blocklet.yml metadata file. This action updates your project configuration to reflect that the component is no longer a dependency.
Command Usage#
To remove a component, navigate to your blocklet's root directory and run the command with the name of the component you wish to remove.
Command
blocklet remove <component-name>Arguments#
Argument | Description |
|---|---|
| Required. The name of the component to be removed from the |
How It Works#
When you execute blocklet remove, the CLI performs the following steps:
- Locates Metadata: It finds the
blocklet.ymlfile in the current working directory. - Parses Components: It reads the file and looks for the
componentsarray. - Verifies Existence: It checks if a component with the specified name exists in the array.
- Removes Entry: If the component is found, its entry is removed from the
componentsarray. - Updates File: The
blocklet.ymlfile is saved with the updated list of components.
If the specified component is not found in blocklet.yml, the command will print an error message and exit.
Example#
Imagine your blocklet.yml file contains a dependency on a component named did-connect:
blocklet.yml (Before)
name: my-blocklet
version: 1.0.0
# ... other properties
components:
- name: my-first-component
did: "z8iZqsENBg6tLZUKi2HABj38Cw1LmHZocbQ"
- name: did-connect
did: "z8ia29UsENBg6tLZUKi2HABj38Cw1LmHZocbQ"To remove the did-connect component, you would run:
blocklet remove did-connectThe command will output a success message:
Console Output
Component did-connect was successfully removedAfter execution, your blocklet.yml file will be updated to remove the entry for did-connect:
blocklet.yml (After)
name: my-blocklet
version: 1.0.0
# ... other properties
components:
- name: my-first-component
did: "z8iZqsENBg6tLZUKi2HABj38Cw1LmHZocbQ"Next, you might want to add a new component to your project. Learn how by visiting the Add Component guide.