Skip to content

Commit c8816d9

Browse files
authored
Merge pull request #30 from Himenon/fix-not-found-dir
fix: not found dirs
2 parents 6171af7 + 5575b0e commit c8816d9

File tree

5 files changed

+23
-20
lines changed

5 files changed

+23
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

66
<a name="0.3.4"></a>
7+
78
## 0.3.4 (2020-01-08)
89

910
**Note:** Version bump only for package code-dependency
1011

11-
12-
13-
14-
1512
<a name="0.3.3"></a>
1613

1714
## 0.3.3 (2020-01-07)

lerna.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,10 @@
1111
"publish": {
1212
"access": "public",
1313
"allowBranch": "master",
14-
"ignoreChanges": [
15-
"CHANGELOG.md"
16-
]
14+
"ignoreChanges": ["CHANGELOG.md"]
1715
}
1816
},
19-
"packages": [
20-
"packages/*"
21-
],
17+
"packages": ["packages/*"],
2218
"version": "0.3.4",
2319
"npmClient": "yarn",
2420
"registry": "https://registry.npmjs.org/",

packages/cli/CHANGELOG.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

66
<a name="0.3.4"></a>
7+
78
## 0.3.4 (2020-01-08)
89

910
**Note:** Version bump only for package @code-dependency/cli
1011

11-
12-
13-
14-
1512
<a name="0.3.3"></a>
1613

1714
## 0.3.3 (2020-01-07)

packages/view/CHANGELOG.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@ All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

66
<a name="0.3.4"></a>
7+
78
## 0.3.4 (2020-01-08)
89

910
**Note:** Version bump only for package @code-dependency/view
1011

11-
12-
13-
14-
1512
<a name="0.3.3"></a>
1613

1714
## 0.3.3 (2020-01-07)

packages/view/src/container/FileTree/Store.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,28 @@ const generateItems = (
6969
.sort(compareBasename);
7070
};
7171

72+
export const generateParentDirectories = (filePath: string): string[] => {
73+
const dirname = path.dirname(filePath);
74+
if (dirname === ".") {
75+
return [dirname];
76+
}
77+
return [dirname].concat(generateParentDirectories(dirname));
78+
};
79+
7280
export const generateFolderTree = (filePathObjectList: FilePathObject[], updateKey: UpdateKeyFunction): SideNavItem.Props[] => {
7381
const flatFileMap: FlatFileMap = {};
82+
filePathObjectList.forEach(p => {
83+
generateParentDirectories(p.source).forEach(dirname => {
84+
if (!(dirname in flatFileMap) && dirname !== ".") {
85+
flatFileMap[dirname] = [];
86+
}
87+
});
88+
});
89+
console.log(flatFileMap);
7490
filePathObjectList.forEach(filePathObject => {
7591
const dirname = path.dirname(filePathObject.source);
76-
const item: SideNavItem.Props = generateFile(filePathObject, updateKey);
77-
(flatFileMap[dirname] || (flatFileMap[dirname] = [])).push(item);
92+
const fileItem: SideNavItem.Props = generateFile(filePathObject, updateKey);
93+
(flatFileMap[dirname] || (flatFileMap[dirname] = [])).push(fileItem);
7894
});
7995
const directories = Object.keys(flatFileMap);
8096
const rootItems = directories

0 commit comments

Comments
 (0)