@blocklet/cli 1.17.3 → 1.17.4-beta-20251201-225048-b1682a09
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/commands/blocklet/create.js +23 -1
- package/lib/commands/index.js +1 -0
- package/package.json +17 -17
package/README.md
CHANGED
|
@@ -1,12 +1,34 @@
|
|
|
1
1
|
const childProcess = require('child_process');
|
|
2
2
|
const chalk = require('chalk');
|
|
3
|
+
const fs = require('fs-extra');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { fromRandom } = require('@ocap/wallet');
|
|
6
|
+
const { types } = require('@ocap/mcrypto');
|
|
3
7
|
|
|
4
8
|
const { printInfo, print, printWarning, printSuccess } = require('../../util');
|
|
5
9
|
const { getConnectUrl, generateDidFromWallet } = require('./init');
|
|
10
|
+
const { ABT_NODE_HOME } = require('../../constant');
|
|
6
11
|
|
|
7
12
|
exports.run = async (name, options = {}) => {
|
|
8
|
-
const { didOnly } = options;
|
|
13
|
+
const { didOnly, random } = options;
|
|
9
14
|
if (didOnly) {
|
|
15
|
+
// Generate random DID locally without invoking DID Wallet
|
|
16
|
+
if (random) {
|
|
17
|
+
const wallet = fromRandom({ role: types.RoleType.ROLE_BLOCKLET });
|
|
18
|
+
|
|
19
|
+
// Persist wallet to ABT_NODE_HOME/blocklets/{did}.json
|
|
20
|
+
const blockletWalletsDir = path.join(ABT_NODE_HOME, 'blocklets');
|
|
21
|
+
fs.ensureDirSync(blockletWalletsDir);
|
|
22
|
+
|
|
23
|
+
const walletFilePath = path.join(blockletWalletsDir, `${wallet.address}.json`);
|
|
24
|
+
fs.writeFileSync(walletFilePath, JSON.stringify(wallet.toJSON(), null, 2));
|
|
25
|
+
|
|
26
|
+
printSuccess(`Created Blocklet DID: ${chalk.cyan(wallet.address)}`);
|
|
27
|
+
printInfo(`Wallet saved to: ${chalk.cyan(walletFilePath)}`);
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Use DID Wallet to generate DID (existing behavior)
|
|
10
32
|
const connectUrl = await getConnectUrl();
|
|
11
33
|
const didList = await generateDidFromWallet(connectUrl, { verbose: false, monikers: 'blocklet' });
|
|
12
34
|
printSuccess(`Created Blocklet DID: ${chalk.cyan(didList.join(','))}`);
|
package/lib/commands/index.js
CHANGED
|
@@ -268,6 +268,7 @@ program
|
|
|
268
268
|
.command('create [name]')
|
|
269
269
|
.option('--did <did>', 'Specify a blocklet did')
|
|
270
270
|
.option('--did-only', 'Only create a blocklet did, do not create a blocklet project')
|
|
271
|
+
.option('--random', 'Generate a random DID locally without invoking DID Wallet (requires --did-only)')
|
|
271
272
|
.description('Bootstrap a brand new blocklet from various starter templates within minutes')
|
|
272
273
|
.action(parseArgsAndOptions(create.run));
|
|
273
274
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/cli",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.4-beta-20251201-225048-b1682a09",
|
|
4
4
|
"description": "Command line tools to manage Blocklet Server",
|
|
5
5
|
"homepage": "https://www.arcblock.io/docs/blocklet-cli",
|
|
6
6
|
"bin": {
|
|
@@ -33,28 +33,28 @@
|
|
|
33
33
|
"url": "https://github.com/ArcBlock/blocklet-server/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@abtnode/blocklet-services": "1.17.
|
|
37
|
-
"@abtnode/constant": "1.17.
|
|
38
|
-
"@abtnode/core": "1.17.
|
|
39
|
-
"@abtnode/db-cache": "1.17.
|
|
40
|
-
"@abtnode/logger": "1.17.
|
|
41
|
-
"@abtnode/models": "1.17.
|
|
42
|
-
"@abtnode/router-provider": "1.17.
|
|
43
|
-
"@abtnode/util": "1.17.
|
|
44
|
-
"@abtnode/webapp": "1.17.
|
|
36
|
+
"@abtnode/blocklet-services": "1.17.4-beta-20251201-225048-b1682a09",
|
|
37
|
+
"@abtnode/constant": "1.17.4-beta-20251201-225048-b1682a09",
|
|
38
|
+
"@abtnode/core": "1.17.4-beta-20251201-225048-b1682a09",
|
|
39
|
+
"@abtnode/db-cache": "1.17.4-beta-20251201-225048-b1682a09",
|
|
40
|
+
"@abtnode/logger": "1.17.4-beta-20251201-225048-b1682a09",
|
|
41
|
+
"@abtnode/models": "1.17.4-beta-20251201-225048-b1682a09",
|
|
42
|
+
"@abtnode/router-provider": "1.17.4-beta-20251201-225048-b1682a09",
|
|
43
|
+
"@abtnode/util": "1.17.4-beta-20251201-225048-b1682a09",
|
|
44
|
+
"@abtnode/webapp": "1.17.4-beta-20251201-225048-b1682a09",
|
|
45
45
|
"@arcblock/did": "^1.27.12",
|
|
46
46
|
"@arcblock/event-hub": "^1.27.12",
|
|
47
47
|
"@arcblock/ipfs-only-hash": "^0.0.2",
|
|
48
48
|
"@arcblock/jwt": "^1.27.12",
|
|
49
49
|
"@arcblock/ws": "^1.27.12",
|
|
50
|
-
"@blocklet/constant": "1.17.
|
|
50
|
+
"@blocklet/constant": "1.17.4-beta-20251201-225048-b1682a09",
|
|
51
51
|
"@blocklet/error": "^0.3.3",
|
|
52
52
|
"@blocklet/form-collector": "^0.1.8",
|
|
53
|
-
"@blocklet/images": "1.17.
|
|
54
|
-
"@blocklet/meta": "1.17.
|
|
55
|
-
"@blocklet/resolver": "1.17.
|
|
56
|
-
"@blocklet/server-js": "1.17.
|
|
57
|
-
"@blocklet/store": "1.17.
|
|
53
|
+
"@blocklet/images": "1.17.4-beta-20251201-225048-b1682a09",
|
|
54
|
+
"@blocklet/meta": "1.17.4-beta-20251201-225048-b1682a09",
|
|
55
|
+
"@blocklet/resolver": "1.17.4-beta-20251201-225048-b1682a09",
|
|
56
|
+
"@blocklet/server-js": "1.17.4-beta-20251201-225048-b1682a09",
|
|
57
|
+
"@blocklet/store": "1.17.4-beta-20251201-225048-b1682a09",
|
|
58
58
|
"@blocklet/theme-builder": "^0.4.8",
|
|
59
59
|
"@ocap/client": "^1.27.12",
|
|
60
60
|
"@ocap/mcrypto": "^1.27.12",
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"engines": {
|
|
154
154
|
"node": ">=14"
|
|
155
155
|
},
|
|
156
|
-
"gitHead": "
|
|
156
|
+
"gitHead": "150c52d552b8b2d8c3a5bae57818aabf90dfd115",
|
|
157
157
|
"devDependencies": {
|
|
158
158
|
"@types/fs-extra": "^11.0.4"
|
|
159
159
|
}
|