@@ -26,7 +26,7 @@ async function findGithubRepoContents(username: string, repo: string) {
26
26
return fullCommitTree . tree ;
27
27
}
28
28
29
- const dirFilter = ( response : any , type : string ) => {
29
+ const dirFilter = ( response : string [ ] , type : string ) => {
30
30
return response . filter ( ( responseItem : any ) => {
31
31
if ( responseItem . type === type ) {
32
32
return `${ responseItem . path } ` ;
@@ -36,7 +36,7 @@ const dirFilter = (response: any, type: string) => {
36
36
37
37
const createListElement = ( linkArray : any ) => {
38
38
let listEl = document . createElement ( "ul" ) ;
39
- linkArray . map ( ( links : string [ ] [ ] ) => {
39
+ linkArray . map ( ( links : any ) => {
40
40
if ( links [ 1 ] . length == 0 ) {
41
41
return ( listEl . innerHTML += `<li>
42
42
<input type="button" id="${ links [ 0 ] } ">
@@ -45,25 +45,24 @@ const createListElement = (linkArray: any) => {
45
45
</label>
46
46
</li>` ) ;
47
47
} else {
48
- let innerLinks : [ ] = [ ] ,
49
- templateCollapse ;
48
+ let innerLinks : [ ] , templateCollapse ;
50
49
Promise . all (
51
50
links [ 1 ] . map ( ( url : string , i : number ) =>
52
51
fetch ( url + "/README.md" , fetchHeaders ) . then ( resp => resp . text ( ) )
53
52
)
54
53
)
55
- . then ( ( texts : Array ) => {
56
- innerLinks = links [ 1 ] . map ( ( link : string , i : number ) => {
54
+ . then ( ( texts : any ) => {
55
+ return links [ 1 ] . map ( ( link : string , i : number ) => {
57
56
return `<li><a href="${ link } ">${ converter . makeHtml (
58
57
texts [ i ]
59
58
) } </a></li>`;
60
59
} ) ;
61
60
} )
62
- . then ( ( ) => {
61
+ . then ( ( thing : any ) => {
63
62
templateCollapse = `<li><input type="checkbox" id="${ links [ 0 ] } ">
64
63
<label for="${ links [ 0 ] } ">${ links [ 0 ] } </label>
65
64
<ul class="${ links [ 0 ] } ">
66
- ${ innerLinks . join ( " " ) }
65
+ ${ thing . join ( " " ) }
67
66
</ul></li>` ;
68
67
return ( listEl . innerHTML += templateCollapse ) ;
69
68
} ) ;
@@ -72,21 +71,25 @@ const createListElement = (linkArray: any) => {
72
71
let domDoc = document ;
73
72
let wrapper = < Element > domDoc . querySelector ( ".wrapper" ) ;
74
73
wrapper . innerHTML = "" ;
75
- domDoc . append ( listEl ) ;
74
+ wrapper . append ( listEl ) ;
76
75
} ;
77
76
78
77
findGithubRepoContents ( "atomize" , "atomize.github.io" )
79
78
. then ( arr => dirFilter ( arr , "tree" ) )
80
79
. then ( paths => {
81
- interface fetchedPaths {
82
- rootPaths : { } ;
83
- }
84
- paths . map ( ( path : any , fetchedPaths : fetchedPaths ) => {
80
+ let fetchedPaths = {
81
+ rootPaths : < any > { }
82
+ } ;
83
+ paths . map ( ( path : any ) => {
84
+ if ( / ^ \. / . test ( path . path ) ) {
85
+ return ;
86
+ }
85
87
if ( ! path . path . includes ( "/" ) ) {
86
- fetchedPaths . rootPaths ;
88
+ /* fetchedPaths.rootPaths; */
87
89
fetchedPaths . rootPaths [ path . path ] = [ ] ;
88
90
} else {
89
91
let rootDir = path . path . split ( "/" ) [ 0 ] ;
92
+ console . log ( fetchedPaths . rootPaths [ rootDir ] ) ;
90
93
! fetchedPaths . rootPaths [ rootDir ]
91
94
? ( fetchedPaths . rootPaths [ rootDir ] =
92
95
[ ] &&
0 commit comments