@ejfdelgado/ejflab-common 1.2.1 → 1.2.2

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 +1 -1
  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.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ejfdelgado/ejflab-common.git"
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++) {