express-fix-any-js 1.28.7 → 1.30.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.
Files changed (39) hide show
  1. package/bin/v29/checkFile.js +15 -0
  2. package/bin/{v27 → v29}/hookFolder/forImportLine/index.js +6 -13
  3. package/bin/{v28 → v29}/hookFolder/start.js +6 -7
  4. package/bin/v29/returnPath.js +11 -0
  5. package/bin/v29/start.js +42 -0
  6. package/bin/v30/checkFile.js +15 -0
  7. package/bin/{v28 → v30}/hookFolder/forImportLine/index.js +3 -14
  8. package/bin/{v28/alterFile → v30/hookFolder}/insertLine/index.js +4 -6
  9. package/bin/v30/hookFolder/start.js +27 -0
  10. package/bin/v30/returnPath.js +11 -0
  11. package/bin/v30/start.js +42 -0
  12. package/package.json +1 -2
  13. package/bin/v27/fileNames.json +0 -35
  14. package/bin/v27/hookFolder/start.js +0 -28
  15. package/bin/v27/start.js +0 -25
  16. package/bin/v28/start.js +0 -25
  17. /package/bin/{v27 → v29}/alterFile/forImportLine/index.js +0 -0
  18. /package/bin/{v27 → v29}/alterFile/forInsertIndex.js +0 -0
  19. /package/bin/{v27 → v29}/alterFile/insertLine/addLines.js +0 -0
  20. /package/bin/{v27 → v29}/alterFile/insertLine/findInsertIndex.js +0 -0
  21. /package/bin/{v27 → v29}/alterFile/insertLine/index.js +0 -0
  22. /package/bin/{v27 → v29}/alterFile/insertLine/writeToFile.js +0 -0
  23. /package/bin/{v27 → v29}/alterFile/start.js +0 -0
  24. /package/bin/{v27 → v29}/hookFolder/forInsertIndex.js +0 -0
  25. /package/bin/{v27 → v29}/hookFolder/insertLine/addLines.js +0 -0
  26. /package/bin/{v27 → v29}/hookFolder/insertLine/findInsertIndex.js +0 -0
  27. /package/bin/{v28 → v29}/hookFolder/insertLine/index.js +0 -0
  28. /package/bin/{v27 → v29}/hookFolder/insertLine/writeToFile.js +0 -0
  29. /package/bin/{v28 → v30}/alterFile/forImportLine/index.js +0 -0
  30. /package/bin/{v28 → v30}/alterFile/forInsertIndex.js +0 -0
  31. /package/bin/{v28 → v30}/alterFile/insertLine/addLines.js +0 -0
  32. /package/bin/{v28 → v30}/alterFile/insertLine/findInsertIndex.js +0 -0
  33. /package/bin/{v27/hookFolder → v30/alterFile}/insertLine/index.js +0 -0
  34. /package/bin/{v28 → v30}/alterFile/insertLine/writeToFile.js +0 -0
  35. /package/bin/{v28 → v30}/alterFile/start.js +0 -0
  36. /package/bin/{v28 → v30}/hookFolder/forInsertIndex.js +0 -0
  37. /package/bin/{v28 → v30}/hookFolder/insertLine/addLines.js +0 -0
  38. /package/bin/{v28 → v30}/hookFolder/insertLine/findInsertIndex.js +0 -0
  39. /package/bin/{v28 → v30}/hookFolder/insertLine/writeToFile.js +0 -0
@@ -0,0 +1,15 @@
1
+ import fs from "fs";
2
+
3
+ const startFunc = (inJsPath) => {
4
+ try {
5
+ if (!fs.existsSync(inJsPath)) return false;
6
+
7
+ return true;
8
+ } catch (error) {
9
+ console.log("error : ", error);
10
+
11
+ return false;
12
+ };
13
+ };
14
+
15
+ export default startFunc;
@@ -1,19 +1,14 @@
1
1
  import fs from "fs";
2
- import path from "path";
3
2
 
4
3
  import defaultFunc from 'pattern-collector-anyjs-story';
5
- import insertLine from "../insertLine/index.js";
6
4
 
7
- import fileNamesJson from '../../fileNames.json' with {type: 'json'};
5
+ import insertLine from "../insertLine/index.js";
8
6
 
9
- const startFunc = ({ inParts, inFileType, inTargetPath,
10
- presentKey, regexKey, templateKey
7
+ const startFunc = ({ inParts, inFileType, inJsPath,
8
+ presentKey, regexKey, templateKey, inConsiderKey
11
9
  }) => {
12
-
13
10
  try {
14
- const localJsPath = path.join(inTargetPath, fileNamesJson[inFileType]?.fileName);
15
-
16
- const fileContent = fs.readFileSync(localJsPath, 'utf8');
11
+ const fileContent = fs.readFileSync(inJsPath, 'utf8');
17
12
 
18
13
  const story = defaultFunc({ fileContent, fileType: inFileType });
19
14
 
@@ -25,7 +20,7 @@ const startFunc = ({ inParts, inFileType, inTargetPath,
25
20
  importRegex: story?.extractRegex?.toInsertIndex?.[inFileType]?.[regexKey],
26
21
  filePath: localJsPath,
27
22
  inTemplate: story?.reverseTemplates?.[templateKey],
28
- inParts
23
+ inParts, inConsiderKey
29
24
  });
30
25
 
31
26
  return fromInsertLine;
@@ -36,6 +31,4 @@ const startFunc = ({ inParts, inFileType, inTargetPath,
36
31
  };
37
32
  };
38
33
 
39
- export default startFunc;
40
-
41
- // startFunc({ folderNameToInsert, fileType });
34
+ export default startFunc;
@@ -1,24 +1,23 @@
1
- import { fileNamesJson as fromNpm } from "pattern-collector-base-files";
2
1
  import forImportLine from "./forImportLine/index.js";
3
2
 
4
3
  const startFunc = ({ inValue, OutValue,
5
- inFileType, inTargetPath }) => {
4
+ inFileType, inJsPath, inFileNameStory }) => {
6
5
 
7
- const fileNamesJson = fromNpm();
6
+ const localFileNameStory = inFileNameStory;
8
7
 
9
8
  const fromImportLine = forImportLine({
10
9
  inFileType, regexKey: "import",
11
10
  templateKey: "importRegex",
12
- inTargetPath, presentKey: "importLines",
13
- inParts: [`${fileNamesJson[inFileType]?.temporaryValue}${inValue}`, inValue],
11
+ inJsPath, presentKey: "importLines",
12
+ inParts: [`${localFileNameStory?.temporaryValue}${inValue}`, inValue],
14
13
  inConsiderKey: "part2"
15
14
  });
16
15
 
17
16
  const fromUseLine = forImportLine({
18
- inParts: [`${fileNamesJson[inFileType]?.temporaryValue}${inValue}`, OutValue],
17
+ inParts: [`${localFileNameStory?.temporaryValue}${inValue}`, OutValue],
19
18
  inFileType, regexKey: "consumption",
20
19
  templateKey: "consumptionRegex",
21
- inTargetPath, presentKey: "useLines",
20
+ inJsPath, presentKey: "useLines",
22
21
  inConsiderKey: "part1"
23
22
  });
24
23
 
@@ -0,0 +1,11 @@
1
+ import path from "path";
2
+
3
+ const startFunc = ({ inTargetPath, inFileNameStory }) => {
4
+ const fileNamesJson = inFileNameStory;
5
+
6
+ const localJsPath = path.join(inTargetPath, fileNamesJson?.fileName);
7
+
8
+ return localJsPath;
9
+ };
10
+
11
+ export default startFunc;
@@ -0,0 +1,42 @@
1
+ import hookFolder from "./hookFolder/start.js";
2
+ import alterFile from "./alterFile/start.js";
3
+
4
+ import { fileNamesJson as fromNpm } from "pattern-collector-base-files";
5
+
6
+ import returnPath from "./returnPath.js";
7
+ import checkFile from "./checkFile.js";
8
+
9
+ const startFunc = ({ inValue, OutValue,
10
+ inFileType, inTargetPath, alterArray }) => {
11
+
12
+ let fromInternal;
13
+ let fromAlterFile;
14
+
15
+ const fileNamesJson = fromNpm();
16
+
17
+ const localFileNameStory = fileNamesJson[inFileType];
18
+ const localJsPath = returnPath({ inFileNameStory: localFileNameStory, inTargetPath });
19
+
20
+ if (!checkFile(localJsPath)) {
21
+ return {
22
+ KTF: false,
23
+ KReason: `file not found : ${localJsPath}`
24
+ }
25
+ };
26
+
27
+ if (inValue && OutValue) {
28
+ fromInternal = hookFolder({
29
+ inValue, OutValue,
30
+ inFileType, inTargetPath
31
+ });
32
+ };
33
+
34
+ fromAlterFile = alterFile({
35
+ alterArray, inFileType, inValue,
36
+ inTargetPath
37
+ });
38
+
39
+ return { fromInternal, fromAlterFile };
40
+ };
41
+
42
+ export default startFunc;
@@ -0,0 +1,15 @@
1
+ import fs from "fs";
2
+
3
+ const startFunc = (inJsPath) => {
4
+ try {
5
+ if (!fs.existsSync(inJsPath)) return false;
6
+
7
+ return true;
8
+ } catch (error) {
9
+ console.log("error : ", error);
10
+
11
+ return false;
12
+ };
13
+ };
14
+
15
+ export default startFunc;
@@ -1,23 +1,14 @@
1
1
  import fs from "fs";
2
- import path from "path";
3
2
 
4
3
  import defaultFunc from 'pattern-collector-anyjs-story';
5
- import { fileNamesJson as fromNpm } from "pattern-collector-base-files";
6
4
 
7
5
  import insertLine from "../insertLine/index.js";
8
6
 
9
- // import fileNamesJson from '../../fileNames.json' with {type: 'json'};
10
-
11
- const startFunc = ({ inParts, inFileType, inTargetPath,
7
+ const startFunc = ({ inParts, inFileType, inJsPath,
12
8
  presentKey, regexKey, templateKey, inConsiderKey
13
9
  }) => {
14
-
15
10
  try {
16
- const fileNamesJson = fromNpm();
17
-
18
- const localJsPath = path.join(inTargetPath, fileNamesJson[inFileType]?.fileName);
19
-
20
- const fileContent = fs.readFileSync(localJsPath, 'utf8');
11
+ const fileContent = fs.readFileSync(inJsPath, 'utf8');
21
12
 
22
13
  const story = defaultFunc({ fileContent, fileType: inFileType });
23
14
 
@@ -40,6 +31,4 @@ const startFunc = ({ inParts, inFileType, inTargetPath,
40
31
  };
41
32
  };
42
33
 
43
- export default startFunc;
44
-
45
- // startFunc({ folderNameToInsert, fileType });
34
+ export default startFunc;
@@ -7,10 +7,12 @@ function build(template, parts) {
7
7
  };
8
8
 
9
9
  const startFunc = ({ linesStory, fileContent, filePath, importRegex, onlyIndexesValues,
10
- presentKey, inTemplate, inParts }) => {
10
+ presentKey, inTemplate, inParts, inConsiderKey }) => {
11
11
 
12
12
  const foundUseLinesStory = linesStory[presentKey].find(element => {
13
- return element.part2 === inParts[1];
13
+ if (inConsiderKey in element) {
14
+ return element[inConsiderKey] === inParts[1];
15
+ };
14
16
  });
15
17
 
16
18
  if (foundUseLinesStory) {
@@ -36,15 +38,11 @@ const startFunc = ({ linesStory, fileContent, filePath, importRegex, onlyIndexes
36
38
  inGapAfter: insertStory?.gapAfter
37
39
  });
38
40
 
39
- // lines.splice(insertAtIndex, 0, newLine);
40
-
41
41
  writeToFile({ fileContent, filePath, lines });
42
42
 
43
43
  return {
44
44
  newLine, inParts
45
45
  };
46
- // fs.writeFileSync(filePath, lines.join(fileContent.includes("\r\n") ? "\r\n" : "\n"));
47
-
48
46
  };
49
47
 
50
48
  export default startFunc;
@@ -0,0 +1,27 @@
1
+ import forImportLine from "./forImportLine/index.js";
2
+
3
+ const startFunc = ({ inValue, OutValue,
4
+ inFileType, inJsPath, inFileNameStory }) => {
5
+
6
+ const localFileNameStory = inFileNameStory;
7
+
8
+ const fromImportLine = forImportLine({
9
+ inFileType, regexKey: "import",
10
+ templateKey: "importRegex",
11
+ inJsPath, presentKey: "importLines",
12
+ inParts: [`${localFileNameStory?.temporaryValue}${inValue}`, inValue],
13
+ inConsiderKey: "part2"
14
+ });
15
+
16
+ const fromUseLine = forImportLine({
17
+ inParts: [`${localFileNameStory?.temporaryValue}${inValue}`, OutValue],
18
+ inFileType, regexKey: "consumption",
19
+ templateKey: "consumptionRegex",
20
+ inJsPath, presentKey: "useLines",
21
+ inConsiderKey: "part1"
22
+ });
23
+
24
+ return { fromImportLine, fromUseLine }
25
+ };
26
+
27
+ export default startFunc;
@@ -0,0 +1,11 @@
1
+ import path from "path";
2
+
3
+ const startFunc = ({ inTargetPath, inFileNameStory }) => {
4
+ const fileNamesJson = inFileNameStory;
5
+
6
+ const localJsPath = path.join(inTargetPath, fileNamesJson?.fileName);
7
+
8
+ return localJsPath;
9
+ };
10
+
11
+ export default startFunc;
@@ -0,0 +1,42 @@
1
+ import hookFolder from "./hookFolder/start.js";
2
+ import alterFile from "./alterFile/start.js";
3
+
4
+ import { fileNamesJson as fromNpm } from "pattern-collector-base-files";
5
+
6
+ import returnPath from "./returnPath.js";
7
+ import checkFile from "./checkFile.js";
8
+
9
+ const startFunc = ({ inValue, OutValue,
10
+ inFileType, inTargetPath, alterArray }) => {
11
+
12
+ let fromInternal;
13
+ let fromAlterFile;
14
+
15
+ const fileNamesJson = fromNpm();
16
+
17
+ const localFileNameStory = fileNamesJson[inFileType];
18
+ const localJsPath = returnPath({ inFileNameStory: localFileNameStory, inTargetPath });
19
+
20
+ if (!checkFile(localJsPath)) {
21
+ return {
22
+ KTF: false,
23
+ KReason: `file not found : ${localJsPath}`
24
+ }
25
+ };
26
+
27
+ if (inValue && OutValue) {
28
+ fromInternal = hookFolder({
29
+ inValue, OutValue,
30
+ inFileType, inTargetPath
31
+ });
32
+ };
33
+
34
+ fromAlterFile = alterFile({
35
+ alterArray, inFileType, inValue,
36
+ inTargetPath
37
+ });
38
+
39
+ return { fromInternal, fromAlterFile };
40
+ };
41
+
42
+ export default startFunc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-fix-any-js",
3
- "version": "1.28.7",
3
+ "version": "1.30.1",
4
4
  "description": "CLI to build for appjs, the endpoints",
5
5
  "keywords": [
6
6
  "cli",
@@ -10,7 +10,6 @@
10
10
  "project-generator"
11
11
  ],
12
12
  "dependencies": {
13
- "express-check-any-for-import": "^1.4.7",
14
13
  "pattern-collector-anyjs-story": "^1.24.9",
15
14
  "pattern-collector-base-files": "^1.3.1"
16
15
  },
@@ -1,35 +0,0 @@
1
- {
2
- "version": "25.2",
3
- "fromAppJs": {
4
- "fileName": "app.js",
5
- "temporaryValue": "routerFrom"
6
- },
7
- "fromRoutesJs": {
8
- "fileName": "routes.js",
9
- "temporaryValue": "routerFrom"
10
- },
11
- "fromRoutesJsEnd": {
12
- "fileName": "routes.js",
13
- "temporaryValue": "routerFrom",
14
- "hookTo": "fromEndPointsJs"
15
- },
16
- "fromEndPointsJs": {
17
- "fileName": "end-points.js",
18
- "temporaryValue": "funcFrom",
19
- "hookTo": "fromControllerJs"
20
- },
21
- "tableGetShowAll": {
22
- "fileName": "end-points.js",
23
- "temporaryValue": "funcFrom",
24
- "hookTo": "fromControllerJs"
25
- },
26
- "tableGetFind": {
27
- "fileName": "end-points.js",
28
- "temporaryValue": "funcFrom",
29
- "hookTo": "fromControllerJs"
30
- },
31
- "fromControllerJs": {
32
- "fileName": "controller.js",
33
- "temporaryValue": "controllerFrom"
34
- }
35
- }
@@ -1,28 +0,0 @@
1
- import { fileNamesJson as fromNpm } from "pattern-collector-base-files";
2
- import forImportLine from "./forImportLine/index.js";
3
-
4
- // import fileNamesJson from '../fileNames.json' with {type: 'json'};
5
-
6
- const startFunc = ({ inValue, OutValue,
7
- inFileType, inTargetPath }) => {
8
-
9
- const fileNamesJson = fromNpm();
10
-
11
- const fromImportLine = forImportLine({
12
- inFileType, regexKey: "import",
13
- templateKey: "importRegex",
14
- inTargetPath, presentKey: "importLines",
15
- inParts: [`${fileNamesJson[inFileType]?.temporaryValue}${inValue}`, inValue]
16
- });
17
-
18
- const fromUseLine = forImportLine({
19
- inParts: [`${fileNamesJson[inFileType]?.temporaryValue}${inValue}`, OutValue],
20
- inFileType, regexKey: "consumption",
21
- templateKey: "consumptionRegex",
22
- inTargetPath, presentKey: "useLines"
23
- });
24
-
25
- return { fromImportLine, fromUseLine }
26
- };
27
-
28
- export default startFunc;
package/bin/v27/start.js DELETED
@@ -1,25 +0,0 @@
1
- import hookFolder from "./hookFolder/start.js";
2
- import alterFile from "./alterFile/start.js";
3
-
4
- const startFunc = ({ inValue, OutValue,
5
- inFileType, jsFilePath, inTargetPath, alterArray }) => {
6
-
7
- let fromInternal;
8
- let fromAlterFile;
9
-
10
- if (inValue && OutValue) {
11
- fromInternal = hookFolder({
12
- inValue, OutValue,
13
- inFileType, inTargetPath
14
- });
15
- };
16
-
17
- fromAlterFile = alterFile({
18
- alterArray, inFileType, inValue,
19
- inTargetPath
20
- });
21
-
22
- return { fromInternal, fromAlterFile };
23
- };
24
-
25
- export default startFunc;
package/bin/v28/start.js DELETED
@@ -1,25 +0,0 @@
1
- import hookFolder from "./hookFolder/start.js";
2
- import alterFile from "./alterFile/start.js";
3
-
4
- const startFunc = ({ inValue, OutValue,
5
- inFileType, jsFilePath, inTargetPath, alterArray }) => {
6
-
7
- let fromInternal;
8
- let fromAlterFile;
9
-
10
- if (inValue && OutValue) {
11
- fromInternal = hookFolder({
12
- inValue, OutValue,
13
- inFileType, inTargetPath
14
- });
15
- };
16
-
17
- fromAlterFile = alterFile({
18
- alterArray, inFileType, inValue,
19
- inTargetPath
20
- });
21
-
22
- return { fromInternal, fromAlterFile };
23
- };
24
-
25
- export default startFunc;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes