Skip to content

fix(cli): make clean-api-docs delete only the files it generated - #1624

Merged
sserrata merged 2 commits into
PaloAltoNetworks:mainfrom
lenamonj:clean-api-docs-generated-only
Oct 9, 2026
Merged

sserrata merged 2 commits into
PaloAltoNetworks:mainfrom
lenamonj:clean-api-docs-generated-only

Conversation

@lenamonj

@lenamonj lenamonj commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

clean-api-docs removed every *.json in the output directory except versions.json, and removed schemas/ recursively. A hand-authored _category_.json in either place went with the generated files.

The globs are now derived from EXTERNALIZABLE_COMPONENTS, the set gen-api-docs externalizes, so the command matches the names it writes rather than every *.json in the directory. Inside schemas/ it removes the generated pages and props with unlinkSync, so the empty check that follows sees the result, then removes the directory only if nothing is left in it.

Motivation and Context

#811 and #829 settled that clean-api-docs should remove what gen-api-docs generated, for a file it was missing. This is the same rule in the other direction.

How Has This Been Tested?

New src/index.test.ts runs the CLI action against a temporary site. Two cases fail on main, where the _category_.json in the output directory and the one under schemas/ are both deleted, and pass here. Two more hold the line the other way: every generated file is still removed, and schemas/ still goes when nothing else is left in it.

yarn test is 122 passing across 11 suites. yarn lint aborts on cypress/.eslintrc.js: Environment key "cypress/globals" is unknown before it reads a file, on pristine main as well; eslint and prettier --check on the changed files are clean.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@lenamonj
lenamonj marked this pull request as draft September 8, 2026 01:23
@lenamonj
lenamonj force-pushed the clean-api-docs-generated-only branch from ae1933c to 5686e71 Compare September 10, 2026 10:37
@lenamonj
lenamonj marked this pull request as ready for review September 10, 2026 10:37
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 5686e71):

https://docusaurus-openapi-36b86--pr1624-5m9h3go4.web.app

(expires Fri, 16 Oct 2026 17:03:01 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

@sserrata
sserrata merged commit 542bf9b into PaloAltoNetworks:main Oct 9, 2026
11 of 12 checks passed
@lenamonj
lenamonj deleted the clean-api-docs-generated-only branch October 9, 2026 18:33

This branch was successfully deployed

2 active deployments
preview — 5686e711 Deployed Oct 9, 2026 by lenamonj via Visual Diff #2358
default — 5686e711 Deployed Sep 10, 2026 by lenamonj via Analyze Unsafe (javascript) #2358
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants