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.
- package/LICENSE +21 -21
- package/README.md +88 -88
- package/bin/cli.js +11 -11
- package/bin/core/getLatestVersion.js +12 -12
- package/bin/core/loadRunner.js +8 -8
- package/bin/{v25 → v27}/alterFile/forImportLine/index.js +40 -40
- package/bin/{v26/hookFolder → v27/alterFile}/forInsertIndex.js +29 -29
- package/bin/{v26 → v27}/alterFile/insertLine/addLines.js +15 -15
- package/bin/{v25/hookFolder → v27/alterFile}/insertLine/findInsertIndex.js +37 -37
- package/bin/{v25/hookFolder → v27/alterFile}/insertLine/index.js +49 -49
- package/bin/{v25 → v27}/alterFile/insertLine/writeToFile.js +7 -7
- package/bin/{v26 → v27}/alterFile/start.js +44 -44
- package/bin/{v25 → v27}/fileNames.json +34 -34
- package/bin/{v26 → v27}/hookFolder/forImportLine/index.js +40 -40
- package/bin/{v25/alterFile → v27/hookFolder}/forInsertIndex.js +29 -29
- package/bin/{v25 → v27}/hookFolder/insertLine/addLines.js +15 -15
- package/bin/{v26 → v27}/hookFolder/insertLine/findInsertIndex.js +37 -37
- package/bin/{v26/alterFile → v27/hookFolder}/insertLine/index.js +49 -49
- package/bin/{v26/alterFile → v27/hookFolder}/insertLine/writeToFile.js +7 -7
- package/bin/{v26 → v27}/hookFolder/start.js +27 -27
- package/bin/{v25 → v27}/start.js +24 -24
- package/bin/{v26 → v28}/alterFile/forImportLine/index.js +40 -40
- package/bin/{v25/hookFolder → v28/alterFile}/forInsertIndex.js +29 -29
- package/bin/{v25 → v28}/alterFile/insertLine/addLines.js +15 -15
- package/bin/{v26 → v28}/alterFile/insertLine/findInsertIndex.js +37 -37
- package/bin/{v25 → v28}/alterFile/insertLine/index.js +49 -49
- package/bin/{v26/hookFolder → v28/alterFile}/insertLine/writeToFile.js +7 -7
- package/bin/{v25 → v28}/alterFile/start.js +44 -40
- package/bin/{v25 → v28}/hookFolder/forImportLine/index.js +44 -40
- package/bin/{v26/alterFile → v28/hookFolder}/forInsertIndex.js +29 -29
- package/bin/{v26 → v28}/hookFolder/insertLine/addLines.js +15 -15
- package/bin/{v25/alterFile → v28/hookFolder}/insertLine/findInsertIndex.js +37 -37
- package/bin/{v26 → v28}/hookFolder/insertLine/index.js +47 -49
- package/bin/{v25 → v28}/hookFolder/insertLine/writeToFile.js +7 -7
- package/bin/{v25 → v28}/hookFolder/start.js +27 -24
- package/bin/{v26 → v28}/start.js +24 -24
- package/index.js +13 -13
- package/package.json +37 -37
- 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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
writeToFile({ fileContent, filePath, lines });
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
newLine, inParts
|
|
45
|
-
};
|
|
46
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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;
|
package/bin/{v26 → v28}/start.js
RENAMED
|
@@ -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.
|
|
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.
|
|
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
|
+
}
|
package/bin/v26/fileNames.json
DELETED
|
@@ -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
|
-
}
|