The blocklet create command is the fastest way to start a new Blocklet project. It uses create-blocklet, an interactive scaffolding tool that lets you choose from various official starter templates. This command is the recommended method for bootstrapping a new application.
Usage#
The command serves as a convenient wrapper for npx create-blocklet@latest.
blocklet create [name] [options]
Arguments#
The name for your new blocklet project. If you omit the name, the interactive setup process will prompt you for one.
How It Works#
Running blocklet create initiates an interactive command-line interface that guides you through the setup process. You will be prompted to:
- Enter a name for your blocklet (if not provided as an argument).
- Choose a starter template (e.g., React, Vue, Static, etc.).
The tool will then create a new directory with the specified name, download the template, and install the necessary dependencies.
Examples#
To start an interactive session, simply run the command without any arguments:
If you already have a name in mind, you can provide it directly:
blocklet create my-awesome-blocklet
Options#
Pre-assigns a specific Decentralized Identifier (DID) to the blocklet during creation.
A special utility mode. This flag does not create a project. Instead, it connects to your DID Wallet to generate and display a new DID suitable for a blocklet. This is useful for creating a DID in advance.
Generating a Blocklet DID Only#
If you only need to create a DID for a future blocklet without starting a new project, use the --did-only flag.
blocklet create --did-only
This command will connect to your wallet, generate a new DID with the moniker 'blocklet', and print the result to your console.
Created Blocklet DID: z2...A9
Troubleshooting#
Occasionally, issues related to npx (the Node.js package runner), such as outdated caches, can cause the create command to fail. If you encounter an error, here are a couple of workarounds.
1. Run create-blocklet Directly#
You can bypass the blocklet create wrapper and execute create-blocklet directly using npx:
npx create-blocklet@latest my-new-blocklet
2. Install Globally#
Alternatively, you can install create-blocklet globally on your system and then run it.
# Step 1: Install globally
npm install -g create-blocklet
# Step 2: Run the command
create-blocklet my-new-blocklet
After creating your project, the next step is to run it in a local development environment. For more information, proceed to the Develop Mode guide.