@abtnode/core 1.16.24-beta-c8847287 → 1.16.24-beta-08e03567
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/blocklet/downloader/resolve-download.js +5 -0
- package/lib/blocklet/manager/disk.js +10 -10
- package/lib/blocklet/manager/helper/install-component-from-url.js +1 -1
- package/lib/blocklet/manager/helper/upgrade-components.js +1 -1
- package/lib/event/index.js +1 -1
- package/lib/util/blocklet.js +0 -4
- package/lib/util/install-external-dependencies.js +18 -7
- package/package.json +21 -21
|
@@ -9,6 +9,7 @@ const defaultLogger = require('@abtnode/logger')('@abtnode/core:resolve-download
|
|
|
9
9
|
const { getBlockletMeta } = require('../../util');
|
|
10
10
|
|
|
11
11
|
const { ensureBlockletExpanded, expandTarball, getBundleDir } = require('../../util/blocklet');
|
|
12
|
+
const { installExternalDependencies } = require('../../util/install-external-dependencies');
|
|
12
13
|
|
|
13
14
|
const asyncFs = fs.promises;
|
|
14
15
|
|
|
@@ -76,6 +77,8 @@ const resolveDownload = async (tarFile, dist, { removeTarFile = true, logger = d
|
|
|
76
77
|
fs.mkdirSync(installDir, { recursive: true });
|
|
77
78
|
|
|
78
79
|
await fs.move(downloadDir, installDir, { overwrite: true });
|
|
80
|
+
|
|
81
|
+
installExternalDependencies(installDir);
|
|
79
82
|
} catch (error) {
|
|
80
83
|
fs.removeSync(downloadDir);
|
|
81
84
|
fs.removeSync(tmp);
|
|
@@ -142,6 +145,8 @@ const resolveDiffDownload = async (
|
|
|
142
145
|
logger.info('Move downloadDir to installDir', { downloadDir, bundleDir });
|
|
143
146
|
await fs.move(downloadDir, bundleDir, { overwrite: true });
|
|
144
147
|
|
|
148
|
+
installExternalDependencies(bundleDir);
|
|
149
|
+
|
|
145
150
|
return { meta, installDir: bundleDir };
|
|
146
151
|
} catch (error) {
|
|
147
152
|
fs.removeSync(downloadDir);
|
|
@@ -745,7 +745,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
745
745
|
blocklet1.meta.title
|
|
746
746
|
}: ${error.message}`;
|
|
747
747
|
this._createNotification(did, {
|
|
748
|
-
title: '',
|
|
748
|
+
title: 'Component start failed',
|
|
749
749
|
description,
|
|
750
750
|
entityType: 'blocklet',
|
|
751
751
|
entityId: did,
|
|
@@ -827,7 +827,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
827
827
|
this.configSynchronizer.throttledSyncAppConfig(blocklet.meta.did);
|
|
828
828
|
|
|
829
829
|
this._createNotification(did, {
|
|
830
|
-
title: '',
|
|
830
|
+
title: 'Component stop succeed',
|
|
831
831
|
description: `${
|
|
832
832
|
componentDids?.length ? getComponentNamesWithVersion(blocklet, componentDids) : 'All components'
|
|
833
833
|
} is successfully stopped for ${blocklet.meta.title}.`,
|
|
@@ -925,7 +925,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
925
925
|
result.meta.title
|
|
926
926
|
}: ${err.message || 'queue exception'}`;
|
|
927
927
|
this._createNotification(did, {
|
|
928
|
-
title: '',
|
|
928
|
+
title: 'Component restart failed',
|
|
929
929
|
description,
|
|
930
930
|
entityType: 'blocklet',
|
|
931
931
|
entityId: did,
|
|
@@ -1140,7 +1140,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
1140
1140
|
this.emit(BlockletEvents.upgraded, { blocklet: newBlocklet, context: { ...context, createAuditLog: false } }); // trigger router refresh
|
|
1141
1141
|
|
|
1142
1142
|
this._createNotification(newBlocklet.meta.did, {
|
|
1143
|
-
title: '',
|
|
1143
|
+
title: 'Component delete succeed',
|
|
1144
1144
|
description: `${child.meta.title} is successfully deleted for ${newBlocklet.meta.title}.`,
|
|
1145
1145
|
entityType: 'blocklet',
|
|
1146
1146
|
entityId: newBlocklet.meta.did,
|
|
@@ -2375,7 +2375,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
2375
2375
|
},
|
|
2376
2376
|
});
|
|
2377
2377
|
this._createNotification(did, {
|
|
2378
|
-
title: '',
|
|
2378
|
+
title: 'Component download failed',
|
|
2379
2379
|
description: `${childrenToDownload
|
|
2380
2380
|
.map((x) => `${x.meta.title}@${x.meta.version}`)
|
|
2381
2381
|
.join(', ')} download failed for ${title}: ${err.message}`,
|
|
@@ -2539,7 +2539,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
2539
2539
|
? `${getComponentNamesWithVersion(blocklet, componentDids)} is successfully started for ${blocklet.meta.title}.`
|
|
2540
2540
|
: `${blocklet.meta.title} is successfully started`;
|
|
2541
2541
|
this._createNotification(did, {
|
|
2542
|
-
title: '',
|
|
2542
|
+
title: 'Component start succeed',
|
|
2543
2543
|
description,
|
|
2544
2544
|
entityType: 'blocklet',
|
|
2545
2545
|
entityId: did,
|
|
@@ -2565,7 +2565,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
2565
2565
|
: `${blocklet.meta.title} start failed: ${error.message}`;
|
|
2566
2566
|
|
|
2567
2567
|
this._createNotification(did, {
|
|
2568
|
-
title: '',
|
|
2568
|
+
title: 'Component start failed',
|
|
2569
2569
|
description,
|
|
2570
2570
|
entityType: 'blocklet',
|
|
2571
2571
|
entityId: did,
|
|
@@ -2887,7 +2887,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
2887
2887
|
users,
|
|
2888
2888
|
}) {
|
|
2889
2889
|
this._createNotification(did, {
|
|
2890
|
-
title:
|
|
2890
|
+
title: title.en,
|
|
2891
2891
|
description: description.en,
|
|
2892
2892
|
entityType: 'blocklet',
|
|
2893
2893
|
entityId: did,
|
|
@@ -3466,7 +3466,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
3466
3466
|
this.emit(notificationEvent, { ...blocklet, componentDids, context });
|
|
3467
3467
|
|
|
3468
3468
|
this._createNotification(did, {
|
|
3469
|
-
title:
|
|
3469
|
+
title: `Component ${actionName} succeed`,
|
|
3470
3470
|
description: `${getComponentNamesWithVersion(
|
|
3471
3471
|
newBlocklet,
|
|
3472
3472
|
componentDids
|
|
@@ -3522,7 +3522,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
3522
3522
|
});
|
|
3523
3523
|
|
|
3524
3524
|
this._createNotification(did, {
|
|
3525
|
-
title:
|
|
3525
|
+
title: `Component ${actionName} failed`,
|
|
3526
3526
|
description: `${getComponentNamesWithVersion(newBlocklet, componentDids)} ${actionName} failed for ${title}: ${
|
|
3527
3527
|
err.message
|
|
3528
3528
|
}.`,
|
|
@@ -196,7 +196,7 @@ const installComponentFromUrl = async ({
|
|
|
196
196
|
});
|
|
197
197
|
|
|
198
198
|
manager._createNotification(rootDid, {
|
|
199
|
-
title:
|
|
199
|
+
title: `Component ${actionName} failed`,
|
|
200
200
|
description: `${getComponentNamesWithVersion(newBlocklet, componentDids)} ${actionName} failed for ${
|
|
201
201
|
newBlocklet.meta.title
|
|
202
202
|
}: ${err.message || 'queue exception'}.`,
|
|
@@ -151,7 +151,7 @@ const upgrade = async ({ updateId, componentDids, context, states, manager }) =>
|
|
|
151
151
|
});
|
|
152
152
|
|
|
153
153
|
manager._createNotification(did, {
|
|
154
|
-
title: '',
|
|
154
|
+
title: 'Component upgrade failed',
|
|
155
155
|
description: `${getComponentNamesWithVersion(oldBlocklet, componentDids)} upgrade failed for ${
|
|
156
156
|
oldBlocklet.meta.title
|
|
157
157
|
}: ${err.message || 'queue exception'}.`,
|
package/lib/event/index.js
CHANGED
|
@@ -67,7 +67,7 @@ module.exports = ({
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
// Listen events from eventHub and call eventHandler
|
|
70
|
-
[...Object.values(BlockletEvents), ...Object.values(EVENTS)].forEach((name) => {
|
|
70
|
+
[...Object.values(BlockletEvents), ...Object.values(TeamEvents), ...Object.values(EVENTS)].forEach((name) => {
|
|
71
71
|
eventHub.on(name, (data) => {
|
|
72
72
|
if (name === BlockletEvents.removed) {
|
|
73
73
|
// Cleanup cache in teamManager for every node instance
|
package/lib/util/blocklet.js
CHANGED
|
@@ -106,7 +106,6 @@ const { validate: validateEngine, get: getEngine } = require('../blocklet/manage
|
|
|
106
106
|
const isRequirementsSatisfied = require('./requirement');
|
|
107
107
|
const { getDidDomainForBlocklet } = require('./get-domain-for-blocklet');
|
|
108
108
|
const { expandBundle, findInterfacePortByName, prettyURL, templateReplace, getServerDidDomain } = require('./index');
|
|
109
|
-
const { installExternalDependencies } = require('./install-external-dependencies');
|
|
110
109
|
|
|
111
110
|
/**
|
|
112
111
|
* get blocklet engine info, default is node
|
|
@@ -565,9 +564,6 @@ const startBlockletProcess = async (
|
|
|
565
564
|
const env = getRuntimeEnvironments(b, nodeEnvironments, ancestors);
|
|
566
565
|
const startedAt = Date.now();
|
|
567
566
|
|
|
568
|
-
// install external dependencies
|
|
569
|
-
await Promise.resolve(installExternalDependencies(b, { env }));
|
|
570
|
-
|
|
571
567
|
// run hook
|
|
572
568
|
await preFlight(b, { env });
|
|
573
569
|
|
|
@@ -2,27 +2,38 @@ const { spawnSync } = require('child_process');
|
|
|
2
2
|
const fs = require('fs-extra');
|
|
3
3
|
const path = require('path');
|
|
4
4
|
|
|
5
|
-
function installExternalDependencies(
|
|
6
|
-
if (!
|
|
7
|
-
throw new Error('
|
|
5
|
+
function installExternalDependencies(appDir) {
|
|
6
|
+
if (!appDir) {
|
|
7
|
+
throw new Error('appDir is required');
|
|
8
|
+
}
|
|
9
|
+
if (!fs.existsSync(appDir)) {
|
|
10
|
+
throw new Error(`not a correct appDir directory: ${appDir}`);
|
|
8
11
|
}
|
|
9
12
|
|
|
10
13
|
// 读取 BLOCKLET_APP_DIR 的 package.json
|
|
11
|
-
const packageJsonPath = path.resolve(
|
|
14
|
+
const packageJsonPath = path.resolve(appDir, 'package.json');
|
|
15
|
+
|
|
12
16
|
if (!fs.existsSync(packageJsonPath)) {
|
|
13
17
|
return;
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
const packageJson = fs.readJsonSync(packageJsonPath);
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
// FIXME: 梁柱, 等未来所有的 blocklet 使用了正式版, 废弃 singleExternals
|
|
23
|
+
const { singleExternals, blockletExternalDependencies } = packageJson;
|
|
24
|
+
const externals = singleExternals || blockletExternalDependencies;
|
|
25
|
+
if (!externals || !externals?.length) {
|
|
19
26
|
return;
|
|
20
27
|
}
|
|
21
28
|
|
|
22
|
-
const result = spawnSync(
|
|
23
|
-
cwd:
|
|
29
|
+
const result = spawnSync('npm', ['install'], {
|
|
30
|
+
cwd: appDir,
|
|
24
31
|
stdio: 'pipe',
|
|
25
32
|
shell: true,
|
|
33
|
+
env: {
|
|
34
|
+
...process.env,
|
|
35
|
+
NODE_ENV: 'production',
|
|
36
|
+
},
|
|
26
37
|
});
|
|
27
38
|
|
|
28
39
|
if (result.status !== 0 && result.stderr && result.stderr.toString().trim()) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.24-beta-
|
|
6
|
+
"version": "1.16.24-beta-08e03567",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/analytics": "1.16.24-beta-
|
|
23
|
-
"@abtnode/auth": "1.16.24-beta-
|
|
24
|
-
"@abtnode/certificate-manager": "1.16.24-beta-
|
|
25
|
-
"@abtnode/constant": "1.16.24-beta-
|
|
26
|
-
"@abtnode/cron": "1.16.24-beta-
|
|
27
|
-
"@abtnode/logger": "1.16.24-beta-
|
|
28
|
-
"@abtnode/models": "1.16.24-beta-
|
|
29
|
-
"@abtnode/queue": "1.16.24-beta-
|
|
30
|
-
"@abtnode/rbac": "1.16.24-beta-
|
|
31
|
-
"@abtnode/router-provider": "1.16.24-beta-
|
|
32
|
-
"@abtnode/static-server": "1.16.24-beta-
|
|
33
|
-
"@abtnode/timemachine": "1.16.24-beta-
|
|
34
|
-
"@abtnode/util": "1.16.24-beta-
|
|
22
|
+
"@abtnode/analytics": "1.16.24-beta-08e03567",
|
|
23
|
+
"@abtnode/auth": "1.16.24-beta-08e03567",
|
|
24
|
+
"@abtnode/certificate-manager": "1.16.24-beta-08e03567",
|
|
25
|
+
"@abtnode/constant": "1.16.24-beta-08e03567",
|
|
26
|
+
"@abtnode/cron": "1.16.24-beta-08e03567",
|
|
27
|
+
"@abtnode/logger": "1.16.24-beta-08e03567",
|
|
28
|
+
"@abtnode/models": "1.16.24-beta-08e03567",
|
|
29
|
+
"@abtnode/queue": "1.16.24-beta-08e03567",
|
|
30
|
+
"@abtnode/rbac": "1.16.24-beta-08e03567",
|
|
31
|
+
"@abtnode/router-provider": "1.16.24-beta-08e03567",
|
|
32
|
+
"@abtnode/static-server": "1.16.24-beta-08e03567",
|
|
33
|
+
"@abtnode/timemachine": "1.16.24-beta-08e03567",
|
|
34
|
+
"@abtnode/util": "1.16.24-beta-08e03567",
|
|
35
35
|
"@arcblock/did": "1.18.110",
|
|
36
36
|
"@arcblock/did-auth": "1.18.110",
|
|
37
37
|
"@arcblock/did-ext": "^1.18.110",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"@arcblock/pm2-events": "^0.0.5",
|
|
43
43
|
"@arcblock/validator": "^1.18.110",
|
|
44
44
|
"@arcblock/vc": "1.18.110",
|
|
45
|
-
"@blocklet/constant": "1.16.24-beta-
|
|
46
|
-
"@blocklet/env": "1.16.24-beta-
|
|
47
|
-
"@blocklet/meta": "1.16.24-beta-
|
|
48
|
-
"@blocklet/resolver": "1.16.24-beta-
|
|
49
|
-
"@blocklet/sdk": "1.16.24-beta-
|
|
50
|
-
"@did-space/client": "^0.3.
|
|
45
|
+
"@blocklet/constant": "1.16.24-beta-08e03567",
|
|
46
|
+
"@blocklet/env": "1.16.24-beta-08e03567",
|
|
47
|
+
"@blocklet/meta": "1.16.24-beta-08e03567",
|
|
48
|
+
"@blocklet/resolver": "1.16.24-beta-08e03567",
|
|
49
|
+
"@blocklet/sdk": "1.16.24-beta-08e03567",
|
|
50
|
+
"@did-space/client": "^0.3.66",
|
|
51
51
|
"@fidm/x509": "^1.2.1",
|
|
52
52
|
"@ocap/mcrypto": "1.18.110",
|
|
53
53
|
"@ocap/util": "1.18.110",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"jest": "^29.7.0",
|
|
103
103
|
"unzipper": "^0.10.11"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "464a7b3b6dd7f205d828e6e4f48f37e80741f762"
|
|
106
106
|
}
|