Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docgen/post-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ async function fixTitles() {
for (const file of files) {
await fixTitleOf(path.join(markdownDir, file));
}

const tocFile = path.join(markdownDir, 'toc.yaml');
await fixTocTitles(tocFile);
}

async function fixTitleOf(file) {
Expand Down Expand Up @@ -92,6 +95,25 @@ async function fixTitleOf(file) {
}
}

async function fixTocTitles(file) {
const reader = readline.createInterface({
input: fs.createReadStream(file),
});

const buffer = [];
for await (let line of reader) {
if (line.includes('- title: firebase-admin.')) {
line = line.replace(/firebase-admin\./, 'firebase-admin/');
}

buffer.push(line);
}

console.log(`Updating titles in ${file}`);
const content = Buffer.from(buffer.join('\r\n'));
await fs.writeFile(file, content);
}

async function getExtraFiles() {
const extrasPath = path.join(__dirname, 'extras');
const files = await fs.readdir(extrasPath);
Expand Down
49 changes: 28 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
"test:coverage": "nyc npm run test:unit",
"lint:src": "eslint src/ --ext .ts",
"lint:test": "eslint test/ --ext .ts",
"apidocs": "run-s api-extractor:local api-documenter api-documenter:post",
"apidocs": "run-s api-extractor:local api-documenter api-documenter:toc api-documenter:post",
"api-extractor": "node generate-reports.js",
"api-extractor:local": "npm run build && node generate-reports.js --local",
"esm-wrap": "node generate-esm-wrapper.js",
"api-documenter": "api-documenter-fire markdown --input temp --output docgen/markdown -s",
"api-documenter:toc": "api-documenter-fire toc --input temp --output docgen/markdown -p /docs/reference/admin/node -s",
"api-documenter:post": "node docgen/post-process.js"
},
"nyc": {
Expand Down Expand Up @@ -155,7 +156,7 @@
"@google-cloud/storage": "^5.3.0"
},
"devDependencies": {
"@firebase/api-documenter": "^0.1.1",
"@firebase/api-documenter": "^0.1.2",
"@firebase/app": "^0.6.13",
"@firebase/auth": "^0.16.2",
"@firebase/auth-types": "^0.10.1",
Expand Down