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

<component-name>

Required. The name of the component to be removed from the components list in your blocklet.yml file.

How It Works#

When you execute blocklet remove, the CLI performs the following steps:

  1. Locates Metadata: It finds the blocklet.yml file in the current working directory.
  2. Parses Components: It reads the file and looks for the components array.
  3. Verifies Existence: It checks if a component with the specified name exists in the array.
  4. Removes Entry: If the component is found, its entry is removed from the components array.
  5. Updates File: The blocklet.yml file 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-connect

The command will output a success message:

Console Output

Component did-connect was successfully removed

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