express-fix-any-js-from-base 1.2.5 → 1.2.9
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 +70 -70
- package/bin/cli.js +11 -11
- package/bin/core/getLatestVersion.js +12 -12
- package/bin/core/loadRunner.js +8 -8
- package/bin/v1/UpdateJs/common/AlterFileForImport/checkDuplicate.js +13 -13
- package/bin/v1/UpdateJs/common/AlterFileForImport/findInsertIndex/defaultAfter/index.js +23 -23
- package/bin/v1/UpdateJs/common/AlterFileForImport/findInsertIndex/defaultAfter/modulat.js +21 -21
- package/bin/v1/UpdateJs/common/AlterFileForImport/findInsertIndex/defaultAfter/story.js +8 -8
- package/bin/v1/UpdateJs/common/AlterFileForImport/findInsertIndex/defaultBefore/index.js +23 -23
- package/bin/v1/UpdateJs/common/AlterFileForImport/findInsertIndex/defaultBefore/modulat.js +24 -24
- package/bin/v1/UpdateJs/common/AlterFileForImport/findInsertIndex/defaultBefore/story.js +8 -8
- package/bin/v1/UpdateJs/common/AlterFileForImport/findInsertIndex/index.js +16 -16
- package/bin/v1/UpdateJs/common/AlterFileForImport/index.js +79 -79
- package/bin/v1/UpdateJs/common/AlterFileForImport/showLogs/atEnd.js +9 -9
- package/bin/v1/UpdateJs/common/AlterFileForImport/showLogs/atStart.js +12 -12
- package/bin/v1/UpdateJs/common/AlterFileForImport/toInsertLineStory.js +16 -16
- package/bin/v1/UpdateJs/common/readFile.js +7 -7
- package/bin/v1/UpdateJs/common/writeFile.js +24 -24
- package/bin/v1/UpdateJs/index.js +8 -8
- package/bin/v1/start.js +6 -6
- package/bin/v2/UpdateJs/common/AlterFileForImport/checkDuplicate.js +13 -13
- package/bin/v2/UpdateJs/common/AlterFileForImport/findInsertIndex/defaultAfter/index.js +23 -23
- package/bin/v2/UpdateJs/common/AlterFileForImport/findInsertIndex/defaultAfter/modulat.js +21 -21
- package/bin/v2/UpdateJs/common/AlterFileForImport/findInsertIndex/defaultAfter/story.js +8 -8
- package/bin/v2/UpdateJs/common/AlterFileForImport/findInsertIndex/defaultBefore/index.js +30 -30
- package/bin/v2/UpdateJs/common/AlterFileForImport/findInsertIndex/defaultBefore/modulat.js +53 -53
- package/bin/v2/UpdateJs/common/AlterFileForImport/findInsertIndex/defaultBefore/story.js +8 -8
- package/bin/v2/UpdateJs/common/AlterFileForImport/findInsertIndex/index.js +19 -19
- package/bin/v2/UpdateJs/common/AlterFileForImport/index.js +85 -81
- package/bin/v2/UpdateJs/common/AlterFileForImport/showLogs/atEnd.js +9 -9
- package/bin/v2/UpdateJs/common/AlterFileForImport/showLogs/atStart.js +11 -11
- package/bin/v2/UpdateJs/common/AlterFileForImport/toInsertLineStory.js +16 -16
- package/bin/v2/UpdateJs/common/readFile.js +7 -7
- package/bin/v2/UpdateJs/common/writeFile.js +28 -28
- package/bin/v2/UpdateJs/index.js +8 -8
- package/bin/v2/start.js +6 -6
- package/index.js +13 -13
- package/package.json +37 -37
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import getStory from "pattern-collector-anyjs";
|
|
2
|
-
|
|
3
|
-
import readFile from "../readFile.js";
|
|
4
|
-
import checkDuplicate from "./checkDuplicate.js";
|
|
5
|
-
import findInsertIndex from "./findInsertIndex/index.js";
|
|
6
|
-
import writeFile from "../writeFile.js";
|
|
7
|
-
import getLineStory from "./toInsertLineStory.js";
|
|
8
|
-
import atStart from "./showLogs/atStart.js";
|
|
9
|
-
import atEnd from "./showLogs/atEnd.js";
|
|
10
|
-
|
|
11
|
-
import packageJson from '../../../../../package.json' with {type: 'json'};
|
|
12
|
-
|
|
13
|
-
const alterFile = ({
|
|
14
|
-
jsFilePath, rulesJson, extractRegex, inParseRegex,
|
|
15
|
-
toCheckLinesName, inKeyInSummary,
|
|
16
|
-
showLog = false, showLogStep1, showLogStep2, showLogStep3
|
|
17
|
-
}) => {
|
|
18
|
-
|
|
19
|
-
atStart({ jsFilePath, rulesJson, packageJson, showLog, parseRegex: inParseRegex, searchRegex: extractRegex });
|
|
20
|
-
|
|
21
|
-
const toInsertLine = rulesJson.toInsertLine;
|
|
22
|
-
|
|
23
|
-
const content = readFile(jsFilePath);
|
|
24
|
-
|
|
25
|
-
const lineStory = getLineStory({
|
|
26
|
-
toInsertLine, parseRegex: inParseRegex, showLog
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
if (showLog?.withValues) console.log(`${packageJson.name}-lineStory : `, lineStory);
|
|
30
|
-
|
|
31
|
-
const fromPatternCollector = getStory({
|
|
32
|
-
fileContent: content,
|
|
33
|
-
extractRegex,
|
|
34
|
-
showLog: showLogStep1,
|
|
35
|
-
showLogStep1: showLogStep2, showLogStep2: showLogStep3
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// console.log(`-fromPatternCollector : `, fromPatternCollector.importLines);
|
|
39
|
-
|
|
40
|
-
if (showLog?.withValues) console.log(`${packageJson.name}------------ : `, fromPatternCollector);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const duplicateInfo = checkDuplicate({
|
|
44
|
-
inSearchText: lineStory.raka,
|
|
45
|
-
inFileContentAsStory: fromPatternCollector[toCheckLinesName]
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
if (duplicateInfo.found) {
|
|
49
|
-
if (showLog) {
|
|
50
|
-
console.log(
|
|
51
|
-
`Duplicate found at line ${duplicateInfo.lineNumber}`
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return duplicateInfo;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const toInsertIndex = findInsertIndex({
|
|
59
|
-
inAllLinesStory: fromPatternCollector.allLinesStory,
|
|
60
|
-
inSummary: fromPatternCollector?.summary,
|
|
61
|
-
rulesJson, inKeyInSummary
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
writeFile({
|
|
65
|
-
inJsFilePath: jsFilePath,
|
|
66
|
-
inInsertLineIndex: toInsertIndex.index,
|
|
67
|
-
toInsertLine, emptyBefore: toInsertIndex.emptyBefore
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
atEnd({ duplicateInfo, packageJson, showLog });
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
inserted: true,
|
|
74
|
-
found: false,
|
|
75
|
-
filePath: jsFilePath,
|
|
76
|
-
lineNumber: null
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
|
|
1
|
+
import getStory from "pattern-collector-anyjs";
|
|
2
|
+
|
|
3
|
+
import readFile from "../readFile.js";
|
|
4
|
+
import checkDuplicate from "./checkDuplicate.js";
|
|
5
|
+
import findInsertIndex from "./findInsertIndex/index.js";
|
|
6
|
+
import writeFile from "../writeFile.js";
|
|
7
|
+
import getLineStory from "./toInsertLineStory.js";
|
|
8
|
+
import atStart from "./showLogs/atStart.js";
|
|
9
|
+
import atEnd from "./showLogs/atEnd.js";
|
|
10
|
+
|
|
11
|
+
import packageJson from '../../../../../package.json' with {type: 'json'};
|
|
12
|
+
|
|
13
|
+
const alterFile = ({
|
|
14
|
+
jsFilePath, rulesJson, extractRegex, inParseRegex,
|
|
15
|
+
toCheckLinesName, inKeyInSummary,
|
|
16
|
+
showLog = false, showLogStep1, showLogStep2, showLogStep3
|
|
17
|
+
}) => {
|
|
18
|
+
|
|
19
|
+
atStart({ jsFilePath, rulesJson, packageJson, showLog, parseRegex: inParseRegex, searchRegex: extractRegex });
|
|
20
|
+
|
|
21
|
+
const toInsertLine = rulesJson.toInsertLine;
|
|
22
|
+
|
|
23
|
+
const content = readFile(jsFilePath);
|
|
24
|
+
|
|
25
|
+
const lineStory = getLineStory({
|
|
26
|
+
toInsertLine, parseRegex: inParseRegex, showLog
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
if (showLog?.withValues) console.log(`${packageJson.name}-lineStory : `, lineStory);
|
|
30
|
+
|
|
31
|
+
const fromPatternCollector = getStory({
|
|
32
|
+
fileContent: content,
|
|
33
|
+
extractRegex,
|
|
34
|
+
showLog: showLogStep1,
|
|
35
|
+
showLogStep1: showLogStep2, showLogStep2: showLogStep3
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// console.log(`-fromPatternCollector : `, fromPatternCollector.importLines);
|
|
39
|
+
|
|
40
|
+
if (showLog?.withValues) console.log(`${packageJson.name}------------ : `, fromPatternCollector);
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const duplicateInfo = checkDuplicate({
|
|
44
|
+
inSearchText: lineStory.raka,
|
|
45
|
+
inFileContentAsStory: fromPatternCollector[toCheckLinesName]
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (duplicateInfo.found) {
|
|
49
|
+
if (showLog) {
|
|
50
|
+
console.log(
|
|
51
|
+
`Duplicate found at line ${duplicateInfo.lineNumber}`
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return duplicateInfo;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const toInsertIndex = findInsertIndex({
|
|
59
|
+
inAllLinesStory: fromPatternCollector.allLinesStory,
|
|
60
|
+
inSummary: fromPatternCollector?.summary,
|
|
61
|
+
rulesJson, inKeyInSummary
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
writeFile({
|
|
65
|
+
inJsFilePath: jsFilePath,
|
|
66
|
+
inInsertLineIndex: toInsertIndex.index,
|
|
67
|
+
toInsertLine, emptyBefore: toInsertIndex.emptyBefore
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
atEnd({ duplicateInfo, packageJson, showLog });
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
inserted: true,
|
|
74
|
+
found: false,
|
|
75
|
+
filePath: jsFilePath,
|
|
76
|
+
lineNumber: null
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
80
|
export default alterFile;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const startFunc = ({
|
|
2
|
-
duplicateInfo, packageJson, showLog
|
|
3
|
-
}) => {
|
|
4
|
-
|
|
5
|
-
if (showLog?.keysOnly) console.log(`${packageJson.name}-end`);
|
|
6
|
-
if (showLog?.withValues) console.log(`${packageJson.name}-outputs : `, duplicateInfo);
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
|
|
1
|
+
const startFunc = ({
|
|
2
|
+
duplicateInfo, packageJson, showLog
|
|
3
|
+
}) => {
|
|
4
|
+
|
|
5
|
+
if (showLog?.keysOnly) console.log(`${packageJson.name}-end`);
|
|
6
|
+
if (showLog?.withValues) console.log(`${packageJson.name}-outputs : `, duplicateInfo);
|
|
7
|
+
|
|
8
|
+
};
|
|
9
|
+
|
|
10
10
|
export default startFunc;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const startFunc = ({
|
|
2
|
-
jsFilePath, rulesJson, packageJson, showLog, parseRegex, searchRegex
|
|
3
|
-
}) => {
|
|
4
|
-
|
|
5
|
-
if (showLog?.keysOnly) console.log(`${packageJson.name}-start`);
|
|
6
|
-
|
|
7
|
-
if (showLog?.withValues) console.log(`${packageJson.name}-inputs-jsFilePath : `, jsFilePath);
|
|
8
|
-
if (showLog?.withValues) console.log(`${packageJson.name}-inputs-rulesJson : `, JSON.stringify(rulesJson));
|
|
9
|
-
if (showLog?.withValues) console.log(`${packageJson.name}-inputs-parseRegex : `, JSON.stringify(parseRegex));
|
|
10
|
-
if (showLog?.withValues) console.log(`${packageJson.name}-inputs-searchRegex : `, JSON.stringify(searchRegex));
|
|
11
|
-
};
|
|
12
|
-
|
|
1
|
+
const startFunc = ({
|
|
2
|
+
jsFilePath, rulesJson, packageJson, showLog, parseRegex, searchRegex
|
|
3
|
+
}) => {
|
|
4
|
+
|
|
5
|
+
if (showLog?.keysOnly) console.log(`${packageJson.name}-start`);
|
|
6
|
+
|
|
7
|
+
if (showLog?.withValues) console.log(`${packageJson.name}-inputs-jsFilePath : `, jsFilePath);
|
|
8
|
+
if (showLog?.withValues) console.log(`${packageJson.name}-inputs-rulesJson : `, JSON.stringify(rulesJson));
|
|
9
|
+
if (showLog?.withValues) console.log(`${packageJson.name}-inputs-parseRegex : `, JSON.stringify(parseRegex));
|
|
10
|
+
if (showLog?.withValues) console.log(`${packageJson.name}-inputs-searchRegex : `, JSON.stringify(searchRegex));
|
|
11
|
+
};
|
|
12
|
+
|
|
13
13
|
export default startFunc;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import baseRegex from "pattern-collector-base-regex";
|
|
2
|
-
|
|
3
|
-
const startFunc = ({ toInsertLine, parseRegex, showLog = false }) => {
|
|
4
|
-
|
|
5
|
-
if (showLog) console.log("toInsertLineStory-inputs : ", parseRegex, toInsertLine);
|
|
6
|
-
|
|
7
|
-
const fromPatternCollector = baseRegex({
|
|
8
|
-
matchLine: toInsertLine,
|
|
9
|
-
parseRegex, showLog
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
if (showLog) console.log("toInsertLineStory-outputs : ", fromPatternCollector);
|
|
13
|
-
|
|
14
|
-
return fromPatternCollector;
|
|
15
|
-
};
|
|
16
|
-
|
|
1
|
+
import baseRegex from "pattern-collector-base-regex";
|
|
2
|
+
|
|
3
|
+
const startFunc = ({ toInsertLine, parseRegex, showLog = false }) => {
|
|
4
|
+
|
|
5
|
+
if (showLog) console.log("toInsertLineStory-inputs : ", parseRegex, toInsertLine);
|
|
6
|
+
|
|
7
|
+
const fromPatternCollector = baseRegex({
|
|
8
|
+
matchLine: toInsertLine,
|
|
9
|
+
parseRegex, showLog
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
if (showLog) console.log("toInsertLineStory-outputs : ", fromPatternCollector);
|
|
13
|
+
|
|
14
|
+
return fromPatternCollector;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
17
|
export default startFunc;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
|
|
3
|
-
const readFile = (inAppJsPath) => {
|
|
4
|
-
const localPath = inAppJsPath;
|
|
5
|
-
return fs.readFileSync(localPath, "utf-8");
|
|
6
|
-
};
|
|
7
|
-
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
|
|
3
|
+
const readFile = (inAppJsPath) => {
|
|
4
|
+
const localPath = inAppJsPath;
|
|
5
|
+
return fs.readFileSync(localPath, "utf-8");
|
|
6
|
+
};
|
|
7
|
+
|
|
8
8
|
export default readFile;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import readFile from "./readFile.js";
|
|
3
|
-
|
|
4
|
-
const writeFile = ({ inJsFilePath, inInsertLineIndex, toInsertLine,
|
|
5
|
-
emptyBefore = false, emptyAfter = false
|
|
6
|
-
}) => {
|
|
7
|
-
try {
|
|
8
|
-
if (emptyBefore) {
|
|
9
|
-
toInsertLine = "\n".concat(toInsertLine);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const content = readFile(inJsFilePath);
|
|
13
|
-
|
|
14
|
-
const lines = content.split("\n");
|
|
15
|
-
|
|
16
|
-
const updatedLines = lines.toSpliced(inInsertLineIndex - 1, 0, toInsertLine);
|
|
17
|
-
|
|
18
|
-
fs.writeFileSync(inJsFilePath, updatedLines.join("\n"));
|
|
19
|
-
|
|
20
|
-
} catch (error) {
|
|
21
|
-
return error;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import readFile from "./readFile.js";
|
|
3
|
+
|
|
4
|
+
const writeFile = ({ inJsFilePath, inInsertLineIndex, toInsertLine,
|
|
5
|
+
emptyBefore = false, emptyAfter = false
|
|
6
|
+
}) => {
|
|
7
|
+
try {
|
|
8
|
+
if (emptyBefore) {
|
|
9
|
+
toInsertLine = "\n".concat(toInsertLine);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const content = readFile(inJsFilePath);
|
|
13
|
+
|
|
14
|
+
const lines = content.split("\n");
|
|
15
|
+
|
|
16
|
+
const updatedLines = lines.toSpliced(inInsertLineIndex - 1, 0, toInsertLine);
|
|
17
|
+
|
|
18
|
+
fs.writeFileSync(inJsFilePath, updatedLines.join("\n"));
|
|
19
|
+
|
|
20
|
+
} catch (error) {
|
|
21
|
+
return error;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
25
|
export default writeFile;
|
package/bin/v1/UpdateJs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import alterFileForImport from "./common/AlterFileForImport/index.js";
|
|
2
|
-
|
|
3
|
-
const updateAppJs = (args) => {
|
|
4
|
-
const importResult = alterFileForImport(args);
|
|
5
|
-
|
|
6
|
-
return importResult;
|
|
7
|
-
};
|
|
8
|
-
|
|
1
|
+
import alterFileForImport from "./common/AlterFileForImport/index.js";
|
|
2
|
+
|
|
3
|
+
const updateAppJs = (args) => {
|
|
4
|
+
const importResult = alterFileForImport(args);
|
|
5
|
+
|
|
6
|
+
return importResult;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
9
|
export default updateAppJs;
|
package/bin/v1/start.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import updateJs from "./UpdateJs/index.js";
|
|
2
|
-
|
|
3
|
-
const run = (args) => {
|
|
4
|
-
return updateJs(args);
|
|
5
|
-
};
|
|
6
|
-
|
|
1
|
+
import updateJs from "./UpdateJs/index.js";
|
|
2
|
+
|
|
3
|
+
const run = (args) => {
|
|
4
|
+
return updateJs(args);
|
|
5
|
+
};
|
|
6
|
+
|
|
7
7
|
export default run;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const checkUseDuplicate = ({ inSearchText, inFileContentAsStory }) => {
|
|
2
|
-
|
|
3
|
-
const found = inFileContentAsStory.find(element => {
|
|
4
|
-
return element.folderName === inSearchText;
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
inserted: false,
|
|
9
|
-
found,
|
|
10
|
-
lineNumber: found ? found.lineNumber : null
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
|
|
1
|
+
const checkUseDuplicate = ({ inSearchText, inFileContentAsStory }) => {
|
|
2
|
+
|
|
3
|
+
const found = inFileContentAsStory.find(element => {
|
|
4
|
+
return element.folderName === inSearchText;
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
inserted: false,
|
|
9
|
+
found,
|
|
10
|
+
lineNumber: found ? found.lineNumber : null
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
|
|
14
14
|
export default checkUseDuplicate;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import getFromStory from "./story.js";
|
|
2
|
-
import getFromSummary from "./modulat.js";
|
|
3
|
-
|
|
4
|
-
const findInsertIndex = ({ toInsertIndex,
|
|
5
|
-
inAllLinesStory, inSummary
|
|
6
|
-
}) => {
|
|
7
|
-
|
|
8
|
-
const storyIndex = getFromStory(inAllLinesStory);
|
|
9
|
-
|
|
10
|
-
if (storyIndex !== null) {
|
|
11
|
-
toInsertIndex = storyIndex;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const summaryIndex = getFromSummary(inSummary);
|
|
15
|
-
|
|
16
|
-
if (summaryIndex !== null) {
|
|
17
|
-
toInsertIndex = summaryIndex;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
return toInsertIndex;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export default findInsertIndex;
|
|
1
|
+
import getFromStory from "./story.js";
|
|
2
|
+
import getFromSummary from "./modulat.js";
|
|
3
|
+
|
|
4
|
+
const findInsertIndex = ({ toInsertIndex,
|
|
5
|
+
inAllLinesStory, inSummary
|
|
6
|
+
}) => {
|
|
7
|
+
|
|
8
|
+
const storyIndex = getFromStory(inAllLinesStory);
|
|
9
|
+
|
|
10
|
+
if (storyIndex !== null) {
|
|
11
|
+
toInsertIndex = storyIndex;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const summaryIndex = getFromSummary(inSummary);
|
|
15
|
+
|
|
16
|
+
if (summaryIndex !== null) {
|
|
17
|
+
toInsertIndex = summaryIndex;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return toInsertIndex;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default findInsertIndex;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
const getFromSummary = (inSummary) => {
|
|
2
|
-
let index = null;
|
|
3
|
-
|
|
4
|
-
if (inSummary?.exportSummary) {
|
|
5
|
-
const minLine = inSummary?.exportSummary?.maxLineNumber;
|
|
6
|
-
if (minLine !== Infinity && minLine !== -Infinity) {
|
|
7
|
-
index = minLine + 1;
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
if (inSummary?.consumeSummary) {
|
|
12
|
-
const minLine = inSummary?.consumeSummary?.maxLineNumber;
|
|
13
|
-
if (minLine !== Infinity && minLine !== -Infinity) {
|
|
14
|
-
index = minLine + 1;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
return index;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default getFromSummary;
|
|
1
|
+
const getFromSummary = (inSummary) => {
|
|
2
|
+
let index = null;
|
|
3
|
+
|
|
4
|
+
if (inSummary?.exportSummary) {
|
|
5
|
+
const minLine = inSummary?.exportSummary?.maxLineNumber;
|
|
6
|
+
if (minLine !== Infinity && minLine !== -Infinity) {
|
|
7
|
+
index = minLine + 1;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
if (inSummary?.consumeSummary) {
|
|
12
|
+
const minLine = inSummary?.consumeSummary?.maxLineNumber;
|
|
13
|
+
if (minLine !== Infinity && minLine !== -Infinity) {
|
|
14
|
+
index = minLine + 1;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
return index;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default getFromSummary;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const getFromStory = (inAllLinesStory) => {
|
|
2
|
-
if (Array.isArray(inAllLinesStory)) {
|
|
3
|
-
return inAllLinesStory.length - 1;
|
|
4
|
-
}
|
|
5
|
-
return null;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default getFromStory;
|
|
1
|
+
const getFromStory = (inAllLinesStory) => {
|
|
2
|
+
if (Array.isArray(inAllLinesStory)) {
|
|
3
|
+
return inAllLinesStory.length - 1;
|
|
4
|
+
}
|
|
5
|
+
return null;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default getFromStory;
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import getFromStory from "./story.js";
|
|
2
|
-
import getFromSummary from "./modulat.js";
|
|
3
|
-
|
|
4
|
-
const findInsertIndex = ({ toInsertIndex,
|
|
5
|
-
inAllLinesStory, inSummary, rulesJson
|
|
6
|
-
}) => {
|
|
7
|
-
|
|
8
|
-
const storyIndex = getFromStory(inAllLinesStory);
|
|
9
|
-
|
|
10
|
-
if (storyIndex !== null) {
|
|
11
|
-
toInsertIndex = storyIndex;
|
|
12
|
-
};
|
|
13
|
-
// console.log("aaaaaaaa-- : ", inKeyInSummary);
|
|
14
|
-
const summaryIndex = getFromSummary({
|
|
15
|
-
inSummary,
|
|
16
|
-
inToCheckKey: rulesJson?.toCheckKey,
|
|
17
|
-
inToCheckEmptyKey: rulesJson?.toCheckEmptyKey,
|
|
18
|
-
inConsiderTop: rulesJson?.considerTop,
|
|
19
|
-
inConsiderBottom: rulesJson?.considerBottom,
|
|
20
|
-
inToCheckEmpty2Key: rulesJson?.toCheckEmpty2Key
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
if (summaryIndex !== null) {
|
|
24
|
-
toInsertIndex = summaryIndex;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return toInsertIndex;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default findInsertIndex;
|
|
1
|
+
import getFromStory from "./story.js";
|
|
2
|
+
import getFromSummary from "./modulat.js";
|
|
3
|
+
|
|
4
|
+
const findInsertIndex = ({ toInsertIndex,
|
|
5
|
+
inAllLinesStory, inSummary, rulesJson
|
|
6
|
+
}) => {
|
|
7
|
+
|
|
8
|
+
const storyIndex = getFromStory(inAllLinesStory);
|
|
9
|
+
|
|
10
|
+
if (storyIndex !== null) {
|
|
11
|
+
toInsertIndex = storyIndex;
|
|
12
|
+
};
|
|
13
|
+
// console.log("aaaaaaaa-- : ", inKeyInSummary);
|
|
14
|
+
const summaryIndex = getFromSummary({
|
|
15
|
+
inSummary,
|
|
16
|
+
inToCheckKey: rulesJson?.toCheckKey,
|
|
17
|
+
inToCheckEmptyKey: rulesJson?.toCheckEmptyKey,
|
|
18
|
+
inConsiderTop: rulesJson?.considerTop,
|
|
19
|
+
inConsiderBottom: rulesJson?.considerBottom,
|
|
20
|
+
inToCheckEmpty2Key: rulesJson?.toCheckEmpty2Key
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
if (summaryIndex !== null) {
|
|
24
|
+
toInsertIndex = summaryIndex;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return toInsertIndex;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default findInsertIndex;
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
const startFunc = ({ inSummary, inToCheckKey, inToCheckEmptyKey,
|
|
2
|
-
inConsiderTop, inConsiderBottom, inToCheckEmpty2Key
|
|
3
|
-
}) => {
|
|
4
|
-
|
|
5
|
-
let index = null;
|
|
6
|
-
let emptyBefore = false;
|
|
7
|
-
let emptyAfter = false;
|
|
8
|
-
|
|
9
|
-
const toCheckKey = inToCheckKey;
|
|
10
|
-
const toCheckEmptyKey = inToCheckEmptyKey;
|
|
11
|
-
const toCheckEmpty2Key = inToCheckEmpty2Key;
|
|
12
|
-
|
|
13
|
-
const considerTop = inConsiderTop;
|
|
14
|
-
const considerBottom = inConsiderBottom;
|
|
15
|
-
|
|
16
|
-
if (inSummary[toCheckKey]?.lineCount === 0) {
|
|
17
|
-
|
|
18
|
-
if (considerTop) {
|
|
19
|
-
if (inSummary.importFromNpmSummary?.lineCount === 0) {
|
|
20
|
-
index = 1;
|
|
21
|
-
} else {
|
|
22
|
-
emptyBefore = true;
|
|
23
|
-
index = inSummary.importFromNpmSummary?.maxLineNumber + 1;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
if (considerBottom) {
|
|
28
|
-
if (inSummary[toCheckEmptyKey]?.lineCount === 0) {
|
|
29
|
-
if (inSummary[toCheckEmpty2Key]?.lineCount === 0) {
|
|
30
|
-
// index = inSummary[toCheckEmptyKey]?.minLineNumber;
|
|
31
|
-
index = 1;
|
|
32
|
-
} else {
|
|
33
|
-
emptyBefore = true;
|
|
34
|
-
index = inSummary[toCheckEmpty2Key]?.maxLineNumber + 1;
|
|
35
|
-
};
|
|
36
|
-
} else {
|
|
37
|
-
emptyAfter = true;
|
|
38
|
-
index = inSummary[toCheckEmptyKey]?.minLineNumber;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
} else {
|
|
43
|
-
index = inSummary[toCheckKey]?.minLineNumber;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
emptyBefore,
|
|
48
|
-
emptyAfter,
|
|
49
|
-
index
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export default startFunc;
|
|
1
|
+
const startFunc = ({ inSummary, inToCheckKey, inToCheckEmptyKey,
|
|
2
|
+
inConsiderTop, inConsiderBottom, inToCheckEmpty2Key
|
|
3
|
+
}) => {
|
|
4
|
+
|
|
5
|
+
let index = null;
|
|
6
|
+
let emptyBefore = false;
|
|
7
|
+
let emptyAfter = false;
|
|
8
|
+
|
|
9
|
+
const toCheckKey = inToCheckKey;
|
|
10
|
+
const toCheckEmptyKey = inToCheckEmptyKey;
|
|
11
|
+
const toCheckEmpty2Key = inToCheckEmpty2Key;
|
|
12
|
+
|
|
13
|
+
const considerTop = inConsiderTop;
|
|
14
|
+
const considerBottom = inConsiderBottom;
|
|
15
|
+
|
|
16
|
+
if (inSummary[toCheckKey]?.lineCount === 0) {
|
|
17
|
+
|
|
18
|
+
if (considerTop) {
|
|
19
|
+
if (inSummary.importFromNpmSummary?.lineCount === 0) {
|
|
20
|
+
index = 1;
|
|
21
|
+
} else {
|
|
22
|
+
emptyBefore = true;
|
|
23
|
+
index = inSummary.importFromNpmSummary?.maxLineNumber + 1;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
if (considerBottom) {
|
|
28
|
+
if (inSummary[toCheckEmptyKey]?.lineCount === 0) {
|
|
29
|
+
if (inSummary[toCheckEmpty2Key]?.lineCount === 0) {
|
|
30
|
+
// index = inSummary[toCheckEmptyKey]?.minLineNumber;
|
|
31
|
+
index = 1;
|
|
32
|
+
} else {
|
|
33
|
+
emptyBefore = true;
|
|
34
|
+
index = inSummary[toCheckEmpty2Key]?.maxLineNumber + 1;
|
|
35
|
+
};
|
|
36
|
+
} else {
|
|
37
|
+
emptyAfter = true;
|
|
38
|
+
index = inSummary[toCheckEmptyKey]?.minLineNumber;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
} else {
|
|
43
|
+
index = inSummary[toCheckKey]?.minLineNumber;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
emptyBefore,
|
|
48
|
+
emptyAfter,
|
|
49
|
+
index
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default startFunc;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const getFromStory = (inAllLinesStory) => {
|
|
2
|
-
if (Array.isArray(inAllLinesStory)) {
|
|
3
|
-
return inAllLinesStory.length - 1;
|
|
4
|
-
}
|
|
5
|
-
return null;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default getFromStory;
|
|
1
|
+
const getFromStory = (inAllLinesStory) => {
|
|
2
|
+
if (Array.isArray(inAllLinesStory)) {
|
|
3
|
+
return inAllLinesStory.length - 1;
|
|
4
|
+
}
|
|
5
|
+
return null;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default getFromStory;
|