@pronto-tools-and-more/pronto 3.7.0 → 3.8.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": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@pronto-tools-and-more/file-watcher": "3.
|
|
17
|
-
"@pronto-tools-and-more/files": "3.
|
|
18
|
-
"@pronto-tools-and-more/network-process": "3.
|
|
19
|
-
"@pronto-tools-and-more/sass-compiler": "3.
|
|
16
|
+
"@pronto-tools-and-more/file-watcher": "3.8.0",
|
|
17
|
+
"@pronto-tools-and-more/files": "3.8.0",
|
|
18
|
+
"@pronto-tools-and-more/network-process": "3.8.0",
|
|
19
|
+
"@pronto-tools-and-more/sass-compiler": "3.8.0",
|
|
20
20
|
"@lvce-editor/assert": "^1.2.0",
|
|
21
21
|
"@lvce-editor/ipc": "^9.1.0",
|
|
22
22
|
"@lvce-editor/json-rpc": "^1.3.0",
|
package/src/parts/App/App.js
CHANGED
|
@@ -9,14 +9,16 @@ import * as UpdateCss from "../UpdateCss/UpdateCss.js";
|
|
|
9
9
|
import * as UpdateIndexHtml from "../UpdateIndexHtml/UpdateIndexHtml.js";
|
|
10
10
|
|
|
11
11
|
const handleIndex =
|
|
12
|
-
(storeFrontPath, appId, baseUrl, contentUrl
|
|
12
|
+
(storeFrontPath, appId, baseUrl, contentUrl, platform) =>
|
|
13
|
+
async (req, res) => {
|
|
13
14
|
const indexHtmlPath = join(storeFrontPath, "index.html");
|
|
14
15
|
const indexHtmlContent = await readFile(indexHtmlPath, "utf8");
|
|
15
16
|
const newIndexHtml = UpdateIndexHtml.updateIndexHtml(
|
|
16
17
|
indexHtmlContent,
|
|
17
18
|
appId,
|
|
18
19
|
baseUrl,
|
|
19
|
-
contentUrl
|
|
20
|
+
contentUrl,
|
|
21
|
+
platform
|
|
20
22
|
);
|
|
21
23
|
res.end(newIndexHtml);
|
|
22
24
|
};
|
|
@@ -53,7 +55,11 @@ export const create = (root) => {
|
|
|
53
55
|
const appId = Config.appId;
|
|
54
56
|
const baseUrl = Config.baseUrl;
|
|
55
57
|
const contentUrl = Config.contentUrl;
|
|
56
|
-
|
|
58
|
+
const platform = Config.platform;
|
|
59
|
+
app.get(
|
|
60
|
+
"/",
|
|
61
|
+
handleIndex(storeFrontPath, appId, baseUrl, contentUrl, platform)
|
|
62
|
+
);
|
|
57
63
|
app.use("*", handleCss(storeFrontPath));
|
|
58
64
|
app.use(express.static(FilesPath.filesPath));
|
|
59
65
|
app.use(express.static(storeFrontPath));
|
|
@@ -6,17 +6,29 @@ export const userEmail = process.env.PRONTO_USER_EMAIL;
|
|
|
6
6
|
export const userPassword = process.env.PRONTO_USER_PASSWORD;
|
|
7
7
|
|
|
8
8
|
const configFileUrl = join(Cwd.cwd, "pronto.json");
|
|
9
|
+
const builderConfigFileUrl = join(
|
|
10
|
+
Cwd.cwd,
|
|
11
|
+
"src",
|
|
12
|
+
"default",
|
|
13
|
+
"builder.config.json"
|
|
14
|
+
);
|
|
9
15
|
|
|
10
|
-
const getConfig = () => {
|
|
11
|
-
if (existsSync(
|
|
12
|
-
const content = readFileSync(
|
|
16
|
+
const getConfig = (url) => {
|
|
17
|
+
if (existsSync(url)) {
|
|
18
|
+
const content = readFileSync(url, "utf8");
|
|
13
19
|
const parsed = JSON.parse(content);
|
|
14
20
|
return parsed;
|
|
15
21
|
}
|
|
16
22
|
return {};
|
|
17
23
|
};
|
|
18
24
|
|
|
19
|
-
const config = getConfig();
|
|
25
|
+
const config = getConfig(configFileUrl);
|
|
26
|
+
const builderConfig = getConfig(builderConfigFileUrl);
|
|
27
|
+
|
|
28
|
+
const defaultPlatform = "ios";
|
|
29
|
+
|
|
30
|
+
export const platform = config.platform || defaultPlatform;
|
|
31
|
+
|
|
20
32
|
// TODO use direct backend url
|
|
21
33
|
export const loginUrl =
|
|
22
34
|
config.loginUrl || `https://builder.purplemanager.com/api/user/login`;
|
|
@@ -37,21 +49,17 @@ export const contentUrl =
|
|
|
37
49
|
config.contentUrl || "https://catalog.purplemanager.com";
|
|
38
50
|
export const errorColor = config.errorColor || "red";
|
|
39
51
|
|
|
52
|
+
const pipelines = Object.values(builderConfig?.postProcessing?.pipelines || {});
|
|
53
|
+
const sassPipeline = pipelines.find((pipeline) => pipeline.type === "sass");
|
|
54
|
+
|
|
40
55
|
export const rootSassFile = join(
|
|
41
56
|
Cwd.cwd,
|
|
42
57
|
"src",
|
|
43
|
-
"
|
|
44
|
-
"storefront",
|
|
45
|
-
"assets",
|
|
46
|
-
"scss",
|
|
47
|
-
"__index.scss"
|
|
58
|
+
sassPipeline?.input || "not-found.scss"
|
|
48
59
|
);
|
|
49
60
|
|
|
50
61
|
export const rootCssFile = join(
|
|
51
62
|
Cwd.cwd,
|
|
52
63
|
"src",
|
|
53
|
-
"
|
|
54
|
-
"storefront",
|
|
55
|
-
"assets",
|
|
56
|
-
"custom.css"
|
|
64
|
+
sassPipeline?.output || "not-found.css"
|
|
57
65
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const occurrenceSnippetBody = "</body>";
|
|
2
|
-
const replacementSnippetBody = (appId, baseUrl, contentUrl) =>
|
|
2
|
+
const replacementSnippetBody = (appId, baseUrl, contentUrl, platform) =>
|
|
3
3
|
`
|
|
4
4
|
<script>
|
|
5
5
|
window._editorAppInfo = {
|
|
@@ -9,23 +9,33 @@ const replacementSnippetBody = (appId, baseUrl, contentUrl) =>
|
|
|
9
9
|
forcePurpleImplUsage: true
|
|
10
10
|
};
|
|
11
11
|
</script>
|
|
12
|
+
<script>
|
|
13
|
+
globalThis.FUSE_PLATFORM = 'PLATFORM'
|
|
14
|
+
</script>
|
|
12
15
|
<script type="module" src="/assets/preview-inject-bundle.js"></script>
|
|
13
16
|
<script type="module" src="/assets/live-reload.js"></script>
|
|
14
17
|
</body>`
|
|
15
18
|
.replace("APP_ID", appId)
|
|
16
19
|
.replace("BASE_URL", baseUrl)
|
|
17
|
-
.replace("CONTENT_URL", contentUrl)
|
|
20
|
+
.replace("CONTENT_URL", contentUrl)
|
|
21
|
+
.replace("'PLATFORM'", `'${platform}'`);
|
|
18
22
|
|
|
19
23
|
const occurrenceSnippetHead = "</head>";
|
|
20
24
|
const replacementSnippetHead = `
|
|
21
25
|
<link rel="stylesheet" href="/theme.css" />
|
|
22
26
|
</head>`;
|
|
23
27
|
|
|
24
|
-
export const updateIndexHtml = (
|
|
28
|
+
export const updateIndexHtml = (
|
|
29
|
+
content,
|
|
30
|
+
appId,
|
|
31
|
+
baseUrl,
|
|
32
|
+
contentUrl,
|
|
33
|
+
platform
|
|
34
|
+
) => {
|
|
25
35
|
return content
|
|
26
36
|
.replace(
|
|
27
37
|
occurrenceSnippetBody,
|
|
28
|
-
replacementSnippetBody(appId, baseUrl, contentUrl)
|
|
38
|
+
replacementSnippetBody(appId, baseUrl, contentUrl, platform)
|
|
29
39
|
)
|
|
30
40
|
.replace(occurrenceSnippetHead, replacementSnippetHead);
|
|
31
41
|
};
|