express-fix-any-js 1.26.2 → 1.28.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 (39) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +88 -88
  3. package/bin/cli.js +11 -11
  4. package/bin/core/getLatestVersion.js +12 -12
  5. package/bin/core/loadRunner.js +8 -8
  6. package/bin/{v25 → v27}/alterFile/forImportLine/index.js +40 -40
  7. package/bin/{v26/hookFolder → v27/alterFile}/forInsertIndex.js +29 -29
  8. package/bin/{v26 → v27}/alterFile/insertLine/addLines.js +15 -15
  9. package/bin/{v25/hookFolder → v27/alterFile}/insertLine/findInsertIndex.js +37 -37
  10. package/bin/{v25/hookFolder → v27/alterFile}/insertLine/index.js +49 -49
  11. package/bin/{v25 → v27}/alterFile/insertLine/writeToFile.js +7 -7
  12. package/bin/{v26 → v27}/alterFile/start.js +44 -44
  13. package/bin/{v25 → v27}/fileNames.json +34 -34
  14. package/bin/{v26 → v27}/hookFolder/forImportLine/index.js +40 -40
  15. package/bin/{v25/alterFile → v27/hookFolder}/forInsertIndex.js +29 -29
  16. package/bin/{v25 → v27}/hookFolder/insertLine/addLines.js +15 -15
  17. package/bin/{v26 → v27}/hookFolder/insertLine/findInsertIndex.js +37 -37
  18. package/bin/{v26/alterFile → v27/hookFolder}/insertLine/index.js +49 -49
  19. package/bin/{v26/alterFile → v27/hookFolder}/insertLine/writeToFile.js +7 -7
  20. package/bin/{v26 → v27}/hookFolder/start.js +27 -27
  21. package/bin/{v25 → v27}/start.js +24 -24
  22. package/bin/{v26 → v28}/alterFile/forImportLine/index.js +40 -40
  23. package/bin/{v25/hookFolder → v28/alterFile}/forInsertIndex.js +29 -29
  24. package/bin/{v25 → v28}/alterFile/insertLine/addLines.js +15 -15
  25. package/bin/{v26 → v28}/alterFile/insertLine/findInsertIndex.js +37 -37
  26. package/bin/{v25 → v28}/alterFile/insertLine/index.js +49 -49
  27. package/bin/{v26/hookFolder → v28/alterFile}/insertLine/writeToFile.js +7 -7
  28. package/bin/{v25 → v28}/alterFile/start.js +44 -40
  29. package/bin/{v25 → v28}/hookFolder/forImportLine/index.js +44 -40
  30. package/bin/{v26/alterFile → v28/hookFolder}/forInsertIndex.js +29 -29
  31. package/bin/{v26 → v28}/hookFolder/insertLine/addLines.js +15 -15
  32. package/bin/{v25/alterFile → v28/hookFolder}/insertLine/findInsertIndex.js +37 -37
  33. package/bin/{v26 → v28}/hookFolder/insertLine/index.js +47 -49
  34. package/bin/{v25 → v28}/hookFolder/insertLine/writeToFile.js +7 -7
  35. package/bin/{v25 → v28}/hookFolder/start.js +27 -24
  36. package/bin/{v26 → v28}/start.js +24 -24
  37. package/index.js +13 -13
  38. package/package.json +37 -37
  39. package/bin/v26/fileNames.json +0 -35
@@ -1,38 +1,38 @@
1
- const startFunc = ({ onlyIndexesValues, importRegex, presentKey }) => {
2
- const insertStory = {};
3
-
4
- if (!importRegex) {
5
- return insertStory;
6
- };
7
-
8
- // Try each preferred location until one exists.
9
- for (const preference of importRegex) {
10
-
11
- const [group, property] = preference.split(".");
12
-
13
- // Preference like: importLines.firstLineIndex
14
- if (property) {
15
- if (onlyIndexesValues[group]?.[property] !== undefined) {
16
- insertStory.index = onlyIndexesValues[group][property];
17
-
18
- if (presentKey in onlyIndexesValues && !onlyIndexesValues[presentKey]) {
19
- insertStory.gapBefore = true;
20
- }
21
-
22
- break;
23
- }
24
-
25
- continue;
26
- }
27
-
28
- // Special preference like: first
29
- if (preference === "firstLineIndex") {
30
- insertStory.index = 0;
31
- break;
32
- };
33
- };
34
-
35
- return insertStory;
36
- };
37
-
1
+ const startFunc = ({ onlyIndexesValues, importRegex, presentKey }) => {
2
+ const insertStory = {};
3
+
4
+ if (!importRegex) {
5
+ return insertStory;
6
+ };
7
+
8
+ // Try each preferred location until one exists.
9
+ for (const preference of importRegex) {
10
+
11
+ const [group, property] = preference.split(".");
12
+
13
+ // Preference like: importLines.firstLineIndex
14
+ if (property) {
15
+ if (onlyIndexesValues[group]?.[property] !== undefined) {
16
+ insertStory.index = onlyIndexesValues[group][property];
17
+
18
+ if (presentKey in onlyIndexesValues && !onlyIndexesValues[presentKey]) {
19
+ insertStory.gapBefore = true;
20
+ }
21
+
22
+ break;
23
+ }
24
+
25
+ continue;
26
+ }
27
+
28
+ // Special preference like: first
29
+ if (preference === "firstLineIndex") {
30
+ insertStory.index = 0;
31
+ break;
32
+ };
33
+ };
34
+
35
+ return insertStory;
36
+ };
37
+
38
38
  export default startFunc;
@@ -1,50 +1,48 @@
1
- import findInsertIndex from "./findInsertIndex.js";
2
- import addLines from "./addLines.js";
3
- import writeToFile from "./writeToFile.js";
4
-
5
- function build(template, parts) {
6
- return template.replace(/\{(\d+)\}/g, (_, i) => parts[i]);
7
- };
8
-
9
- const startFunc = ({ linesStory, fileContent, filePath, importRegex, onlyIndexesValues,
10
- presentKey, inTemplate, inParts }) => {
11
-
12
- const foundUseLinesStory = linesStory[presentKey].find(element => {
13
- return element.part2 === inParts[1];
14
- });
15
-
16
- if (foundUseLinesStory) {
17
- return {
18
- KTF: false,
19
- KReason: foundUseLinesStory
20
- };
21
- };
22
-
23
- const newLine = build(inTemplate, inParts);
24
-
25
- const lines = fileContent.split(/\r?\n/);
26
-
27
- const insertStory = findInsertIndex({
28
- onlyIndexesValues,
29
- importRegex,
30
- presentKey
31
- });
32
-
33
- addLines({
34
- inLines: lines, inInsertAtIndex: insertStory?.index,
35
- inNewLine: newLine, inGapBefore: insertStory?.gapBefore,
36
- inGapAfter: insertStory?.gapAfter
37
- });
38
-
39
- // lines.splice(insertAtIndex, 0, newLine);
40
-
41
- writeToFile({ fileContent, filePath, lines });
42
-
43
- return {
44
- newLine, inParts
45
- };
46
- // fs.writeFileSync(filePath, lines.join(fileContent.includes("\r\n") ? "\r\n" : "\n"));
47
-
48
- };
49
-
1
+ import findInsertIndex from "./findInsertIndex.js";
2
+ import addLines from "./addLines.js";
3
+ import writeToFile from "./writeToFile.js";
4
+
5
+ function build(template, parts) {
6
+ return template.replace(/\{(\d+)\}/g, (_, i) => parts[i]);
7
+ };
8
+
9
+ const startFunc = ({ linesStory, fileContent, filePath, importRegex, onlyIndexesValues,
10
+ presentKey, inTemplate, inParts, inConsiderKey }) => {
11
+
12
+ const foundUseLinesStory = linesStory[presentKey].find(element => {
13
+ if (inConsiderKey in element) {
14
+ return element[inConsiderKey] === inParts[1];
15
+ };
16
+ });
17
+
18
+ if (foundUseLinesStory) {
19
+ return {
20
+ KTF: false,
21
+ KReason: foundUseLinesStory
22
+ };
23
+ };
24
+
25
+ const newLine = build(inTemplate, inParts);
26
+
27
+ const lines = fileContent.split(/\r?\n/);
28
+
29
+ const insertStory = findInsertIndex({
30
+ onlyIndexesValues,
31
+ importRegex,
32
+ presentKey
33
+ });
34
+
35
+ addLines({
36
+ inLines: lines, inInsertAtIndex: insertStory?.index,
37
+ inNewLine: newLine, inGapBefore: insertStory?.gapBefore,
38
+ inGapAfter: insertStory?.gapAfter
39
+ });
40
+
41
+ writeToFile({ fileContent, filePath, lines });
42
+
43
+ return {
44
+ newLine, inParts
45
+ };
46
+ };
47
+
50
48
  export default startFunc;
@@ -1,8 +1,8 @@
1
- import fs from 'fs';
2
-
3
- const startFunc = ({ fileContent, filePath, lines }) => {
4
-
5
- fs.writeFileSync(filePath, lines.join(fileContent.includes("\r\n") ? "\r\n" : "\n"));
6
- };
7
-
1
+ import fs from 'fs';
2
+
3
+ const startFunc = ({ fileContent, filePath, lines }) => {
4
+
5
+ fs.writeFileSync(filePath, lines.join(fileContent.includes("\r\n") ? "\r\n" : "\n"));
6
+ };
7
+
8
8
  export default startFunc;
@@ -1,25 +1,28 @@
1
- import forImportLine from "./forImportLine/index.js";
2
-
3
- import fileNamesJson from '../fileNames.json' with {type: 'json'};
4
-
5
- const startFunc = ({ inValue, OutValue,
6
- inFileType, inTargetPath }) => {
7
-
8
- const fromImportLine = forImportLine({
9
- inFileType, regexKey: "import",
10
- templateKey: "importRegex",
11
- inTargetPath, presentKey: "importLines",
12
- inParts: [`${fileNamesJson[inFileType]?.temporaryValue}${inValue}`, inValue]
13
- });
14
-
15
- const fromUseLine = forImportLine({
16
- inParts: [`${fileNamesJson[inFileType]?.temporaryValue}${inValue}`, OutValue],
17
- inFileType, regexKey: "consumption",
18
- templateKey: "consumptionRegex",
19
- inTargetPath, presentKey: "useLines"
20
- });
21
-
22
- return { fromImportLine, fromUseLine }
23
- };
24
-
1
+ import { fileNamesJson as fromNpm } from "pattern-collector-base-files";
2
+ import forImportLine from "./forImportLine/index.js";
3
+
4
+ const startFunc = ({ inValue, OutValue,
5
+ inFileType, inTargetPath }) => {
6
+
7
+ const fileNamesJson = fromNpm();
8
+
9
+ const fromImportLine = forImportLine({
10
+ inFileType, regexKey: "import",
11
+ templateKey: "importRegex",
12
+ inTargetPath, presentKey: "importLines",
13
+ inParts: [`${fileNamesJson[inFileType]?.temporaryValue}${inValue}`, inValue],
14
+ inConsiderKey: "part2"
15
+ });
16
+
17
+ const fromUseLine = forImportLine({
18
+ inParts: [`${fileNamesJson[inFileType]?.temporaryValue}${inValue}`, OutValue],
19
+ inFileType, regexKey: "consumption",
20
+ templateKey: "consumptionRegex",
21
+ inTargetPath, presentKey: "useLines",
22
+ inConsiderKey: "part1"
23
+ });
24
+
25
+ return { fromImportLine, fromUseLine }
26
+ };
27
+
25
28
  export default startFunc;
@@ -1,25 +1,25 @@
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
-
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
25
  export default startFunc;
package/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import { createRequire } from "module";
2
- import getLatestVersion from "./bin/core/getLatestVersion.js";
3
-
4
- const require = createRequire(import.meta.url);
5
-
6
- const load = (options) => {
7
- const v = getLatestVersion();
8
-
9
- const mod = require(`./bin/${v}/start.js`);
10
-
11
- return mod.default(options);
12
- };
13
-
1
+ import { createRequire } from "module";
2
+ import getLatestVersion from "./bin/core/getLatestVersion.js";
3
+
4
+ const require = createRequire(import.meta.url);
5
+
6
+ const load = (options) => {
7
+ const v = getLatestVersion();
8
+
9
+ const mod = require(`./bin/${v}/start.js`);
10
+
11
+ return mod.default(options);
12
+ };
13
+
14
14
  export default load;
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
- {
2
- "name": "express-fix-any-js",
3
- "version": "1.26.2",
4
- "description": "CLI to build for appjs, the endpoints",
5
- "keywords": [
6
- "cli",
7
- "scaffold",
8
- "templates",
9
- "node",
10
- "project-generator"
11
- ],
12
- "dependencies": {
13
- "pattern-collector-anyjs-story": "^1.23.2",
14
- "pattern-collector-base-files": "^1.3.1"
15
- },
16
- "type": "module",
17
- "exports": {
18
- ".": "./index.js"
19
- },
20
- "bin": {
21
- "express-fix-any-js": "./bin/cli.js"
22
- },
23
- "files": [
24
- "bin/",
25
- "index.js",
26
- "README.md",
27
- "LICENSE"
28
- ],
29
- "homepage": "https://cli.keshavsoft.com",
30
- "repository": {
31
- "type": "git",
32
- "url": "https://github.com/keshavsoft/express-fix-any-js"
33
- },
34
- "bugs": {
35
- "url": "https://github.com/keshavsoft/express-fix-any-js/issues"
36
- }
37
- }
1
+ {
2
+ "name": "express-fix-any-js",
3
+ "version": "1.28.2",
4
+ "description": "CLI to build for appjs, the endpoints",
5
+ "keywords": [
6
+ "cli",
7
+ "scaffold",
8
+ "templates",
9
+ "node",
10
+ "project-generator"
11
+ ],
12
+ "dependencies": {
13
+ "pattern-collector-anyjs-story": "^1.24.1",
14
+ "pattern-collector-base-files": "^1.3.1"
15
+ },
16
+ "type": "module",
17
+ "exports": {
18
+ ".": "./index.js"
19
+ },
20
+ "bin": {
21
+ "express-fix-any-js": "./bin/cli.js"
22
+ },
23
+ "files": [
24
+ "bin/",
25
+ "index.js",
26
+ "README.md",
27
+ "LICENSE"
28
+ ],
29
+ "homepage": "https://cli.keshavsoft.com",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/keshavsoft/express-fix-any-js"
33
+ },
34
+ "bugs": {
35
+ "url": "https://github.com/keshavsoft/express-fix-any-js/issues"
36
+ }
37
+ }
@@ -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
- }