express-fix-any-js 1.24.4 → 1.25.1
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/bin/v25/alterFile/start.js +41 -0
- package/bin/v25/fileNames.json +19 -0
- package/bin/{v23 → v25}/hookFolder/forImportLine/index.js +1 -1
- package/bin/{v23 → v25}/hookFolder/start.js +5 -3
- package/bin/{v23 → v25}/start.js +7 -4
- package/package.json +1 -1
- package/bin/v23/alterFile/start.js +0 -28
- package/bin/v23/fileNames.json +0 -6
- /package/bin/{v23 → v25}/alterFile/forImportLine/index.js +0 -0
- /package/bin/{v23 → v25}/alterFile/forInsertIndex.js +0 -0
- /package/bin/{v23 → v25}/alterFile/insertLine/addLines.js +0 -0
- /package/bin/{v23 → v25}/alterFile/insertLine/findInsertIndex.js +0 -0
- /package/bin/{v23 → v25}/alterFile/insertLine/index.js +0 -0
- /package/bin/{v23 → v25}/alterFile/insertLine/writeToFile.js +0 -0
- /package/bin/{v23 → v25}/hookFolder/forInsertIndex.js +0 -0
- /package/bin/{v23 → v25}/hookFolder/insertLine/addLines.js +0 -0
- /package/bin/{v23 → v25}/hookFolder/insertLine/findInsertIndex.js +0 -0
- /package/bin/{v23 → v25}/hookFolder/insertLine/index.js +0 -0
- /package/bin/{v23 → v25}/hookFolder/insertLine/writeToFile.js +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
import fileNamesJson from '../fileNames.json' with {type: 'json'};
|
|
5
|
+
|
|
6
|
+
const startFunc = ({ alterArray, inFileType, inTargetPath, inValue }) => {
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
if (!inFileType in fileNamesJson) {
|
|
10
|
+
return false;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
if (!"hookTo" in fileNamesJson[inFileType]) {
|
|
14
|
+
return false;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
if (!"fileName" in fileNamesJson[fileNamesJson[inFileType]?.hookTo]) {
|
|
18
|
+
return false;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const jsFileName = fileNamesJson[fileNamesJson[inFileType]?.hookTo]?.fileName;
|
|
22
|
+
|
|
23
|
+
const localJsPath = path.join(inTargetPath, inValue, jsFileName);
|
|
24
|
+
|
|
25
|
+
let fileContent = fs.readFileSync(localJsPath, 'utf8');
|
|
26
|
+
|
|
27
|
+
alterArray.forEach(element => {
|
|
28
|
+
fileContent = fileContent.replaceAll(element.key, element.value);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
fs.writeFileSync(localJsPath, fileContent);
|
|
32
|
+
|
|
33
|
+
return true;
|
|
34
|
+
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.log("error : ", error);
|
|
37
|
+
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default startFunc;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"fromAppJs": {
|
|
3
|
+
"fileName": "app.js",
|
|
4
|
+
"temporaryValue": "routerFrom"
|
|
5
|
+
},
|
|
6
|
+
"fromRoutesJs": {
|
|
7
|
+
"fileName": "routes.js",
|
|
8
|
+
"temporaryValue": "routerFrom"
|
|
9
|
+
},
|
|
10
|
+
"fromRoutesJsEnd": {
|
|
11
|
+
"fileName": "routes.js",
|
|
12
|
+
"temporaryValue": "routerFrom",
|
|
13
|
+
"hookTo": "fromEndPointsJs"
|
|
14
|
+
},
|
|
15
|
+
"fromEndPointsJs": {
|
|
16
|
+
"fileName": "end-points.js",
|
|
17
|
+
"temporaryValue": "funcFrom"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -11,7 +11,7 @@ const startFunc = ({ inParts, inFileType, inTargetPath,
|
|
|
11
11
|
}) => {
|
|
12
12
|
|
|
13
13
|
try {
|
|
14
|
-
const localJsPath = path.join(inTargetPath, fileNamesJson[inFileType]);
|
|
14
|
+
const localJsPath = path.join(inTargetPath, fileNamesJson[inFileType]?.fileName);
|
|
15
15
|
|
|
16
16
|
const fileContent = fs.readFileSync(localJsPath, 'utf8');
|
|
17
17
|
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import forImportLine from "./forImportLine/index.js";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import fileNamesJson from '../fileNames.json' with {type: 'json'};
|
|
4
|
+
|
|
5
|
+
const startFunc = ({ inValue, OutValue,
|
|
4
6
|
inFileType, inTargetPath }) => {
|
|
5
7
|
|
|
6
8
|
const fromImportLine = forImportLine({
|
|
7
9
|
inFileType, regexKey: "import",
|
|
8
10
|
templateKey: "importRegex",
|
|
9
11
|
inTargetPath, presentKey: "importLines",
|
|
10
|
-
inParts: [temporaryValue
|
|
12
|
+
inParts: [`${fileNamesJson[inFileType]?.temporaryValue}${inValue}`, inValue]
|
|
11
13
|
});
|
|
12
14
|
|
|
13
15
|
const fromUseLine = forImportLine({
|
|
14
|
-
inParts: [temporaryValue
|
|
16
|
+
inParts: [`${fileNamesJson[inFileType]?.temporaryValue}${inValue}`, OutValue],
|
|
15
17
|
inFileType, regexKey: "consumption",
|
|
16
18
|
templateKey: "consumptionRegex",
|
|
17
19
|
inTargetPath, presentKey: "useLines"
|
package/bin/{v23 → v25}/start.js
RENAMED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import hookFolder from "./hookFolder/start.js";
|
|
2
2
|
import alterFile from "./alterFile/start.js";
|
|
3
3
|
|
|
4
|
-
const startFunc = ({ inValue,
|
|
4
|
+
const startFunc = ({ inValue, OutValue,
|
|
5
5
|
inFileType, jsFilePath, inTargetPath, alterArray }) => {
|
|
6
6
|
|
|
7
7
|
let fromInternal;
|
|
8
8
|
let fromAlterFile;
|
|
9
9
|
|
|
10
|
-
if (inValue &&
|
|
10
|
+
if (inValue && OutValue) {
|
|
11
11
|
fromInternal = hookFolder({
|
|
12
|
-
inValue,
|
|
12
|
+
inValue, OutValue,
|
|
13
13
|
inFileType, inTargetPath
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
fromAlterFile = alterFile({
|
|
17
|
+
fromAlterFile = alterFile({
|
|
18
|
+
alterArray, inFileType, inValue,
|
|
19
|
+
inTargetPath
|
|
20
|
+
});
|
|
18
21
|
|
|
19
22
|
return { fromInternal, fromAlterFile };
|
|
20
23
|
};
|
package/package.json
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
|
|
4
|
-
import fileNamesJson from '../fileNames.json' with {type: 'json'};
|
|
5
|
-
|
|
6
|
-
const startFunc = ({ alterArray, inFileType, inTargetPath
|
|
7
|
-
}) => {
|
|
8
|
-
|
|
9
|
-
try {
|
|
10
|
-
const localJsPath = path.join(inTargetPath, fileNamesJson[inFileType]);
|
|
11
|
-
|
|
12
|
-
let fileContent = fs.readFileSync(localJsPath, 'utf8');
|
|
13
|
-
|
|
14
|
-
alterArray.forEach(element => {
|
|
15
|
-
fileContent = fileContent.replaceAll(element.key, element.value);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
fs.writeFileSync(localJsPath, fileContent);
|
|
19
|
-
|
|
20
|
-
return true;
|
|
21
|
-
|
|
22
|
-
} catch (error) {
|
|
23
|
-
console.log("error : ", error);
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default startFunc;
|
package/bin/v23/fileNames.json
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|