Skip to content

Commit

Permalink
fix(create-blocklet): fix error blocklet-did generate (#363)
Browse files Browse the repository at this point in the history
  • Loading branch information
LancelotLewis authored Sep 26, 2024
1 parent cc73435 commit 2dcccbb
Show file tree
Hide file tree
Showing 26 changed files with 58 additions and 154 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 0.9.8 (2024-9-27)

- chore(deps): update deps
- chore(create-blocklet): update did-connect-dapp readme
- chore(create-blocklet): connect-to-store-url should not use spinner style
- fix(create-blocklet): `blocklet init` exit(1) should break create-flow

## 0.9.7 (2024-9-26)

- chore(create-blocklet): update templates deps
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "create-blocklet",
"private": true,
"version": "0.9.7",
"version": "0.9.8",
"description": "",
"keywords": [],
"author": "",
Expand Down
15 changes: 10 additions & 5 deletions packages/create-app/lib/did.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/prefer-default-export */
import ora from 'ora';
import Mcrypto from '@ocap/mcrypto';
import * as jdenticon from 'jdenticon';
Expand Down Expand Up @@ -37,7 +36,8 @@ export async function getBlockletDidList(monikerList = [], connectUrl = '') {
childProcess.stdout.on('data', (data) => {
const message = data.toString('utf8') || '';
if (message.includes('gen-key-pair') && message.includes('__connect_url__')) {
spinner.text = message.replace('✔ \n', '');
spinner.text = 'Waiting for DID Connect to generate a Blocklet DID';
console.log(message.replace('✔ \n', ''));
} else {
lastMessage = message;
}
Expand All @@ -48,9 +48,14 @@ export async function getBlockletDidList(monikerList = [], connectUrl = '') {
spinner.fail(message);
}
});
childProcess.on('close', () => {
spinner.succeed();
resolve(lastMessage);
childProcess.on('close', (exitCode) => {
if (exitCode !== 0) {
spinner.fail();
reject(new Error('Failed to connect store'));
} else {
spinner.succeed();
resolve(lastMessage);
}
});
childProcess.on('error', (err) => {
spinner.fail();
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-blocklet",
"version": "0.9.7",
"version": "0.9.8",
"exports": "./index.js",
"type": "module",
"repository": "[email protected]:blocklet/create-blocklet.git",
Expand Down
112 changes: 2 additions & 110 deletions packages/create-app/templates/did-connect-dapp/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Getting Started with Create Blocklet
# PROJECT_DESCRIPTION

This project was bootstrapped with [Create Blocklet](https://github.com/blocklet/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
## FILE_STRUCTURE

- public/ - static files
- favicon.ico - favicon
Expand Down Expand Up @@ -33,111 +33,3 @@ This blocklet is a dapp project, which means this is a full-stack application. I
- package.json - Npm package file
- README.md - A guide for this blocklet
- version - Version file

## Development

1. Make sure you have [@blocklet/cli](https://www.npmjs.com/package/@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://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli](https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli)

2. Init blocklet server & start blocklet server

Before starting an blocklet server, you need to init blocklet server.
`blocklet server init --mode=debug`
`blocklet server start`
See details in [https://www.arcblock.io/docs/blocklet-developer/getting-started](https://www.arcblock.io/docs/blocklet-developer/getting-started)

3. Go to the project directory `cd [name]`
4. Install dependencies: `npm install` or `yarn` or `pnpm install`
5. 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/bundle` command(Make sure the blocklet is bundled before deployment).
> Or you can simply use `npm run deploy` command.
- If you want to deploy this blocklet to remote blocklet server, you can use the command below.

```shell
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.

```shell
npm run bump-version
```

Then config blocklet store url.
You can use those store url in below.

1. [https://store.blocklet.dev/](https://store.blocklet.dev/)
2. [https://dev.store.blocklet.dev/](https://dev.store.blocklet.dev/)
3. A blocklet store started by yourself.
> Make sure you have installed a `blocklet store` on your own blocklet server. Check it on here: [https://store.blocklet.dev/blocklet/z8ia29UsENBg6tLZUKi2HABj38Cw1LmHZocbQ](https://store.blocklet.dev/blocklet/z8ia29UsENBg6tLZUKi2HABj38Cw1LmHZocbQ)
```shell
blocklet config set store {store url}
```

Get a `accessToken` by using this command.

> Why we need a `accessToken`?
> A `accessToken` is genrate by blocklet store, which help us upload our blocklet to any store.
Set `accessToken` to blocklet config

```shell
blocklet config set accessToken {accessToken}
```

Upload a new version to a store.

> Make sure the blocklet is bundled before upload.
```shell
blocklet upload
```

Or you can simply use `npm run upload` command.

- You also can upload a new version to a store by Github CI.
Bump version at first.

```shell
npm run bump-version
```

Push 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

1. Q: How to change a blocklet's logo?

Change the `logo.png` file root folder.

Or you can change the `logo` field in the `blocklet.yml` file.

> Make sure you have added the logo path to the `blocklet.yml` file `files` field.
## Learn More

- Full specification of `blocklet.yml`: [https://github.com/blocklet/blocklet-specification/blob/main/docs/meta.md](https://github.com/blocklet/blocklet-specification/blob/main/docs/meta.md)
- Full document of Blocklet Server & blocklet development: [https://www.arcblock.io/docs/blocklet-developer](https://www.arcblock.io/docs/blocklet-developer)

## License

The code is licensed under the Apache 2.0 license found in the
[LICENSE](LICENSE) file.
8 changes: 4 additions & 4 deletions packages/create-app/templates/did-connect-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
"lodash": "^4.17.21"
},
"devDependencies": {
"@arcblock/did-connect": "^2.10.37",
"@arcblock/did-connect": "^2.10.38",
"@arcblock/eslint-config": "^0.3.2",
"@arcblock/ux": "^2.10.37",
"@blocklet/ui-react": "^2.10.37",
"@arcblock/ux": "^2.10.38",
"@blocklet/ui-react": "^2.10.38",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@iconify-icons/material-symbols": "^1.2.58",
Expand All @@ -76,7 +76,7 @@
"react-dom": "~18.2.0",
"rimraf": "^5.0.10",
"vite": "^5.4.8",
"vite-plugin-blocklet": "^0.9.7",
"vite-plugin-blocklet": "^0.9.8",
"vite-plugin-svgr": "^4.2.0",
"zx": "^8.1.8"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/create-app/templates/did-wallet-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
"morgan": "^1.10.0"
},
"devDependencies": {
"@arcblock/did-connect": "^2.10.37",
"@arcblock/did-connect": "^2.10.38",
"@arcblock/eslint-config": "^0.3.2",
"@arcblock/ux": "^2.10.37",
"@arcblock/ux": "^2.10.38",
"@blocklet/js-sdk": "^1.16.31",
"@blocklet/ui-react": "^2.10.37",
"@blocklet/ui-react": "^2.10.38",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@mui/icons-material": "^5.16.7",
Expand All @@ -52,7 +52,7 @@
"simple-git-hooks": "^2.11.1",
"vite": "^5.4.8",
"vite-node": "^2.1.1",
"vite-plugin-blocklet": "^0.9.7",
"vite-plugin-blocklet": "^0.9.8",
"vite-plugin-require": "^1.2.14",
"vite-plugin-svgr": "^4.2.0",
"zx": "^8.1.8"
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/react-dapp-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"vite": "^5.4.8",
"vite-plugin-blocklet": "^0.9.7",
"vite-plugin-blocklet": "^0.9.8",
"vite-plugin-svgr": "^4.2.0",
"zx": "^8.1.8"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/react-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"rimraf": "^5.0.10",
"simple-git-hooks": "^2.11.1",
"vite": "^5.4.8",
"vite-plugin-blocklet": "^0.9.7",
"vite-plugin-blocklet": "^0.9.8",
"vite-plugin-svgr": "^4.2.0",
"zx": "^8.1.8"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/react-gun-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"rimraf": "^5.0.10",
"simple-git-hooks": "^2.11.1",
"vite": "^5.4.8",
"vite-plugin-blocklet": "^0.9.7",
"vite-plugin-blocklet": "^0.9.8",
"vite-plugin-svgr": "^4.2.0",
"zx": "^8.1.8"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/react-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"rimraf": "^5.0.10",
"simple-git-hooks": "^2.11.1",
"vite": "^5.4.8",
"vite-plugin-blocklet": "^0.9.7",
"vite-plugin-blocklet": "^0.9.8",
"vite-plugin-svgr": "^4.2.0",
"zx": "^8.1.8"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/solidjs-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"rimraf": "^5.0.10",
"simple-git-hooks": "^2.11.1",
"vite": "^5.4.8",
"vite-plugin-blocklet": "^0.9.7",
"vite-plugin-blocklet": "^0.9.8",
"vite-plugin-solid": "^2.10.2",
"zx": "^8.1.8"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/templates/solidjs-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"simple-git-hooks": "^2.11.1",
"solid-js": "^1.9.1",
"vite": "^5.4.8",
"vite-plugin-blocklet": "^0.9.7",
"vite-plugin-blocklet": "^0.9.8",
"vite-plugin-solid": "^2.10.2",
"zx": "^8.1.8"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/create-app/templates/svelte-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
"lint-staged": "^15.2.10",
"npm-run-all": "^4.1.5",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.6",
"prettier-plugin-svelte": "^3.2.7",
"rimraf": "^5.0.10",
"simple-git-hooks": "^2.11.1",
"svelte": "^4.2.19",
"vite": "^5.4.8",
"vite-plugin-blocklet": "^0.9.7",
"vite-plugin-blocklet": "^0.9.8",
"zx": "^8.1.8"
},
"lint-staged": {
Expand Down
4 changes: 2 additions & 2 deletions packages/create-app/templates/svelte-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
"bumpp": "^9.5.2",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"prettier-plugin-svelte": "^3.2.6",
"prettier-plugin-svelte": "^3.2.7",
"rimraf": "^5.0.10",
"simple-git-hooks": "^2.11.1",
"svelte": "^4.2.19",
"vite": "^5.4.8",
"vite-plugin-blocklet": "^0.9.7",
"vite-plugin-blocklet": "^0.9.8",
"zx": "^8.1.8"
},
"lint-staged": {
Expand Down
12 changes: 6 additions & 6 deletions packages/create-app/templates/todo-list-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"@arcblock/did-auth": "^1.18.135",
"@arcblock/did-auth-storage-nedb": "^1.7.1",
"@blocklet/sdk": "^1.16.31",
"@did-space/client": "^0.5.44",
"@did-space/core": "^0.5.44",
"@did-space/client": "^0.5.45",
"@did-space/core": "^0.5.45",
"@ocap/client": "^1.18.135",
"@ocap/mcrypto": "^1.18.135",
"@ocap/wallet": "^1.18.135",
Expand All @@ -56,12 +56,12 @@
"nanoid": "^5.0.7"
},
"devDependencies": {
"@arcblock/did-connect": "^2.10.37",
"@arcblock/did-connect": "^2.10.38",
"@arcblock/eslint-config": "^0.3.2",
"@arcblock/eslint-config-ts": "^0.3.2",
"@arcblock/ux": "^2.10.37",
"@arcblock/ux": "^2.10.38",
"@blocklet/js-sdk": "^1.16.31",
"@blocklet/ui-react": "^2.10.37",
"@blocklet/ui-react": "^2.10.38",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@mui/icons-material": "^5.16.7",
Expand Down Expand Up @@ -96,7 +96,7 @@
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"vite": "^5.4.8",
"vite-plugin-blocklet": "^0.9.7",
"vite-plugin-blocklet": "^0.9.8",
"vite-plugin-svgr": "^4.2.0",
"zx": "^8.1.8"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/create-app/templates/vue-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"rimraf": "^5.0.10",
"simple-git-hooks": "^2.11.1",
"vite": "^5.4.8",
"vite-plugin-blocklet": "^0.9.7",
"vue": "^3.5.8",
"vite-plugin-blocklet": "^0.9.8",
"vue": "^3.5.9",
"zx": "^8.1.8"
},
"lint-staged": {
Expand Down
4 changes: 2 additions & 2 deletions packages/create-app/templates/vue-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"rimraf": "^5.0.10",
"simple-git-hooks": "^2.11.1",
"vite": "^5.4.8",
"vite-plugin-blocklet": "^0.9.7",
"vue": "^3.5.8",
"vite-plugin-blocklet": "^0.9.8",
"vue": "^3.5.9",
"zx": "^8.1.8"
},
"lint-staged": {
Expand Down
4 changes: 2 additions & 2 deletions packages/create-app/templates/vue-ts-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"up:deps": "taze major -I"
},
"dependencies": {
"vue": "^3.5.8"
"vue": "^3.5.9"
},
"devDependencies": {
"@antfu/eslint-config": "^2.27.3",
Expand All @@ -39,7 +39,7 @@
"taze": "^0.16.9",
"typescript": "^5.6.2",
"vite": "^5.4.8",
"vite-plugin-blocklet": "^0.9.7",
"vite-plugin-blocklet": "^0.9.8",
"vue-tsc": "^2.1.6",
"zx": "^8.1.8"
},
Expand Down
Loading

0 comments on commit 2dcccbb

Please sign in to comment.