js-code-detector 0.0.7 → 0.0.8
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/dist/cjs/index.js
CHANGED
|
@@ -114,11 +114,10 @@ function generateReport(jsonStr) {
|
|
|
114
114
|
async function sameCodeDetect(dirOfCwd) {
|
|
115
115
|
const filesAndContent = await (0, import_readDirFiles.readSrcFiles)(dirOfCwd);
|
|
116
116
|
const { nodeContentGroupList, depthList } = import_Core.default.investigate(filesAndContent);
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const md = import_Core.default.createMarkdownFile(nodeContentGroupList.filter((e) => validDepthList.includes(e.depth)).slice(0, 5));
|
|
117
|
+
const top3DepthsSet = [...new Set(depthList)].slice(0, 3);
|
|
118
|
+
const validDepthList = depthList.filter((e) => top3DepthsSet.includes(e));
|
|
119
|
+
const validContentList = nodeContentGroupList.filter((e) => validDepthList.includes(e.depth)).sort((a, b) => b.depth - a.depth);
|
|
120
|
+
const md = import_Core.default.createMarkdownFile(validContentList);
|
|
122
121
|
(0, import_fs2.writeFileSync)((0, import_path.join)(process.cwd(), `${(0, import_dayjs.default)().format("YYYYMDD_HHmm")}_same_code.md`), md, { encoding: "utf-8", flag: "w" });
|
|
123
122
|
}
|
|
124
123
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -69,7 +69,7 @@ ${content}
|
|
|
69
69
|
nodeContentGroupList,
|
|
70
70
|
nodeGroupList,
|
|
71
71
|
countList: nodeContentGroupList.map((e) => e.nodeCount).sort((a, b) => a - b),
|
|
72
|
-
depthList: nodeContentGroupList.map((e) => e.depth).sort((a, b) =>
|
|
72
|
+
depthList: nodeContentGroupList.map((e) => e.depth).sort((a, b) => b - a)
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
static getFileContentByLine(map, filePath, start, end) {
|