@ejfdelgado/ejflab-common 1.2.0 → 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 +14 -7
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ejfdelgado/ejflab-common",
3
3
  "type": "commonjs",
4
- "version": "1.2.0",
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
@@ -12,7 +12,10 @@ if (!NODE_SERVER_PATH) {
12
12
  return;
13
13
  }
14
14
  const DIST_DIR = "./dist/bundle";
15
- const FILE_PATHS = ["./node_modules/@ejfdelgado/ejflab-common/src/MyConstants.js"];
15
+ const FILE_PATHS = [
16
+ "./node_modules/@ejfdelgado/ejflab-common/src/MyConstants.js",
17
+ "./node_modules/@ejfdelgado/ejflab-back/node_modules/@ejfdelgado/ejflab-common/src/MyConstants.js"
18
+ ];
16
19
 
17
20
  // Search bundle reference
18
21
  const fileList = fs.readdirSync(DIST_DIR).filter((fileName) => {
@@ -25,12 +28,16 @@ if (fileList.length > 0) {
25
28
  function changeSimpleFile(filePath) {
26
29
  console.log(`Modifiying ${filePath}...`);
27
30
  // Read content
28
- let myConstantsContent = fs.readFileSync(filePath, { encoding: "utf8" });
29
- // Change content
30
- myConstantsContent = myConstantsContent.replaceAll(/(static\s*SRV_ROOT\s*=\s*)[^;]+;/ig, `$1"${NODE_SERVER_PATH}";`);
31
- // Write content
32
- fs.writeFileSync(filePath, myConstantsContent, { encoding: "utf8" });
33
- //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
+ }
34
41
  }
35
42
 
36
43
  for (let i = 0; i < FILE_PATHS.length; i++) {