Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する
Command Reference

blocklet add


Adds a blocklet as a component dependency to the current blocklet project. This command allows you to build complex, composite applications by assembling various blocklets together.

This command fetches the metadata of the specified component (either from a URL or a Blocklet Store), adds it to the components array in your blocklet.yml file, and checks for circular dependencies to ensure a valid project structure.

For a high-level guide on creating composite applications, see Compose Components.

How It Works#

The blocklet add command follows a clear process to add a new component to your project:

Yes

No

Yes

No

Valid

Invalid

Start: blocklet add

Is param a URL?

Get meta from URL

Parse name and version

Get meta from Blocklet Store

Read local blocklet.yml

Component already exists?

Exit with success message

Add component config to meta

Check for circular dependencies

Update blocklet.yml file

Exit with error

Print success message


Command Usage#

blocklet add <name | url> [options]

Parameters#

Name

Type

Description

`<name

url>`

string

Options#

Option

Description

--title <title>

Specifies a custom title for the component. If not provided, the title from the component's metadata will be used.

--mount-point <mountPoint>

Defines a custom mount point (URL path) for the component. If not set, a URL-friendly version of the component's name is used (e.g., /my-component).

--store <store>

Specifies the URL of the Blocklet Store to fetch the component from. This overrides any store configured globally or in the current profile.

--profile <profile>

Uses a specific configuration profile from your Blocklet CLI settings. Defaults to default.

Examples#

Add a component from the default Blocklet Store#

This command fetches the latest version of the @blocklet/did-connect blocklet and adds it as a component.

blocklet add @blocklet/did-connect

After running the command, your blocklet.yml will be updated with a new entry in the components section:

# blocklet.yml

name: my-app
version: 1.0.0
# ... other fields

components:
- name: did-connect
title: DID Connect
mountPoint: /connect
source:
store: https://store.arcblock.io
name: '@blocklet/did-connect'
version: 'latest'

Add a component with a custom mount point and title#

You can customize how the component is integrated into your project.

blocklet add my-component --title "My Custom Component" --mount-point "/custom-path"

This will result in the following configuration in blocklet.yml:

# blocklet.yml

components:
- name: my-component
title: My Custom Component
mountPoint: /custom-path
source:
store: https://store.arcblock.io # or your configured store
name: my-component
version: 'latest'

Add a component from a specific URL#

If you have a direct link to a component's metadata, you can use it directly. This is useful for development or private components not published to a store.

blocklet add https://private-repo.com/my-component/blocklet.json

Your blocklet.yml will be updated accordingly:

# blocklet.yml

components:
- name: my-component # Name is read from the metadata file
title: My Component
mountPoint: /my-component
source:
url: https://private-repo.com/my-component/blocklet.json


Once you have added a component, you may need to remove it later. To learn how, proceed to the blocklet remove documentation.