@blocklet/cli 1.16.45-beta-20250609-082716-b6b0592b → 1.16.45-beta-20250610-112229-2eb0face
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/lib/commands/index.js +0 -10
- package/lib/commands/server/stop.js +24 -1
- package/lib/node.js +4 -0
- package/package.json +16 -16
package/lib/commands/index.js
CHANGED
|
@@ -22,7 +22,6 @@ require('please-upgrade-node')(require('../../package.json'));
|
|
|
22
22
|
|
|
23
23
|
const { Command } = require('commander');
|
|
24
24
|
const last = require('lodash/last');
|
|
25
|
-
const path = require('path');
|
|
26
25
|
|
|
27
26
|
const { PROCESS_NAME_UPDATER, PROCESS_NAME_SERVICE, PROCESS_NAME_EVENT_HUB } = require('@abtnode/constant');
|
|
28
27
|
const debug = require('debug')('@blocklet/cli:blocklet');
|
|
@@ -55,7 +54,6 @@ const cleanup = require('./blocklet/cleanup');
|
|
|
55
54
|
const document = require('./blocklet/document');
|
|
56
55
|
const component = require('./blocklet/component');
|
|
57
56
|
const ServerCommand = require('./server/command');
|
|
58
|
-
const { getNode } = require('../node');
|
|
59
57
|
|
|
60
58
|
const program = new Command();
|
|
61
59
|
|
|
@@ -101,10 +99,6 @@ const parseOptions =
|
|
|
101
99
|
(handler) =>
|
|
102
100
|
async (...args) => {
|
|
103
101
|
const allOptions = getOptions(...args);
|
|
104
|
-
const { node } = await getNode({ dir: process.cwd() });
|
|
105
|
-
if (!process.env.ABT_NODE_CACHE_SQLITE_PATH) {
|
|
106
|
-
process.env.ABT_NODE_CACHE_SQLITE_PATH = path.join(node.dataDirs.core, 'db-cache.db');
|
|
107
|
-
}
|
|
108
102
|
await handler(allOptions);
|
|
109
103
|
};
|
|
110
104
|
|
|
@@ -118,10 +112,6 @@ const parseArgsAndOptions =
|
|
|
118
112
|
const options = last(args);
|
|
119
113
|
const allOptions = { ...commonOptions, ...options };
|
|
120
114
|
debug('parse options', allOptions);
|
|
121
|
-
const { node } = await getNode({ dir: process.cwd() });
|
|
122
|
-
if (!process.env.ABT_NODE_CACHE_SQLITE_PATH) {
|
|
123
|
-
process.env.ABT_NODE_CACHE_SQLITE_PATH = path.join(node.dataDirs.core, 'db-cache.db');
|
|
124
|
-
}
|
|
125
115
|
await handler(...args.slice(0, args.length - 1), allOptions);
|
|
126
116
|
};
|
|
127
117
|
|
|
@@ -5,6 +5,7 @@ const { clearRouterByConfigKeyword, clearDockerContainer, checkDockerInstalled }
|
|
|
5
5
|
const tryWithTimeout = require('@abtnode/util/lib/try-with-timeout');
|
|
6
6
|
const sleep = require('@abtnode/util/lib/sleep');
|
|
7
7
|
const pm2 = require('@abtnode/util/lib/async-pm2');
|
|
8
|
+
const pAll = require('p-all');
|
|
8
9
|
|
|
9
10
|
const {
|
|
10
11
|
PROCESS_NAME_DAEMON,
|
|
@@ -47,8 +48,24 @@ const forceStopServer = async () => {
|
|
|
47
48
|
printSuccess(`${capitalize(clearedProvider)} router is stopped successfully`);
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
// Kill all blocklet processes
|
|
52
|
+
try {
|
|
53
|
+
const list = await pm2.listAsync();
|
|
54
|
+
const blockletProcesses = list.filter(
|
|
55
|
+
(process) => !!process.pm2_env['abt-node-daemon'] || !!process.pm2_env.blocklet
|
|
56
|
+
);
|
|
57
|
+
await pAll(
|
|
58
|
+
blockletProcesses.map((process) => () => pm2.deleteAsync(process.name)),
|
|
59
|
+
{ concurrency: 6 }
|
|
60
|
+
);
|
|
61
|
+
printSuccess('All blocklet processes stopped successfully');
|
|
62
|
+
} catch (error) {
|
|
63
|
+
printError(`Failed to stop blocklet processes: ${error.message}`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Kill PM2 daemon last
|
|
50
67
|
await pm2.killDaemonAsync();
|
|
51
|
-
|
|
68
|
+
|
|
52
69
|
const isDockerInstalled = await checkDockerInstalled();
|
|
53
70
|
if (isDockerInstalled) {
|
|
54
71
|
await clearDockerContainer();
|
|
@@ -164,6 +181,12 @@ exports.run = async ({ force = false }) => {
|
|
|
164
181
|
}
|
|
165
182
|
}
|
|
166
183
|
|
|
184
|
+
const isDockerInstalled = await checkDockerInstalled();
|
|
185
|
+
if (isDockerInstalled) {
|
|
186
|
+
await clearDockerContainer();
|
|
187
|
+
printSuccess('Docker containers managed by blocklet server are stopped');
|
|
188
|
+
}
|
|
189
|
+
|
|
167
190
|
printSuccess('Done!');
|
|
168
191
|
resolve(true);
|
|
169
192
|
process.exit(0);
|
package/lib/node.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const chalk = require('chalk');
|
|
3
3
|
const yaml = require('js-yaml');
|
|
4
|
+
const path = require('path');
|
|
4
5
|
const ABTNode = require('@abtnode/core');
|
|
5
6
|
const security = require('@abtnode/util/lib/security');
|
|
6
7
|
const { WsClient } = require('@arcblock/ws');
|
|
@@ -95,6 +96,9 @@ const readNodeConfigWithValidate = async (dir) => {
|
|
|
95
96
|
|
|
96
97
|
async function getNode({ dir = process.cwd() } = {}) {
|
|
97
98
|
const { config, configFile, dataDir } = await readNodeConfigWithValidate(dir);
|
|
99
|
+
if (!process.env.ABT_NODE_CACHE_SQLITE_PATH) {
|
|
100
|
+
process.env.ABT_NODE_CACHE_SQLITE_PATH = path.join(dataDir, 'core', 'db-cache.db');
|
|
101
|
+
}
|
|
98
102
|
|
|
99
103
|
util.ensurePermission(dataDir);
|
|
100
104
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/cli",
|
|
3
|
-
"version": "1.16.45-beta-
|
|
3
|
+
"version": "1.16.45-beta-20250610-112229-2eb0face",
|
|
4
4
|
"description": "Command line tools to manage Blocklet Server",
|
|
5
5
|
"homepage": "https://github.com/ArcBlock/blocklet-server#readme",
|
|
6
6
|
"bin": {
|
|
@@ -35,27 +35,27 @@
|
|
|
35
35
|
"url": "https://github.com/ArcBlock/blocklet-server/issues"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@abtnode/blocklet-services": "1.16.45-beta-
|
|
39
|
-
"@abtnode/client": "1.16.45-beta-
|
|
40
|
-
"@abtnode/constant": "1.16.45-beta-
|
|
41
|
-
"@abtnode/core": "1.16.45-beta-
|
|
42
|
-
"@abtnode/db-cache": "1.16.45-beta-
|
|
43
|
-
"@abtnode/logger": "1.16.45-beta-
|
|
44
|
-
"@abtnode/router-provider": "1.16.45-beta-
|
|
45
|
-
"@abtnode/util": "1.16.45-beta-
|
|
46
|
-
"@abtnode/webapp": "1.16.45-beta-
|
|
38
|
+
"@abtnode/blocklet-services": "1.16.45-beta-20250610-112229-2eb0face",
|
|
39
|
+
"@abtnode/client": "1.16.45-beta-20250610-112229-2eb0face",
|
|
40
|
+
"@abtnode/constant": "1.16.45-beta-20250610-112229-2eb0face",
|
|
41
|
+
"@abtnode/core": "1.16.45-beta-20250610-112229-2eb0face",
|
|
42
|
+
"@abtnode/db-cache": "1.16.45-beta-20250610-112229-2eb0face",
|
|
43
|
+
"@abtnode/logger": "1.16.45-beta-20250610-112229-2eb0face",
|
|
44
|
+
"@abtnode/router-provider": "1.16.45-beta-20250610-112229-2eb0face",
|
|
45
|
+
"@abtnode/util": "1.16.45-beta-20250610-112229-2eb0face",
|
|
46
|
+
"@abtnode/webapp": "1.16.45-beta-20250610-112229-2eb0face",
|
|
47
47
|
"@arcblock/did": "1.20.14",
|
|
48
48
|
"@arcblock/event-hub": "1.20.14",
|
|
49
49
|
"@arcblock/ipfs-only-hash": "^0.0.2",
|
|
50
50
|
"@arcblock/jwt": "1.20.14",
|
|
51
51
|
"@arcblock/ws": "1.20.14",
|
|
52
|
-
"@blocklet/constant": "1.16.45-beta-
|
|
52
|
+
"@blocklet/constant": "1.16.45-beta-20250610-112229-2eb0face",
|
|
53
53
|
"@blocklet/error": "^0.2.5",
|
|
54
54
|
"@blocklet/form-collector": "^0.1.8",
|
|
55
|
-
"@blocklet/images": "1.16.45-beta-
|
|
56
|
-
"@blocklet/meta": "1.16.45-beta-
|
|
57
|
-
"@blocklet/resolver": "1.16.45-beta-
|
|
58
|
-
"@blocklet/store": "1.16.45-beta-
|
|
55
|
+
"@blocklet/images": "1.16.45-beta-20250610-112229-2eb0face",
|
|
56
|
+
"@blocklet/meta": "1.16.45-beta-20250610-112229-2eb0face",
|
|
57
|
+
"@blocklet/resolver": "1.16.45-beta-20250610-112229-2eb0face",
|
|
58
|
+
"@blocklet/store": "1.16.45-beta-20250610-112229-2eb0face",
|
|
59
59
|
"@blocklet/theme-builder": "^0.1.19",
|
|
60
60
|
"@ocap/client": "1.20.14",
|
|
61
61
|
"@ocap/mcrypto": "1.20.14",
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"engines": {
|
|
155
155
|
"node": ">=14"
|
|
156
156
|
},
|
|
157
|
-
"gitHead": "
|
|
157
|
+
"gitHead": "d35fb6c907c29f4466fa965c079e1662dc77e582",
|
|
158
158
|
"devDependencies": {
|
|
159
159
|
"@types/fs-extra": "^11.0.4",
|
|
160
160
|
"@types/jest": "^29.5.13"
|