@pronto-tools-and-more/pronto 3.4.0 → 3.5.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 +5 -5
- package/src/parts/ChangeWatcher/ChangeWatcher.js +4 -4
- package/src/parts/Config/Config.js +2 -1
- package/src/parts/CreateServer/CreateServer.js +7 -2
- package/src/parts/HandleFileChange/HandleFileChange.js +7 -2
- package/src/parts/SendSassUpdates/SendSassUpdates.js +7 -2
- package/src/parts/Server/Server.js +7 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pronto-tools-and-more/pronto",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.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.5.0",
|
|
17
|
+
"@pronto-tools-and-more/files": "3.5.0",
|
|
18
|
+
"@pronto-tools-and-more/network-process": "3.5.0",
|
|
19
|
+
"@pronto-tools-and-more/sass-compiler": "3.5.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",
|
|
@@ -14,7 +14,7 @@ const canHandle = (data) => {
|
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const handleData = async (clients, chunks, data) => {
|
|
17
|
+
const handleData = async (clients, chunks, data, errorColor) => {
|
|
18
18
|
chunks.push(data);
|
|
19
19
|
const buffer = Buffer.concat(chunks);
|
|
20
20
|
const parsed = canHandle(buffer);
|
|
@@ -25,10 +25,10 @@ const handleData = async (clients, chunks, data) => {
|
|
|
25
25
|
const uri = parsed.params[0];
|
|
26
26
|
const path = fileURLToPath(uri);
|
|
27
27
|
const content = parsed.params[1];
|
|
28
|
-
await SendSassUpdates.sendSassUpdates(clients, path, content);
|
|
28
|
+
await SendSassUpdates.sendSassUpdates(clients, path, content, errorColor);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
export const create = async (webSocketServer) => {
|
|
31
|
+
export const create = async (webSocketServer, errorColor) => {
|
|
32
32
|
try {
|
|
33
33
|
await rm(SOCKET_FILE, { force: true });
|
|
34
34
|
|
|
@@ -39,7 +39,7 @@ export const create = async (webSocketServer) => {
|
|
|
39
39
|
const handleConnection = (connection) => {
|
|
40
40
|
const chunks = [];
|
|
41
41
|
connection.on("data", (data) => {
|
|
42
|
-
handleData(webSocketServer.clients, chunks, data);
|
|
42
|
+
handleData(webSocketServer.clients, chunks, data, errorColor);
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "fs";
|
|
1
2
|
import { join } from "path";
|
|
2
3
|
import * as Cwd from "../Cwd/Cwd.js";
|
|
3
|
-
import { existsSync, readFileSync } from "fs";
|
|
4
4
|
|
|
5
5
|
export const userEmail = process.env.PRONTO_USER_EMAIL;
|
|
6
6
|
export const userPassword = process.env.PRONTO_USER_PASSWORD;
|
|
@@ -35,6 +35,7 @@ export const uploadTimeout = 120000;
|
|
|
35
35
|
export const baseUrl = config.baseUrl || "https://purplemanager.com/delivery";
|
|
36
36
|
export const contentUrl =
|
|
37
37
|
config.contentUrl || "https://catalog.purplemanager.com";
|
|
38
|
+
export const errorColor = config.errorColor || "red";
|
|
38
39
|
|
|
39
40
|
export const rootSassFile = join(
|
|
40
41
|
Cwd.cwd,
|
|
@@ -7,7 +7,7 @@ import * as FileWatcher from "../FileWatcher/FileWatcher.js";
|
|
|
7
7
|
import * as HandleFileChange from "../HandleFileChange/HandleFileChange.js";
|
|
8
8
|
import { join } from "node:path";
|
|
9
9
|
|
|
10
|
-
export const createServer = async (root) => {
|
|
10
|
+
export const createServer = async (root, errorColor) => {
|
|
11
11
|
Assert.string(root);
|
|
12
12
|
const app = App.create(root);
|
|
13
13
|
const server = http.createServer(app);
|
|
@@ -15,7 +15,12 @@ export const createServer = async (root) => {
|
|
|
15
15
|
server,
|
|
16
16
|
});
|
|
17
17
|
const handleFileChange = (event) => {
|
|
18
|
-
HandleFileChange.handleFileChange(
|
|
18
|
+
HandleFileChange.handleFileChange(
|
|
19
|
+
webSocketServer.clients,
|
|
20
|
+
event,
|
|
21
|
+
root,
|
|
22
|
+
errorColor
|
|
23
|
+
);
|
|
19
24
|
};
|
|
20
25
|
const src = join(root, "src");
|
|
21
26
|
FileWatcher.create(src, handleFileChange);
|
|
@@ -2,10 +2,15 @@ import { join } from "node:path";
|
|
|
2
2
|
import * as SendFullUpdates from "../SendFullUpdates/SendFullUpdates.js";
|
|
3
3
|
import * as SendSassUpdates from "../SendSassUpdates/SendSassUpdates.js";
|
|
4
4
|
|
|
5
|
-
export const handleFileChange = (clients, event, root) => {
|
|
5
|
+
export const handleFileChange = (clients, event, root, errorColor) => {
|
|
6
6
|
if (event.filename.endsWith(".scss")) {
|
|
7
7
|
const absolutePath = join(root, event.filename);
|
|
8
|
-
SendSassUpdates.sendSassUpdates(
|
|
8
|
+
SendSassUpdates.sendSassUpdates(
|
|
9
|
+
clients,
|
|
10
|
+
absolutePath,
|
|
11
|
+
undefined,
|
|
12
|
+
errorColor
|
|
13
|
+
);
|
|
9
14
|
} else {
|
|
10
15
|
SendFullUpdates.sendFullUpdates(clients);
|
|
11
16
|
}
|
|
@@ -17,7 +17,12 @@ const needsFullCompile = (clients) => {
|
|
|
17
17
|
return false;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export const sendSassUpdates = async (
|
|
20
|
+
export const sendSassUpdates = async (
|
|
21
|
+
clients,
|
|
22
|
+
fileName,
|
|
23
|
+
content,
|
|
24
|
+
errorColor
|
|
25
|
+
) => {
|
|
21
26
|
try {
|
|
22
27
|
const needsFull = needsFullCompile(clients);
|
|
23
28
|
const changes = await CompileSassIndividually.compileSassIndividually(
|
|
@@ -44,7 +49,7 @@ export const sendSassUpdates = async (clients, fileName, content) => {
|
|
|
44
49
|
SendUpdates.sendUpdates(clients, {
|
|
45
50
|
jsonrpc: "2.0",
|
|
46
51
|
method: "updateCssError",
|
|
47
|
-
params: [`${error}`],
|
|
52
|
+
params: [errorColor, `${error}`],
|
|
48
53
|
});
|
|
49
54
|
}
|
|
50
55
|
};
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import * as Config from "../Config/Config.js";
|
|
1
2
|
import * as CreateServer from "../CreateServer/CreateServer.js";
|
|
2
3
|
import * as Promises from "../Promises/Promises.js";
|
|
3
4
|
|
|
4
|
-
export const start = async (
|
|
5
|
-
|
|
5
|
+
export const start = async (
|
|
6
|
+
root = process.cwd(),
|
|
7
|
+
port = 3000,
|
|
8
|
+
errorColor = Config.errorColor
|
|
9
|
+
) => {
|
|
10
|
+
const server = await CreateServer.createServer(root, errorColor);
|
|
6
11
|
const { resolve, promise } = Promises.withResolvers();
|
|
7
12
|
server.listen(port, resolve);
|
|
8
13
|
await promise;
|