@ejfdelgado/ejflab-common 1.5.3 → 1.5.4
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 +1 -1
- package/src/changePath.js +13 -9
package/package.json
CHANGED
package/src/changePath.js
CHANGED
|
@@ -21,15 +21,19 @@ const HTML_PATHS = [
|
|
|
21
21
|
];
|
|
22
22
|
|
|
23
23
|
// Search bundle reference
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
if (fs.existsSync(DIST_DIR)) {
|
|
25
|
+
const fileList = fs.readdirSync(DIST_DIR).filter((fileName) => {
|
|
26
|
+
return /^main\./.exec(fileName) != null;
|
|
27
|
+
});
|
|
28
|
+
if (fileList.length > 0) {
|
|
29
|
+
FILE_PATHS.push(`${DIST_DIR}/${fileList[0]}`);
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
console.log(`Warning: folder ${DIST_DIR} does not exists!`);
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
function changeSimpleFile(filePath) {
|
|
32
|
-
console.log(`
|
|
36
|
+
console.log(`Trying ${filePath}...`);
|
|
33
37
|
// Read content
|
|
34
38
|
if (fs.existsSync(filePath)) {
|
|
35
39
|
let myConstantsContent = fs.readFileSync(filePath, { encoding: "utf8" });
|
|
@@ -39,7 +43,7 @@ function changeSimpleFile(filePath) {
|
|
|
39
43
|
fs.writeFileSync(filePath, myConstantsContent, { encoding: "utf8" });
|
|
40
44
|
//console.log(myConstantsContent);
|
|
41
45
|
} else {
|
|
42
|
-
console.log(`
|
|
46
|
+
console.log(`Warning: ${filePath} dont exists! continue...`);
|
|
43
47
|
}
|
|
44
48
|
}
|
|
45
49
|
|
|
@@ -49,7 +53,7 @@ for (let i = 0; i < FILE_PATHS.length; i++) {
|
|
|
49
53
|
|
|
50
54
|
// Change also the html
|
|
51
55
|
function changeHtmlTag(filePath) {
|
|
52
|
-
console.log(`
|
|
56
|
+
console.log(`Trying ${filePath}...`);
|
|
53
57
|
// Read content
|
|
54
58
|
if (fs.existsSync(filePath)) {
|
|
55
59
|
let myConstantsContent = fs.readFileSync(filePath, { encoding: "utf8" });
|
|
@@ -59,7 +63,7 @@ function changeHtmlTag(filePath) {
|
|
|
59
63
|
fs.writeFileSync(filePath, myConstantsContent, { encoding: "utf8" });
|
|
60
64
|
//console.log(myConstantsContent);
|
|
61
65
|
} else {
|
|
62
|
-
console.log(`
|
|
66
|
+
console.log(`Warning: ${filePath} dont exists! continue...`);
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
|