@pronto-tools-and-more/pronto 10.13.0 → 10.14.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/pronto",
3
- "version": "10.13.0",
3
+ "version": "10.14.0",
4
4
  "description": "",
5
5
  "main": "src/main.js",
6
6
  "type": "module",
@@ -17,16 +17,16 @@
17
17
  "@lvce-editor/ipc": "^11.3.0",
18
18
  "@lvce-editor/json-rpc": "^5.2.0",
19
19
  "@lvce-editor/verror": "^1.6.0",
20
- "@pronto-tools-and-more/file-watcher": "10.13.0",
21
- "@pronto-tools-and-more/files": "10.13.0",
22
- "@pronto-tools-and-more/network-process": "10.13.0",
23
- "@pronto-tools-and-more/sass-compiler": "10.13.0",
24
- "@pronto-tools-and-more/components-renderer": "10.13.0",
25
- "@pronto-tools-and-more/components": "10.13.0",
26
- "@pronto-tools-and-more/schema-process": "10.13.0",
27
- "@pronto-tools-and-more/diff-process": "10.13.0",
28
- "@pronto-tools-and-more/type-checker": "10.13.0",
29
- "@pronto-tools-and-more/custom-js-functions": "10.13.0",
20
+ "@pronto-tools-and-more/file-watcher": "10.14.0",
21
+ "@pronto-tools-and-more/files": "10.14.0",
22
+ "@pronto-tools-and-more/network-process": "10.14.0",
23
+ "@pronto-tools-and-more/sass-compiler": "10.14.0",
24
+ "@pronto-tools-and-more/components-renderer": "10.14.0",
25
+ "@pronto-tools-and-more/components": "10.14.0",
26
+ "@pronto-tools-and-more/schema-process": "10.14.0",
27
+ "@pronto-tools-and-more/diff-process": "10.14.0",
28
+ "@pronto-tools-and-more/type-checker": "10.14.0",
29
+ "@pronto-tools-and-more/custom-js-functions": "10.14.0",
30
30
  "execa": "^9.5.1",
31
31
  "express": "^4.21.1"
32
32
  },
@@ -9,6 +9,7 @@ import * as FilesPath from "../FilesPath/FilesPath.js";
9
9
  import * as GetViewsResponse from "../GetViewsResponse/GetViewsResponse.js";
10
10
  import * as SassProcess from "../SassProcess/SassProcess.js";
11
11
  import * as ValidateAllSchemas from "../ValidateAllSchemas/ValidateAllSchemas.js";
12
+ import * as GetCustomServerJsContent from "../GetCustomServerJsContent/GetCustomServerJsContent.js";
12
13
 
13
14
  const sourceMap = false;
14
15
 
@@ -64,6 +65,30 @@ export const build = async () => {
64
65
  await mkdir(dirname(viewsPath), { recursive: true });
65
66
  await writeFile(viewsPath, viewsResponse);
66
67
  }
68
+ if (Config.injectCustomJs) {
69
+ const newContent =
70
+ await GetCustomServerJsContent.getCustomServerJsContent({
71
+ customServerJsPath: join(
72
+ Cwd.cwd,
73
+ "src",
74
+ "default",
75
+ "storefront",
76
+ "assets",
77
+ "scripts",
78
+ "custom.server.js"
79
+ ),
80
+ });
81
+ const customServrJsPathDist = join(
82
+ dist,
83
+ "src",
84
+ "default",
85
+ "storefront",
86
+ "assets",
87
+ "scripts",
88
+ "custom.server.js"
89
+ );
90
+ await writeFile(customServrJsPathDist, newContent);
91
+ }
67
92
  if (Config.validateSchema) {
68
93
  await ValidateAllSchemas.validateAllSchemas();
69
94
  }
@@ -0,0 +1,13 @@
1
+ import { readFile } from "fs/promises";
2
+ import * as CustomJsFunctionsPath from "../CustomJsFunctionsPath/CustomJsFunctionsPath.js";
3
+
4
+ export const getCustomServerJsContent = async ({ customServerJsPath }) => {
5
+ const baseContent = await readFile(customServerJsPath, "utf8");
6
+ const injectedContent = await readFile(
7
+ CustomJsFunctionsPath.customJsFunctionsPath,
8
+ "utf8"
9
+ );
10
+ const merged =
11
+ baseContent + `\n\n\n// pronto injected code\n\n\n` + injectedContent;
12
+ return merged;
13
+ };
@@ -1,19 +1,7 @@
1
- import { createReadStream, existsSync } from "fs";
2
- import { readFile } from "fs/promises";
1
+ import { createReadStream } from "fs";
3
2
  import { join } from "path";
4
3
  import { pipeline } from "stream/promises";
5
- import * as CustomJsFunctionsPath from "../CustomJsFunctionsPath/CustomJsFunctionsPath.js";
6
-
7
- const getCustomServerJsContent = async ({ customServerJsPath }) => {
8
- const baseContent = await readFile(customServerJsPath, "utf8");
9
- const injectedContent = await readFile(
10
- CustomJsFunctionsPath.customJsFunctionsPath,
11
- "utf8"
12
- );
13
- const merged =
14
- baseContent + `\n\n\n// pronto injected code\n\n\n` + injectedContent;
15
- return merged;
16
- };
4
+ import * as GetCustomServerJsContent from "../GetCustomServerJsContent/GetCustomServerJsContent.js";
17
5
 
18
6
  export const handleCustomServerJs =
19
7
  ({ storeFrontPath, filesPath, injectCustomJs }) =>
@@ -26,7 +14,9 @@ export const handleCustomServerJs =
26
14
  "custom.server.js"
27
15
  );
28
16
  if (injectCustomJs) {
29
- const content = await getCustomServerJsContent({ customServerJsPath });
17
+ const content = await GetCustomServerJsContent.getCustomServerJsContent(
18
+ { customServerJsPath }
19
+ );
30
20
  res.end(content);
31
21
  } else {
32
22
  await pipeline(createReadStream(customServerJsPath), res);
@@ -1 +1 @@
1
- export const version = '10.13.0'
1
+ export const version = '10.14.0'