@blocklet/meta 1.16.37 → 1.16.38-beta-20250108-235929-17742885
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/engine.js +1 -1
- package/lib/schema.js +4 -18
- package/package.json +5 -4
package/lib/engine.js
CHANGED
|
@@ -36,7 +36,7 @@ const isGatewayBlocklet = (meta) => meta?.group === constant_1.BlockletGroup.gat
|
|
|
36
36
|
exports.isGatewayBlocklet = isGatewayBlocklet;
|
|
37
37
|
const isPackBlocklet = (meta) => meta?.group === constant_1.BlockletGroup.pack;
|
|
38
38
|
exports.isPackBlocklet = isPackBlocklet;
|
|
39
|
-
const hasStartEngine = (meta) => !!meta?.main || (0, exports.getBlockletEngine)((meta || {})).interpreter === 'blocklet';
|
|
39
|
+
const hasStartEngine = (meta) => !!meta?.main || !!meta?.docker?.image || (0, exports.getBlockletEngine)((meta || {})).interpreter === 'blocklet';
|
|
40
40
|
exports.hasStartEngine = hasStartEngine;
|
|
41
41
|
const hasMountPoint = (meta) => ((0, exports.hasStartEngine)(meta) || (meta?.interfaces || []).find((x) => x.type === constant_1.BLOCKLET_INTERFACE_TYPE_WEB)) &&
|
|
42
42
|
(0, exports.isGatewayBlocklet)(meta) === false;
|
package/lib/schema.js
CHANGED
|
@@ -45,6 +45,7 @@ const joi_extension_semver_1 = require("joi-extension-semver");
|
|
|
45
45
|
const is_var_name_1 = __importDefault(require("is-var-name"));
|
|
46
46
|
const constant_1 = require("@abtnode/constant");
|
|
47
47
|
const did_1 = require("@arcblock/did");
|
|
48
|
+
const docker_utils_1 = require("@abtnode/docker-utils");
|
|
48
49
|
const constant_2 = require("@blocklet/constant");
|
|
49
50
|
const did_2 = __importDefault(require("./did"));
|
|
50
51
|
const extension_1 = require("./extension");
|
|
@@ -739,25 +740,14 @@ const createBlockletSchema = (baseDir, { ensureFiles = false, ensureDist = false
|
|
|
739
740
|
name: ensureName ? Joi.string().optional() : Joi.string().required(),
|
|
740
741
|
// only using docker
|
|
741
742
|
egress: Joi.boolean().optional().default(true),
|
|
742
|
-
docker:
|
|
743
|
-
workdir: Joi.string().trim(),
|
|
744
|
-
image: Joi.string().trim().optional(),
|
|
745
|
-
dockerfile: ensureFiles ? Joi.file().trim().exists({ baseDir }).optional() : Joi.string().trim().optional(),
|
|
746
|
-
shell: Joi.string().trim().optional(),
|
|
747
|
-
network: Joi.string().valid('host', 'bridge', 'none').default('host').optional(),
|
|
748
|
-
volumes: Joi.array().items(Joi.string().trim()).optional(),
|
|
749
|
-
script: Joi.string().trim().optional(),
|
|
750
|
-
installNodeModules: Joi.boolean().optional(),
|
|
751
|
-
command: Joi.string().trim().optional(),
|
|
752
|
-
runBaseScript: Joi.boolean().optional(),
|
|
753
|
-
}).optional(),
|
|
743
|
+
docker: docker_utils_1.dockerSchema,
|
|
754
744
|
})
|
|
755
745
|
.options({ stripUnknown: true, noDefaults: false, ...schemaOptions })
|
|
756
746
|
.rename('children', 'components')
|
|
757
747
|
.custom((data, helper) => {
|
|
758
748
|
const { did, name, docker } = data;
|
|
759
749
|
if (docker) {
|
|
760
|
-
const { image, dockerfile,
|
|
750
|
+
const { image, dockerfile, network } = docker;
|
|
761
751
|
if (!image && !dockerfile) {
|
|
762
752
|
// @ts-ignore
|
|
763
753
|
return helper.message('Image or dockerfile must be set');
|
|
@@ -766,14 +756,10 @@ const createBlockletSchema = (baseDir, { ensureFiles = false, ensureDist = false
|
|
|
766
756
|
// @ts-ignore
|
|
767
757
|
return helper.message('Image and dockerfile cannot be set at the same time');
|
|
768
758
|
}
|
|
769
|
-
if (
|
|
759
|
+
if (network) {
|
|
770
760
|
// @ts-ignore
|
|
771
761
|
return helper.message('ExportPorts and network cannot be set at the same time');
|
|
772
762
|
}
|
|
773
|
-
if (!exportPorts && !network) {
|
|
774
|
-
// @ts-ignore
|
|
775
|
-
return helper.message('ExportPorts or network must be set');
|
|
776
|
-
}
|
|
777
763
|
if (dockerfile) {
|
|
778
764
|
if (!data.files) {
|
|
779
765
|
data.files = [];
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.
|
|
6
|
+
"version": "1.16.38-beta-20250108-235929-17742885",
|
|
7
7
|
"description": "Library to parse/validate/fix blocklet meta",
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
9
|
"typings": "./lib/index.d.ts",
|
|
@@ -25,12 +25,13 @@
|
|
|
25
25
|
"author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@abtnode/constant": "1.16.
|
|
28
|
+
"@abtnode/constant": "1.16.38-beta-20250108-235929-17742885",
|
|
29
|
+
"@abtnode/docker-utils": "1.16.38-beta-20250108-235929-17742885",
|
|
29
30
|
"@arcblock/did": "1.19.2",
|
|
30
31
|
"@arcblock/did-ext": "1.19.2",
|
|
31
32
|
"@arcblock/did-util": "1.19.2",
|
|
32
33
|
"@arcblock/jwt": "1.19.2",
|
|
33
|
-
"@blocklet/constant": "1.16.
|
|
34
|
+
"@blocklet/constant": "1.16.38-beta-20250108-235929-17742885",
|
|
34
35
|
"@ocap/asset": "1.19.2",
|
|
35
36
|
"@ocap/mcrypto": "1.19.2",
|
|
36
37
|
"@ocap/types": "1.19.2",
|
|
@@ -79,5 +80,5 @@
|
|
|
79
80
|
"ts-node": "^10.9.1",
|
|
80
81
|
"typescript": "^5.6.3"
|
|
81
82
|
},
|
|
82
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "09d67442bff28543c35824a41c23bea3b75a2a23"
|
|
83
84
|
}
|