@ejfdelgado/ejflab-common 1.2.1 → 1.2.3

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.
Files changed (2) hide show
  1. package/package.json +5 -3
  2. package/src/changePath.js +10 -6
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ejfdelgado/ejflab-common",
3
3
  "type": "commonjs",
4
- "version": "1.2.1",
4
+ "version": "1.2.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ejfdelgado/ejflab-common.git"
@@ -9,7 +9,9 @@
9
9
  "description": "",
10
10
  "scripts": {
11
11
  "mylogin": "npm login",
12
- "mypublish": "npm publish --access=public"
12
+ "mypublish": "npm publish --access=public",
13
+ "diff": "unset GTK_PATH && git difftool",
14
+ "clean": "rm -rf node_modules && npm cache clean --force && rm package-lock.json && npm install"
13
15
  },
14
16
  "engines": {
15
17
  "node": ">=14.0.0"
@@ -28,4 +30,4 @@
28
30
  "node-rsa": "^1.1.1",
29
31
  "phin": "^3.7.1"
30
32
  }
31
- }
33
+ }
package/src/changePath.js CHANGED
@@ -28,12 +28,16 @@ if (fileList.length > 0) {
28
28
  function changeSimpleFile(filePath) {
29
29
  console.log(`Modifiying ${filePath}...`);
30
30
  // Read content
31
- let myConstantsContent = fs.readFileSync(filePath, { encoding: "utf8" });
32
- // Change content
33
- myConstantsContent = myConstantsContent.replaceAll(/(static\s*SRV_ROOT\s*=\s*)[^;]+;/ig, `$1"${NODE_SERVER_PATH}";`);
34
- // Write content
35
- fs.writeFileSync(filePath, myConstantsContent, { encoding: "utf8" });
36
- //console.log(myConstantsContent);
31
+ if (fs.existsSync(filePath)) {
32
+ let myConstantsContent = fs.readFileSync(filePath, { encoding: "utf8" });
33
+ // Change content
34
+ myConstantsContent = myConstantsContent.replaceAll(/(static\s*SRV_ROOT\s*=\s*)[^;]+;/ig, `$1"${NODE_SERVER_PATH}";`);
35
+ // Write content
36
+ fs.writeFileSync(filePath, myConstantsContent, { encoding: "utf8" });
37
+ //console.log(myConstantsContent);
38
+ } else {
39
+ console.log(`Error ${filePath} dont exists! continue...`);
40
+ }
37
41
  }
38
42
 
39
43
  for (let i = 0; i < FILE_PATHS.length; i++) {