@pronto-tools-and-more/pronto 5.5.0 → 5.7.0
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/package.json +10 -9
- package/src/parts/Build/Build.js +4 -0
- package/src/parts/CommandMap/CommandMap.js +3 -1
- package/src/parts/Config/Config.js +2 -0
- package/src/parts/GetCommandFromCliArgs/GetCommandFromCliArgs.js +3 -0
- package/src/parts/LaunchSchemaProcess/LaunchSchemaProcess.js +15 -0
- package/src/parts/SchemaProcess/SchemaProcess.js +26 -0
- package/src/parts/SchemaProcessPath/SchemaProcessPath.js +13 -0
- package/src/parts/ValidateAllSchemas/ValidateAllSchemas.js +38 -0
- package/src/parts/ValidateSchema/ValidateSchema.js +10 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pronto-tools-and-more/pronto",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -13,16 +13,17 @@
|
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@lvce-editor/assert": "^1.
|
|
17
|
-
"@lvce-editor/ipc": "^10.
|
|
16
|
+
"@lvce-editor/assert": "^1.3.0",
|
|
17
|
+
"@lvce-editor/ipc": "^10.2.1",
|
|
18
18
|
"@lvce-editor/json-rpc": "^3.0.0",
|
|
19
19
|
"@lvce-editor/verror": "^1.4.0",
|
|
20
|
-
"@pronto-tools-and-more/file-watcher": "5.
|
|
21
|
-
"@pronto-tools-and-more/files": "5.
|
|
22
|
-
"@pronto-tools-and-more/network-process": "5.
|
|
23
|
-
"@pronto-tools-and-more/sass-compiler": "5.
|
|
24
|
-
"@pronto-tools-and-more/components-renderer": "5.
|
|
25
|
-
"@pronto-tools-and-more/components": "5.
|
|
20
|
+
"@pronto-tools-and-more/file-watcher": "5.7.0",
|
|
21
|
+
"@pronto-tools-and-more/files": "5.7.0",
|
|
22
|
+
"@pronto-tools-and-more/network-process": "5.7.0",
|
|
23
|
+
"@pronto-tools-and-more/sass-compiler": "5.7.0",
|
|
24
|
+
"@pronto-tools-and-more/components-renderer": "5.7.0",
|
|
25
|
+
"@pronto-tools-and-more/components": "5.7.0",
|
|
26
|
+
"@pronto-tools-and-more/schema-process": "5.7.0",
|
|
26
27
|
"execa": "^9.3.1",
|
|
27
28
|
"express": "^4.19.2"
|
|
28
29
|
},
|
package/src/parts/Build/Build.js
CHANGED
|
@@ -8,6 +8,7 @@ import * as FilesPath from "../FilesPath/FilesPath.js";
|
|
|
8
8
|
import * as SassProcess from "../SassProcess/SassProcess.js";
|
|
9
9
|
import * as GetViewsJson from "../GetViewsJson/GetViewsJson.js";
|
|
10
10
|
import * as GetViewsResponse from "../GetViewsResponse/GetViewsResponse.js";
|
|
11
|
+
import * as ValidateAllSchemas from "../ValidateAllSchemas/ValidateAllSchemas.js";
|
|
11
12
|
|
|
12
13
|
const sourceMap = false;
|
|
13
14
|
|
|
@@ -53,6 +54,9 @@ export const build = async () => {
|
|
|
53
54
|
viewsResponse
|
|
54
55
|
);
|
|
55
56
|
}
|
|
57
|
+
if (Config.validateSchema) {
|
|
58
|
+
await ValidateAllSchemas.validateAllSchemas();
|
|
59
|
+
}
|
|
56
60
|
await rm(join(dist, "src", "components"), {
|
|
57
61
|
recursive: true,
|
|
58
62
|
force: true,
|
|
@@ -5,9 +5,10 @@ import * as Login from "../Login/Login.js";
|
|
|
5
5
|
import * as PullCode from "../PullCode/PullCode.js";
|
|
6
6
|
import * as PushCode from "../PushCode/PushCode.js";
|
|
7
7
|
import * as Server from "../Server/Server.js";
|
|
8
|
+
import * as Split from "../Split/Split.js";
|
|
8
9
|
import * as Upgrade from "../Upgrade/Upgrade.js";
|
|
9
10
|
import * as UploadZip from "../UploadZip/UploadZip.js";
|
|
10
|
-
import * as
|
|
11
|
+
import * as ValidateAllSchemas from "../ValidateAllSchemas/ValidateAllSchemas.js";
|
|
11
12
|
|
|
12
13
|
export const commandMap = {
|
|
13
14
|
"Build.build": Build.build,
|
|
@@ -20,4 +21,5 @@ export const commandMap = {
|
|
|
20
21
|
"Split.split": Split.split,
|
|
21
22
|
"Upgrade.upgrade": Upgrade.upgrade,
|
|
22
23
|
"UploadZip.uploadZip": UploadZip.uploadZip,
|
|
24
|
+
"ValidateAllSchema.validateAllSchemas": ValidateAllSchemas.validateAllSchemas,
|
|
23
25
|
};
|
|
@@ -64,6 +64,8 @@ export const contentUrl =
|
|
|
64
64
|
config.contentUrl || "https://catalog.purplemanager.com";
|
|
65
65
|
export const errorColor = config.errorColor || "red";
|
|
66
66
|
|
|
67
|
+
export const validateSchema = config.validateSchema || false;
|
|
68
|
+
|
|
67
69
|
const pipelines = Object.values(builderConfig?.postProcessing?.pipelines || {});
|
|
68
70
|
const sassPipeline = pipelines.find((pipeline) => pipeline.type === "sass");
|
|
69
71
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as HandleIpc from "../HandleIpc/HandleIpc.js";
|
|
2
|
+
import * as IpcParent from "../IpcParent/IpcParent.js";
|
|
3
|
+
import * as IpcParentType from "../IpcParentType/IpcParentType.js";
|
|
4
|
+
import * as SchemaProcessPath from "../SchemaProcessPath/SchemaProcessPath.js";
|
|
5
|
+
|
|
6
|
+
export const launchSchemaProcess = async () => {
|
|
7
|
+
const ipc = await IpcParent.create({
|
|
8
|
+
method: IpcParentType.NodeForkedProcess,
|
|
9
|
+
path: SchemaProcessPath.schemaProcessPath,
|
|
10
|
+
});
|
|
11
|
+
HandleIpc.handleIpc(ipc);
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
ipc._rawIpc.unref();
|
|
14
|
+
return ipc;
|
|
15
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as JsonRpc from "../JsonRpc/JsonRpc.js";
|
|
2
|
+
import * as LaunchSchemaProcess from "../LaunchSchemaProcess/LaunchSchemaProcess.js";
|
|
3
|
+
|
|
4
|
+
const state = {
|
|
5
|
+
/**
|
|
6
|
+
* @type {any}
|
|
7
|
+
*/
|
|
8
|
+
ipc: undefined,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const getOrCreate = () => {
|
|
12
|
+
if (!state.ipc) {
|
|
13
|
+
state.ipc = LaunchSchemaProcess.launchSchemaProcess();
|
|
14
|
+
}
|
|
15
|
+
return state.ipc;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const invoke = async (method, ...params) => {
|
|
19
|
+
const ipc = await getOrCreate();
|
|
20
|
+
return JsonRpc.invoke(ipc, method, ...params);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const dispose = async () => {
|
|
24
|
+
const ipc = await getOrCreate();
|
|
25
|
+
ipc.dispose();
|
|
26
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as Path from "node:path";
|
|
2
|
+
import * as ResolveBin from "../ResolveBin/ResolveBin.js";
|
|
3
|
+
import * as Root from "../Root/Root.js";
|
|
4
|
+
|
|
5
|
+
export const schemaProcessPath =
|
|
6
|
+
ResolveBin.resolveBin("@pronto-tools-and-more/schema-process") ||
|
|
7
|
+
Path.join(
|
|
8
|
+
Root.root,
|
|
9
|
+
"packages",
|
|
10
|
+
"pronto-schema-process",
|
|
11
|
+
"src",
|
|
12
|
+
"schemaProcessMain.js"
|
|
13
|
+
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { join } from "path";
|
|
2
|
+
import * as Cwd from "../Cwd/Cwd.js";
|
|
3
|
+
import * as FilesPath from "../FilesPath/FilesPath.js";
|
|
4
|
+
import * as JsonFile from "../JsonFile/JsonFile.js";
|
|
5
|
+
import * as ValidateSchema from "../ValidateSchema/ValidateSchema.js";
|
|
6
|
+
import * as SchemaProcess from "../SchemaProcess/SchemaProcess.js";
|
|
7
|
+
|
|
8
|
+
export const validateAllSchemas = async () => {
|
|
9
|
+
const dist = join(Cwd.cwd, ".tmp", "dist");
|
|
10
|
+
const viewsJsonPath = join(
|
|
11
|
+
dist,
|
|
12
|
+
"src",
|
|
13
|
+
"default",
|
|
14
|
+
"storefront",
|
|
15
|
+
"assets",
|
|
16
|
+
"views.json"
|
|
17
|
+
);
|
|
18
|
+
const viewsJsonSchemaPath = join(
|
|
19
|
+
FilesPath.filesPath,
|
|
20
|
+
"schema",
|
|
21
|
+
"views-schema.json"
|
|
22
|
+
);
|
|
23
|
+
const viewsJsonSchema = await JsonFile.readJson(viewsJsonSchemaPath);
|
|
24
|
+
const viewsJson = await JsonFile.readJson(viewsJsonPath);
|
|
25
|
+
const { valid, errors } = await ValidateSchema.validateSchema(
|
|
26
|
+
viewsJsonSchema,
|
|
27
|
+
viewsJson
|
|
28
|
+
);
|
|
29
|
+
if (!valid) {
|
|
30
|
+
for (const error of errors) {
|
|
31
|
+
console.error(
|
|
32
|
+
`[pronto] views json schema error: ${error.message} at ${error.instancePath} `
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
process.exit(128);
|
|
36
|
+
}
|
|
37
|
+
await SchemaProcess.dispose();
|
|
38
|
+
};
|