File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,9 @@ async function fixTitles() {
6363 for ( const file of files ) {
6464 await fixTitleOf ( path . join ( markdownDir , file ) ) ;
6565 }
66+
67+ const tocFile = path . join ( markdownDir , 'toc.yaml' ) ;
68+ await fixTocTitles ( tocFile ) ;
6669}
6770
6871async function fixTitleOf ( file ) {
@@ -92,6 +95,25 @@ async function fixTitleOf(file) {
9295 }
9396}
9497
98+ async function fixTocTitles ( file ) {
99+ const reader = readline . createInterface ( {
100+ input : fs . createReadStream ( file ) ,
101+ } ) ;
102+
103+ const buffer = [ ] ;
104+ for await ( let line of reader ) {
105+ if ( line . includes ( '- title: firebase-admin.' ) ) {
106+ line = line . replace ( / f i r e b a s e - a d m i n \. / , 'firebase-admin/' ) ;
107+ }
108+
109+ buffer . push ( line ) ;
110+ }
111+
112+ console . log ( `Updating titles in ${ file } ` ) ;
113+ const content = Buffer . from ( buffer . join ( '\r\n' ) ) ;
114+ await fs . writeFile ( file , content ) ;
115+ }
116+
95117async function getExtraFiles ( ) {
96118 const extrasPath = path . join ( __dirname , 'extras' ) ;
97119 const files = await fs . readdir ( extrasPath ) ;
Original file line number Diff line number Diff line change 2020 "test:coverage" : " nyc npm run test:unit" ,
2121 "lint:src" : " eslint src/ --ext .ts" ,
2222 "lint:test" : " eslint test/ --ext .ts" ,
23- "apidocs" : " run-s api-extractor:local api-documenter api-documenter:post" ,
23+ "apidocs" : " run-s api-extractor:local api-documenter api-documenter:toc api-documenter: post" ,
2424 "api-extractor" : " node generate-reports.js" ,
2525 "api-extractor:local" : " npm run build && node generate-reports.js --local" ,
2626 "esm-wrap" : " node generate-esm-wrapper.js" ,
2727 "api-documenter" : " api-documenter-fire markdown --input temp --output docgen/markdown -s" ,
28+ "api-documenter:toc" : " api-documenter-fire toc --input temp --output docgen/markdown -p /docs/reference/admin/node -s" ,
2829 "api-documenter:post" : " node docgen/post-process.js"
2930 },
3031 "nyc" : {
156157 "@google-cloud/storage" : " ^5.3.0"
157158 },
158159 "devDependencies" : {
159- "@firebase/api-documenter" : " ^0.1.1 " ,
160+ "@firebase/api-documenter" : " ^0.1.2 " ,
160161 "@firebase/app" : " ^0.6.13" ,
161162 "@firebase/auth" : " ^0.16.2" ,
162163 "@firebase/auth-types" : " ^0.10.1" ,
You can’t perform that action at this time.
0 commit comments