Skip to content

Commit 517fa48

Browse files
Fix conflicts
2 parents 241194b + 7334780 commit 517fa48

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

src/helpers/unitTests.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,30 @@ function sortFolderTree() {
352352
}
353353
}
354354

355+
function sortFolderTree() {
356+
// 1. Sort the folderStructureTree
357+
folderStructureTree.sort((a, b) => {
358+
if (a.absolutePath < b.absolutePath) {
359+
return -1;
360+
}
361+
if (a.absolutePath > b.absolutePath) {
362+
return 1;
363+
}
364+
return 0;
365+
});
366+
367+
// 2. Set prefix according to the position in the directory
368+
for (let i = 0; i < folderStructureTree.length; i++) {
369+
// Get the current directory path
370+
const currentDirPath = path.dirname(folderStructureTree[i].absolutePath);
371+
// Check if it's the last file in the directory
372+
if (i === folderStructureTree.length - 1 || path.dirname(folderStructureTree[i + 1].absolutePath) !== currentDirPath) {
373+
// Update the prefix for the last file in the directory
374+
folderStructureTree[i].line = folderStructureTree[i].line.replace("├───", "└───");
375+
}
376+
}
377+
}
378+
355379
async function getFunctionsForExport(dirPath, ignoreFilesRewrite) {
356380
if (ignoreFilesRewrite) {
357381
isFileToIgnore = ignoreFilesRewrite;

src/utils/files.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ function getRelativePath(filePath, referenceFolderPath) {
1717
return relativePath;
1818
}
1919

20+
2021
function getFolderTreeItem(prefix, absolutePath) {
21-
const isDirectory = absolutePath.includes(':') ? false : fsSync.statSync(absolutePath).isDirectory();
2222
return {
2323
line: `${prefix}${path.basename(absolutePath)}`,
24-
absolutePath,
25-
isDirectory
26-
};
24+
absolutePath: absolutePath
25+
}
2726
}
2827

2928
function isPathInside(basePath, targetPath) {

0 commit comments

Comments
 (0)