@pronto-tools-and-more/pronto 6.1.0 → 6.1.1
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pronto-tools-and-more/pronto",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,13 +17,13 @@
|
|
|
17
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": "6.1.
|
|
21
|
-
"@pronto-tools-and-more/files": "6.1.
|
|
22
|
-
"@pronto-tools-and-more/network-process": "6.1.
|
|
23
|
-
"@pronto-tools-and-more/sass-compiler": "6.1.
|
|
24
|
-
"@pronto-tools-and-more/components-renderer": "6.1.
|
|
25
|
-
"@pronto-tools-and-more/components": "6.1.
|
|
26
|
-
"@pronto-tools-and-more/schema-process": "6.1.
|
|
20
|
+
"@pronto-tools-and-more/file-watcher": "6.1.1",
|
|
21
|
+
"@pronto-tools-and-more/files": "6.1.1",
|
|
22
|
+
"@pronto-tools-and-more/network-process": "6.1.1",
|
|
23
|
+
"@pronto-tools-and-more/sass-compiler": "6.1.1",
|
|
24
|
+
"@pronto-tools-and-more/components-renderer": "6.1.1",
|
|
25
|
+
"@pronto-tools-and-more/components": "6.1.1",
|
|
26
|
+
"@pronto-tools-and-more/schema-process": "6.1.1",
|
|
27
27
|
"execa": "^9.3.1",
|
|
28
28
|
"express": "^4.20.0"
|
|
29
29
|
},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const normalize = (name) => {
|
|
2
|
+
if (!name) {
|
|
3
|
+
return "anonymous" + Math.random().toFixed(3);
|
|
4
|
+
}
|
|
5
|
+
return name.replaceAll("/", "-");
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const getSplitFileName = (item) => {
|
|
9
|
+
if (item.path && item.redirectTo) {
|
|
10
|
+
return "redirect.json";
|
|
11
|
+
}
|
|
12
|
+
if (item.path) {
|
|
13
|
+
return normalize(item.path) + ".json";
|
|
14
|
+
}
|
|
15
|
+
if (item.globalData) {
|
|
16
|
+
return `globalData.json`;
|
|
17
|
+
}
|
|
18
|
+
return `unknown.json`;
|
|
19
|
+
};
|
package/src/parts/Split/Split.js
CHANGED
|
@@ -3,37 +3,15 @@ import { existsSync } from "fs";
|
|
|
3
3
|
import { mkdir, readFile, rm, writeFile } from "fs/promises";
|
|
4
4
|
import { join } from "path";
|
|
5
5
|
import * as Cwd from "../Cwd/Cwd.js";
|
|
6
|
+
import * as GetSplitFileName from "../GetSplitFileName/GetSplitFileName.js";
|
|
6
7
|
import * as JsonFile from "../JsonFile/JsonFile.js";
|
|
7
8
|
|
|
8
|
-
const normalize = (name) => {
|
|
9
|
-
if (!name) {
|
|
10
|
-
return "anonymous" + Math.random().toFixed(3);
|
|
11
|
-
}
|
|
12
|
-
return name.replaceAll("/", "-");
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const getFileName = (item) => {
|
|
16
|
-
if (item.path) {
|
|
17
|
-
if (item.path === "/") {
|
|
18
|
-
if (item.redirectTo) {
|
|
19
|
-
return "redirect.json";
|
|
20
|
-
}
|
|
21
|
-
return normalize(item.name) + ".json";
|
|
22
|
-
}
|
|
23
|
-
return normalize(item.path) + ".json";
|
|
24
|
-
}
|
|
25
|
-
if (item.globalData) {
|
|
26
|
-
return `globalData.json`;
|
|
27
|
-
}
|
|
28
|
-
return `unknown.json`;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
9
|
const splitViewsJson = async (viewsJsonPath, viewsJsonFolder) => {
|
|
32
10
|
const viewsJsonContent = await readFile(viewsJsonPath, "utf8");
|
|
33
11
|
const viewsJsonArray = JSON.parse(viewsJsonContent);
|
|
34
12
|
const splitItems = [];
|
|
35
13
|
for (const item of viewsJsonArray) {
|
|
36
|
-
const fileName =
|
|
14
|
+
const fileName = GetSplitFileName.getSplitFileName(item);
|
|
37
15
|
const splitItem = {
|
|
38
16
|
path: join(viewsJsonFolder, fileName),
|
|
39
17
|
content: JSON.stringify(item, null, 2) + "\n",
|