Skip to content

Commit b31ebc7

Browse files
committed
Fix docgen script to clean out package temp folders first
1 parent 06ab5c4 commit b31ebc7

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

scripts/docgen/docgen.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,19 @@ async function generateDocs(
198198
`"mainEntryPointFilePath": "<projectFolder>/dist/esm/index.doc.d.ts"`
199199
);
200200

201+
// TODO: Throw error if path doesn't exist once all packages add markdown support.
202+
const apiJsonDirectories = (
203+
await mapWorkspaceToPackages([`${projectRoot}/packages/*`])
204+
)
205+
.map(path => `${path}/temp`)
206+
.filter(path => fs.existsSync(path) && !path.includes('-compat'));
207+
201208
try {
209+
console.log(`Deleting old temp directories in each package.`);
210+
for (const dir of apiJsonDirectories) {
211+
fs.rmSync(dir, { recursive: true, force: true });
212+
}
213+
202214
fs.writeFileSync(
203215
`${projectRoot}/packages/auth/api-extractor.json`,
204216
authApiConfigModified
@@ -247,13 +259,6 @@ async function generateDocs(
247259

248260
fs.mkdirSync(tmpDir);
249261

250-
// TODO: Throw error if path doesn't exist once all packages add markdown support.
251-
const apiJsonDirectories = (
252-
await mapWorkspaceToPackages([`${projectRoot}/packages/*`])
253-
)
254-
.map(path => `${path}/temp`)
255-
.filter(path => fs.existsSync(path));
256-
257262
for (const dir of apiJsonDirectories) {
258263
const paths = await new Promise<string[]>(resolve =>
259264
glob(`${dir}/*.api.json`, (err, paths) => {

0 commit comments

Comments
 (0)