@@ -31,9 +31,8 @@ function createCategoryFile(categoryPath, categoryName) {
31
31
"collapsed" : true ,
32
32
"className" : "red" ,
33
33
"link" : {
34
- "type" : "generated-index" ,
35
- "title" : categoryName ,
36
- "description" : "Provides Functionality for " + categoryName
34
+ "type" : "doc" ,
35
+ "id" : "cb_index"
37
36
}
38
37
} , null , 2 ) ) ;
39
38
}
@@ -63,10 +62,23 @@ function writeToFile(filePath, frontMatterVars){
63
62
}
64
63
}
65
64
65
+ function writeClassIndex ( categoryName , indexFilePath , classAllFrontMatters ) {
66
+ let classIndexContent = '' ;
67
+ classIndexContent += `# ${ categoryName } \n` ;
68
+ classAllFrontMatters . forEach ( frontMatter => {
69
+ classIndexContent += `- [${ frontMatter . data . name } ](${ frontMatter . data . link } ) - ${ frontMatter . cbbaseinfo . description } \n` ;
70
+ } ) ;
71
+ fs . writeFileSync ( indexFilePath , classIndexContent ) ;
72
+ }
73
+
74
+
75
+
66
76
if ( codeboltChild && codeboltChild . children ) {
67
77
codeboltChild . children . forEach ( CbProperties => {
68
78
const dir = `../docs/api/${ CbProperties . name } ` ;
69
79
80
+ let classAllFrontMatters = [ ] ;
81
+
70
82
//Check Folder
71
83
if ( ! fs . existsSync ( dir ) ) {
72
84
fs . mkdirSync ( dir , { recursive : true } ) ;
@@ -85,6 +97,7 @@ if (codeboltChild && codeboltChild.children) {
85
97
"data" : {
86
98
"name" : " " ,
87
99
"category" : " " ,
100
+ "link" : " "
88
101
} ,
89
102
"cbbaseinfo" : {
90
103
"description" : " " ,
@@ -133,12 +146,17 @@ if (codeboltChild && codeboltChild.children) {
133
146
} ) ;
134
147
}
135
148
149
+ frontMatterVars . data . link = `${ frontMatterVars . data . name } ` ;
150
+ const fileurl = `${ dir } /${ frontMatterVars . data . name } .md` ;
151
+ writeToFile ( fileurl , frontMatterVars )
136
152
137
- const filePath = `${ dir } /${ frontMatterVars . data . name } .md` ;
138
- writeToFile ( filePath , frontMatterVars )
139
-
153
+ classAllFrontMatters . push ( frontMatterVars ) ;
140
154
} ) ;
141
155
}
156
+
157
+ const classIndexFilePath = `${ dir } /cb_index.md` ;
158
+ writeClassIndex ( CbProperties . name , classIndexFilePath , classAllFrontMatters )
159
+
142
160
} ) ;
143
161
} else {
144
162
console . log ( 'codeboltChild has no children or does not exist.' ) ;
0 commit comments