@pronto-tools-and-more/pronto 4.5.0 → 4.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pronto-tools-and-more/pronto",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@pronto-tools-and-more/file-watcher": "4.
|
|
17
|
-
"@pronto-tools-and-more/files": "4.
|
|
18
|
-
"@pronto-tools-and-more/network-process": "4.
|
|
19
|
-
"@pronto-tools-and-more/sass-compiler": "4.
|
|
16
|
+
"@pronto-tools-and-more/file-watcher": "4.7.0",
|
|
17
|
+
"@pronto-tools-and-more/files": "4.7.0",
|
|
18
|
+
"@pronto-tools-and-more/network-process": "4.7.0",
|
|
19
|
+
"@pronto-tools-and-more/sass-compiler": "4.7.0",
|
|
20
20
|
"@lvce-editor/assert": "^1.2.0",
|
|
21
21
|
"@lvce-editor/ipc": "^9.4.0",
|
|
22
22
|
"@lvce-editor/json-rpc": "^1.4.0",
|
|
23
23
|
"@lvce-editor/verror": "^1.4.0",
|
|
24
|
-
"execa": "^9.3.
|
|
24
|
+
"execa": "^9.3.1",
|
|
25
25
|
"express": "^4.19.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
package/src/parts/App/App.js
CHANGED
|
@@ -6,10 +6,9 @@ import * as CompileSass from "../CompileSass/CompileSass.js";
|
|
|
6
6
|
import * as Config from "../Config/Config.js";
|
|
7
7
|
import * as FilesPath from "../FilesPath/FilesPath.js";
|
|
8
8
|
import * as HandleMainJs from "../HandleMainJs/HandleMainJs.js";
|
|
9
|
+
import * as ProxyPath from "../ProxyPath/ProxyPath.js";
|
|
9
10
|
import * as UpdateCss from "../UpdateCss/UpdateCss.js";
|
|
10
|
-
import * as HandleResources from "../ProxyPath/ProxyPath.js";
|
|
11
11
|
import * as UpdateIndexHtml from "../UpdateIndexHtml/UpdateIndexHtml.js";
|
|
12
|
-
import * as ProxyPath from "../ProxyPath/ProxyPath.js";
|
|
13
12
|
|
|
14
13
|
const handleIndex =
|
|
15
14
|
(storeFrontPath, appId, baseUrl, contentUrl, platform) =>
|
|
@@ -60,6 +59,7 @@ export const create = ({
|
|
|
60
59
|
kioskBaseUrl,
|
|
61
60
|
catalogApiBaseUrl,
|
|
62
61
|
companyUrl,
|
|
62
|
+
mode,
|
|
63
63
|
}) => {
|
|
64
64
|
const app = express();
|
|
65
65
|
const storeFrontPath = join(root, "src", "default", "storefront");
|
|
@@ -78,10 +78,19 @@ export const create = ({
|
|
|
78
78
|
kioskBaseUrl,
|
|
79
79
|
managerBaseUrl,
|
|
80
80
|
companyUrl,
|
|
81
|
+
filesPath: FilesPath.filesPath,
|
|
82
|
+
mode,
|
|
81
83
|
})
|
|
82
84
|
);
|
|
83
85
|
app.use("*", handleCss(storeFrontPath));
|
|
84
86
|
app.use(express.static(FilesPath.filesPath));
|
|
87
|
+
if (mode === "slim") {
|
|
88
|
+
app.use(
|
|
89
|
+
express.static(
|
|
90
|
+
join(FilesPath.filesPath, "framework", "src", "default", "storefront")
|
|
91
|
+
)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
85
94
|
app.use(express.static(storeFrontPath));
|
|
86
95
|
app.use(express.static(defaultPath));
|
|
87
96
|
app.use(express.static(contentPath));
|
package/src/parts/Build/Build.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { VError } from "@lvce-editor/verror";
|
|
2
|
-
import { writeFile } from "fs/promises";
|
|
2
|
+
import { cp, mkdir, writeFile } from "fs/promises";
|
|
3
|
+
import { join } from "path";
|
|
3
4
|
import * as CompileSass from "../CompileSass/CompileSass.js";
|
|
4
5
|
import * as Config from "../Config/Config.js";
|
|
6
|
+
import * as Cwd from "../Cwd/Cwd.js";
|
|
7
|
+
import * as FilesPath from "../FilesPath/FilesPath.js";
|
|
5
8
|
import * as SassProcess from "../SassProcess/SassProcess.js";
|
|
6
9
|
|
|
7
10
|
const sourceMap = false;
|
|
@@ -12,10 +15,25 @@ export const build = async () => {
|
|
|
12
15
|
updateDynamicResources: false,
|
|
13
16
|
sourceMap,
|
|
14
17
|
});
|
|
18
|
+
const dist = join(Cwd.cwd, ".tmp", "dist");
|
|
15
19
|
const css = result.css + "\n\n/*# sourceMappingURL=custom.css.map */\n";
|
|
16
20
|
await writeFile(Config.rootCssFile, css);
|
|
17
21
|
const rootCssMapFile = Config.rootCssFile + ".map";
|
|
18
22
|
await writeFile(rootCssMapFile, JSON.stringify(result.sourceMap) + "\n");
|
|
23
|
+
if (Config.mode === "slim") {
|
|
24
|
+
await mkdir(join(dist, "src"), { recursive: true });
|
|
25
|
+
await cp(
|
|
26
|
+
join(FilesPath.filesPath, "framework", "src"),
|
|
27
|
+
join(dist, "src"),
|
|
28
|
+
{
|
|
29
|
+
recursive: true,
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
await cp(join(Cwd.cwd, "src"), join(dist, "src"), {
|
|
33
|
+
recursive: true,
|
|
34
|
+
errorOnExist: false,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
19
37
|
} catch (error) {
|
|
20
38
|
throw new VError(error, `Failed to build`);
|
|
21
39
|
} finally {
|
|
@@ -67,6 +67,8 @@ export const errorColor = config.errorColor || "red";
|
|
|
67
67
|
const pipelines = Object.values(builderConfig?.postProcessing?.pipelines || {});
|
|
68
68
|
const sassPipeline = pipelines.find((pipeline) => pipeline.type === "sass");
|
|
69
69
|
|
|
70
|
+
export const mode = config.mode || "fat";
|
|
71
|
+
|
|
70
72
|
export const rootSassFile = join(
|
|
71
73
|
Cwd.cwd,
|
|
72
74
|
"src",
|
|
@@ -20,6 +20,7 @@ export const createServer = async (root, errorColor) => {
|
|
|
20
20
|
kioskBaseUrl: Config.kioskBaseUrl,
|
|
21
21
|
catalogApiBaseUrl: Config.catalogApiBaseUrl,
|
|
22
22
|
companyUrl: Config.companyUrl,
|
|
23
|
+
mode: Config.mode,
|
|
23
24
|
});
|
|
24
25
|
const server = http.createServer(app);
|
|
25
26
|
const webSocketServer = new ws.WebSocketServer({
|
|
@@ -3,6 +3,13 @@ import { join } from "node:path";
|
|
|
3
3
|
import * as GetNewMainJsContent from "../GetNewMainJsContent/GetNewMainJsContent.js";
|
|
4
4
|
import * as GetPdfViewerSnippet from "../GetPdfViewerSnippet/GetPdfViewerSnippet.js";
|
|
5
5
|
|
|
6
|
+
const getBasePath = (mode, storeFrontPath, filesPath) => {
|
|
7
|
+
if (mode === "slim") {
|
|
8
|
+
return join(filesPath, "framework", "src", "default", "storefront");
|
|
9
|
+
}
|
|
10
|
+
return storeFrontPath;
|
|
11
|
+
};
|
|
12
|
+
|
|
6
13
|
export const handleMainJs =
|
|
7
14
|
({
|
|
8
15
|
storeFrontPath,
|
|
@@ -11,10 +18,13 @@ export const handleMainJs =
|
|
|
11
18
|
kioskBaseUrl,
|
|
12
19
|
managerBaseUrl,
|
|
13
20
|
companyUrl,
|
|
21
|
+
filesPath,
|
|
22
|
+
mode,
|
|
14
23
|
}) =>
|
|
15
24
|
async (req, res) => {
|
|
25
|
+
const basePath = getBasePath(mode, storeFrontPath, filesPath);
|
|
16
26
|
// TODO use etag
|
|
17
|
-
const mainPath = join(
|
|
27
|
+
const mainPath = join(basePath, "modules", "main.js");
|
|
18
28
|
const content = await readFile(mainPath, "utf8");
|
|
19
29
|
const pdfSnippet = await GetPdfViewerSnippet.getPdfViewerSnippet({
|
|
20
30
|
appId,
|
|
@@ -8,6 +8,13 @@ import * as GetZipUploadMessage from "../GetZipUploadMessage/GetZipUploadMessage
|
|
|
8
8
|
import * as NetworkProcess from "../NetworkProcess/NetworkProcess.js";
|
|
9
9
|
import * as UploadZip from "../UploadZip/UploadZip.js";
|
|
10
10
|
|
|
11
|
+
const getSrc = (mode) => {
|
|
12
|
+
if (mode === "slim") {
|
|
13
|
+
return join(Cwd.cwd, ".tmp", "dist", "src");
|
|
14
|
+
}
|
|
15
|
+
return join(Cwd.cwd, "src");
|
|
16
|
+
};
|
|
17
|
+
|
|
11
18
|
export const pushCode = async () => {
|
|
12
19
|
try {
|
|
13
20
|
const {
|
|
@@ -18,6 +25,7 @@ export const pushCode = async () => {
|
|
|
18
25
|
uploadBaseUrl,
|
|
19
26
|
preview,
|
|
20
27
|
uploadTimeout,
|
|
28
|
+
mode,
|
|
21
29
|
} = Config;
|
|
22
30
|
if (!userEmail) {
|
|
23
31
|
throw new Error(`missing user email`);
|
|
@@ -26,7 +34,7 @@ export const pushCode = async () => {
|
|
|
26
34
|
throw new Error("missing user password");
|
|
27
35
|
}
|
|
28
36
|
const outFile = join(Cwd.cwd, ".tmp", "upload.zip");
|
|
29
|
-
const src =
|
|
37
|
+
const src = getSrc(mode);
|
|
30
38
|
const sessionId = await GetSessionId.getSessionId({
|
|
31
39
|
loginUrl,
|
|
32
40
|
userEmail,
|