@pronto-tools-and-more/pronto 5.2.0 → 5.3.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pronto-tools-and-more/pronto",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"@lvce-editor/ipc": "^10.0.4",
|
|
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.3.0",
|
|
21
|
+
"@pronto-tools-and-more/files": "5.3.0",
|
|
22
|
+
"@pronto-tools-and-more/network-process": "5.3.0",
|
|
23
|
+
"@pronto-tools-and-more/sass-compiler": "5.3.0",
|
|
24
|
+
"@pronto-tools-and-more/components-renderer": "5.3.0",
|
|
25
|
+
"@pronto-tools-and-more/components": "5.3.0",
|
|
26
26
|
"execa": "^9.3.1",
|
|
27
27
|
"express": "^4.19.2"
|
|
28
28
|
},
|
package/src/parts/Build/Build.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VError } from "@lvce-editor/verror";
|
|
2
|
-
import { cp, mkdir, writeFile } from "fs/promises";
|
|
2
|
+
import { cp, mkdir, rm, writeFile } from "fs/promises";
|
|
3
3
|
import { join } from "path";
|
|
4
4
|
import * as CompileSass from "../CompileSass/CompileSass.js";
|
|
5
5
|
import * as Config from "../Config/Config.js";
|
|
@@ -7,6 +7,7 @@ import * as Cwd from "../Cwd/Cwd.js";
|
|
|
7
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
|
+
import * as GetViewsResponse from "../GetViewsResponse/GetViewsResponse.js";
|
|
10
11
|
|
|
11
12
|
const sourceMap = false;
|
|
12
13
|
|
|
@@ -33,17 +34,29 @@ export const build = async () => {
|
|
|
33
34
|
await cp(join(Cwd.cwd, "src"), join(dist, "src"), {
|
|
34
35
|
recursive: true,
|
|
35
36
|
errorOnExist: false,
|
|
37
|
+
filter(source, destination) {
|
|
38
|
+
if (source.includes("node_modules")) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
},
|
|
36
43
|
});
|
|
37
44
|
}
|
|
38
|
-
if (Config.splitViews) {
|
|
39
|
-
const
|
|
40
|
-
join(Cwd.cwd, "src", "default", "storefront",
|
|
41
|
-
|
|
45
|
+
if (Config.splitViews || Config.reactComponents) {
|
|
46
|
+
const viewsResponse = await GetViewsResponse.getViewsResponse({
|
|
47
|
+
storeFrontPath: join(Cwd.cwd, "src", "default", "storefront"),
|
|
48
|
+
splitViews: Config.splitViews,
|
|
49
|
+
reactComponents: Config.reactComponents,
|
|
50
|
+
});
|
|
42
51
|
await writeFile(
|
|
43
52
|
join(dist, "src", "default", "storefront", "assets", "views.json"),
|
|
44
|
-
|
|
53
|
+
viewsResponse
|
|
45
54
|
);
|
|
46
55
|
}
|
|
56
|
+
await rm(join(dist, "src", "components"), {
|
|
57
|
+
recursive: true,
|
|
58
|
+
force: true,
|
|
59
|
+
});
|
|
47
60
|
} catch (error) {
|
|
48
61
|
throw new VError(error, `Failed to build`);
|
|
49
62
|
} finally {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import * as HandleViewsReactComponents from "../HandleViewsReactComponents/HandleViewsReactComponents.js";
|
|
4
|
+
import * as HandleViewsSplit from "../HandleViewsSplit/HandleViewsSplit.js";
|
|
5
|
+
|
|
6
|
+
export const getViewsResponse = async ({
|
|
7
|
+
storeFrontPath,
|
|
8
|
+
splitViews,
|
|
9
|
+
reactComponents,
|
|
10
|
+
}) => {
|
|
11
|
+
if (reactComponents) {
|
|
12
|
+
const content =
|
|
13
|
+
await HandleViewsReactComponents.handleViewsReactComponents(
|
|
14
|
+
storeFrontPath
|
|
15
|
+
);
|
|
16
|
+
return content;
|
|
17
|
+
}
|
|
18
|
+
if (splitViews) {
|
|
19
|
+
const content = await HandleViewsSplit.handleViewsSplit(storeFrontPath);
|
|
20
|
+
return content;
|
|
21
|
+
}
|
|
22
|
+
const viewsFilePath = join(storeFrontPath, "assets", "views.json");
|
|
23
|
+
const content = await readFile(viewsFilePath, "utf8");
|
|
24
|
+
return content;
|
|
25
|
+
};
|
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { pipeline } from "node:stream/promises";
|
|
4
|
-
import * as HandleViewsReactComponents from "../HandleViewsReactComponents/HandleViewsReactComponents.js";
|
|
5
|
-
import * as HandleViewsSplit from "../HandleViewsSplit/HandleViewsSplit.js";
|
|
1
|
+
import * as GetViewsResponse from "../GetViewsResponse/GetViewsResponse.js";
|
|
6
2
|
|
|
7
3
|
export const handleViews =
|
|
8
4
|
({ storeFrontPath, splitViews, reactComponents }) =>
|
|
9
5
|
async (req, res) => {
|
|
10
6
|
res.setHeader("Content-Type", "application/json");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (splitViews) {
|
|
20
|
-
const content = await HandleViewsSplit.handleViewsSplit(storeFrontPath);
|
|
21
|
-
res.end(content);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
const viewsFilePath = join(storeFrontPath, "assets", "views.json");
|
|
25
|
-
const readStream = createReadStream(viewsFilePath);
|
|
26
|
-
await pipeline(readStream, res);
|
|
7
|
+
const content = await GetViewsResponse.getViewsResponse({
|
|
8
|
+
storeFrontPath,
|
|
9
|
+
splitViews,
|
|
10
|
+
reactComponents,
|
|
11
|
+
});
|
|
12
|
+
res.end(content);
|
|
27
13
|
};
|