Skip to content

Commit e414068

Browse files
committed
Add same for toc
1 parent ae7742c commit e414068

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

scripts/docgen/docgen.ts

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -99,26 +99,29 @@ async function generateToc() {
9999
);
100100
}
101101
}
102-
await spawn(
103-
'yarn',
104-
[
105-
'api-documenter-devsite',
106-
'toc',
107-
'--input',
108-
'temp',
109-
'-p',
110-
'/docs/reference/js',
111-
'-j'
112-
],
113-
{ stdio: 'inherit' }
114-
);
115-
console.log(`Restoring excluded packages' json files.`);
116-
for (const excludedPackage of EXCLUDED_PACKAGES) {
117-
if (fs.existsSync(`${projectRoot}/temp/${excludedPackage}.skip`)) {
118-
fs.renameSync(
119-
`${projectRoot}/temp/${excludedPackage}.skip`,
120-
`${projectRoot}/temp/${excludedPackage}.api.json`
121-
);
102+
try {
103+
await spawn(
104+
'yarn',
105+
[
106+
'api-documenter-devsite',
107+
'toc',
108+
'--input',
109+
'temp',
110+
'-p',
111+
'/docs/reference/js',
112+
'-j'
113+
],
114+
{ stdio: 'inherit' }
115+
);
116+
} finally {
117+
console.log(`Restoring excluded packages' json files.`);
118+
for (const excludedPackage of EXCLUDED_PACKAGES) {
119+
if (fs.existsSync(`${projectRoot}/temp/${excludedPackage}.skip`)) {
120+
fs.renameSync(
121+
`${projectRoot}/temp/${excludedPackage}.skip`,
122+
`${projectRoot}/temp/${excludedPackage}.api.json`
123+
);
124+
}
122125
}
123126
}
124127
}
@@ -131,6 +134,7 @@ async function generateDocs(
131134
const outputFolder = forDevsite ? 'docs-devsite' : 'docs';
132135
const command = forDevsite ? 'api-documenter-devsite' : 'api-documenter';
133136

137+
console.log(`Temporarily modifying auth api-extractor.json for docgen.`);
134138
// Use a special d.ts file for auth for doc gen only.
135139
const authApiConfigOriginal = fs.readFileSync(
136140
`${projectRoot}/packages/auth/api-extractor.json`,
@@ -175,6 +179,7 @@ async function generateDocs(
175179
);
176180
}
177181
} finally {
182+
console.log(`Restoring original auth api-extractor.json contents.`);
178183
// Restore original auth api-extractor.json contents.
179184
fs.writeFileSync(
180185
`${projectRoot}/packages/auth/api-extractor.json`,

0 commit comments

Comments
 (0)