image-bin v0.10.77
Getting Started with Create Blocklet
This project was bootstrapped with Create Blocklet.
This blocklet is a dapp project, which means this is a full-stack application. It's contained both server and client code.
File Structure
- public/ - static files
- favicon.ico - favicon
- favicon.svg - favicon
- index.html - main html file, template for react
- screenshots/ - Screenshots
- api/ - Api side code
- hooks/ - blocklet lifecycle hooks
- libs/ - Api side libraries
- middlewares/ - Api side middlewares
- routes/ - Api side routes
- index.js - Api side entry point
- src/ - Client side code (A standard react app structure)
- .env - Environment variables
- .env.local - Local environment variables
- .eslintrc.js - ESLint configuration
- .gitignore - Git ignore file
- .prettierrc - Prettier configuration
- blocklet.md - Blocklet README
- blocklet.yml - Blocklet configuration
- LICENSE - License file
- logo.png - Blocklet logo file
- Makefile - Makefile
- package.json - Npm package file
- README.md - A guide for this blocklet
- version - Version file
Development
Make sure you have @blocklet/cli installed
Blocklet needs blocklet server as a dependency. So you need to install it first.
npm install -g @blocklet/cli
See details in https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#use-the-binary-distributionInit blocklet server & start blocklet server
Before starting an blocklet server, you need to init blocklet server.
blocklet server init --mode=debugblocklet server start
See details in https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#configure-abt-nodeGo to the project directory
cd [name]- Install dependencies:
pnpm install - Start development server:
blocklet dev
Bundle
After developing a blocklet, you may need to bundle it. Use npm run bundle command.
Deploy
- If you want to deploy this blocklet to local blocklet server, you can use
blocklet deploy .blocklet/bundlecommand(Make sure the blocklet is bundled before deployment).Or you can simply use
npm run deploycommand. If you want to deploy this blocklet to remote blocklet server, you can use the command below.
blocklet deploy .blocklet/bundle --endpoint {your blocklet server url} --access-key {blocklet server access key} --access-secret {blocklet server access secret}Make sure the blocklet is bundled before deployment.
Upload to blocklet store
If you want to upload the blocklet to any store for other users to download and use, you can following the following instructions.
Bump version at first.
make bump-versionThen config blocklet store url. You can use those store url in below.
- https://store.blocklet.dev/
- https://dev.store.blocklet.dev/
- A blocklet store started by yourself.
Make sure you have installed a
blocklet storeon your own blocklet server. Check it on here: https://store.blocklet.dev/blocklet/z8ia29UsENBg6tLZUKi2HABj38Cw1LmHZocbQ
blocklet config set store {store url}Get a
accessTokenby using this command.Why we need a
accessToken?
AaccessTokenis genrate by blocklet store, which help us upload our blocklet to any store.Set
accessTokento blocklet configblocklet config set accessToken {accessToken}Upload a new version to a store.
Make sure the blocklet is bundled before upload.
blocklet uploadOr you can simply use
npm run uploadcommand.You also can upload a new version to a store by Github CI.
Bump version at first.make bump-versionPush your code to Github main/master branch, or make a pull request to the main/master branch.
The CI workflow will automatically upload a new version to a store.
Q & A
Q: How to change a blocklet's name?
A: Change the
namefield in thepackage.jsonfile, change thenamefield in theblocklet.ymlfile.You can also change the
titlefield anddescriptionfield in theblocklet.ymlfile.Run
blocklet metacommand, you will get adidconfig, copy thedidvalue.Replace this command
"bundle:client": "PUBLIC_URL='/.blocklet/proxy/{did}' npm run build",inpackage.jsonReplace
didfield in theblocklet.ymlQ: How to change a blocklet's logo?
Change the
logo.pngfile root folder.Or you can change the
logofield in theblocklet.ymlfile.Make sure you have added the logo path to the
blocklet.ymlfilefilesfield.
Learn More
- Full specification of
blocklet.yml: https://github.com/blocklet/blocklet-specification/blob/main/docs/meta.md - Full document of Blocklet Server & blocklet development: https://docs.arcblock.io/abtnode/en/introduction
License
The code is licensed under the Apache 2.0 license found in the LICENSE file.
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago