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

blocklet


The blocklet command is the primary utility for managing the lifecycle of individual blocklets. It provides a suite of subcommands for initializing, developing, bundling, deploying, and distributing your blocklet projects.

Usage#

blocklet [options] [command]

Global Options#

Option

Description

-V, --version

Output the version number.

-y, --yes

Automatically answer "yes" to all prompts. Default is false.

-h, --help

Display help information for a command.


Commands#

create [name]#

Bootstrap a new blocklet project from various starter templates.

Option

Description

--did <did>

Specify a DID for the new blocklet.

--did-only

Only create a blocklet DID without creating a project.

init#

Create an empty blocklet project, including the essential blocklet.yml file.

Option

Description

--did [did]

Specify a DID for the blocklet.

-f, --force

Initialize the project without asking any questions. Default is false.

--monikers <monikers>

Provide a custom moniker for DID creation. Use commas to separate multiple values.

--connectUrl <connectUrl>

A connect URL to help generate the DID.

dev#

Run the blocklet in a local development environment with features like live-reloading.

Options

Option

Description

--open

Open a browser window after the blocklet starts. Default is false.

--app-id <did>

Develop the blocklet as a component mounted to a specific app.

--mount-point <mountPoint>

Specify the mount point when running as a component.

--store-url <storeUrl>

Set a default store URL for component dependencies.

--start-all-components

Automatically start all components defined in the blocklet. Default is false.

Subcommands

  • dev install: Install the blocklet in development mode.
  • dev start: Start the installed development blocklet. Supports --e2e option for end-to-end testing mode.
  • dev remove: Remove the development mode blocklet.
  • dev studio: Start the Blocklet Studio.
  • dev reset: Reset the blocklet's data.
  • dev faucet: Fund your app with test tokens. Supports --host and --token options.

bundle#

Package your blocklet and its assets into a distributable bundle.

Option

Description

--zip

Bundle using zip mode (default).

--simple

Bundle using simple mode.

--compact

Bundle with all dependencies included.

--dependencies-depth <number>

Set the depth of dependencies to include (default: 9).

--source-map

Create a source map (compact mode only).

--nosources-source-map <boolean>

Create a source map without including source content (compact mode only).

--minify / --no-minify

Enable or disable minification in compact mode (default: enabled).

--external <items>

Specify external dependencies to exclude from the bundle (comma-separated).

--create-release

Create a release tarball and metadata.

--create-archive

Create an archive *.zip file.

--monorepo

Indicate that the blocklet is part of a monorepo.

--changelog / --no-changelog

Include or exclude CHANGELOG.md (default: included).

--store-url <storeUrl>

Set a default store URL for component dependencies.

deploy <folder>#

Deploy a blocklet from a local directory to a running Blocklet Server instance.

Option

Description

--endpoint <host>

The admin dashboard URL of the target Blocklet Server.

--access-key <key>

The access key for the target server.

--access-secret <secret>

The access secret for the target server.

--app-id <did>

The app DID to mount the blocklet to (if it's a component).

--mount-point <mountPoint>

The mount point for the component.

--incremental

Deploy only the files that have changed since the last version.

version [newVersion]#

View or update the blocklet's version number in blocklet.yml.

Option

Description

--git-commit

Create a git commit after updating the version.

-f, --force

Force the version bump.

upload [metafile]#

Upload a bundled blocklet to a blocklet store.

Option

Description

--profile <profile>

The configuration profile to use (default: default).

--access-token <accessToken>

The access token for the blocklet store.

connect <store-url>#

Configure the CLI to connect and authenticate with a specific blocklet store.

Option

Description

--profile <profile>

The configuration profile to use (default: default).

add <component>#

Add a new component dependency to your blocklet.yml file.

Option

Description

--profile <profile>

The configuration profile to use (default: default).

--store <store>

The store from which to fetch the component.

--title <title>

A custom title for the component instance.

--mount-point <mountPoint>

The mount point for the component.

remove <component>#

Remove a component dependency from your blocklet.yml file.

exec <script>#

Execute a script defined in blocklet.yml within the blocklet's running context.

Option

Description

--app-id <did>

Specify the app context for a component script.

--timeout <timeout>

The maximum time in seconds for the script to run.

test#

Set up and manage a dedicated test environment for your blocklet.

Subcommands

  • test init: Initializes a new blocklet for testing. Options include --app-sk, --owner-sk, --app-name.
  • test start: Starts the blocklet for testing. Requires --app-sk.
  • test remove: Deletes the testing blocklet completely. Requires --app-sk.
  • test reset: Resets the state of the testing blocklet. Requires --app-sk.

config#

Manage the configuration for the Blocklet CLI.

Subcommands

  • config set [key] [value]: Set a configuration value.
  • config get [key]: Get a configuration value.
  • config delete [key]: Delete a configuration value.
  • config list: List all configuration values.

meta#

Print the blocklet metadata from the blocklet.yml in the current directory.

debug <value>#

Set a debug environment variable for a blocklet.

Option

Description

--app-id <did>

The app context for which to set the debug configuration.

cleanup#

Perform cleanup tasks for a blocklet, such as clearing caches or backups.

Option

Description

--target <target>

The target to clean. Available options: cache, backup.

--app-did <did>

The specific blocklet to clean up.

document#

Manage the DID document for a blocklet.

Subcommands

  • document update <app-id>: Update the DID document for the specified blocklet.

component [command...]#

Execute commands from the Component Studio CLI. This acts as a proxy for the Component Studio's own command-line interface.