Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix API docs script to tolerate empty docs folder #1316

Merged
merged 4 commits into from
May 7, 2024
Merged

Conversation

Eric-Arellano
Copy link
Collaborator

This was getting in the way of adding the new qiskit-transpiler-service docs, since its folder is empty. This also was a problem when rerunning the script if the folder had been previously deleted without having restored the deleted files before the rerun.

@@ -128,10 +128,9 @@ async function prepareSphinxFolder(pkg: Pkg, args: Arguments): Promise<string> {

async function deleteExistingMarkdown(pkg: Pkg): Promise<void> {
const markdownDir = pkg.outputDir("docs");
if (pkg.isLatest() || (await pathExists(markdownDir))) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's necessary to check if pkg.isLatest() - it's already covered by the pathExists check. If the path does not exist, then there is nothing to delete, regardless of latest or not.

Copy link
Collaborator

@arnaucasau arnaucasau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks! Tested locally and worked well. I left a suggestion to make the code simpler

scripts/lib/fs.ts Outdated Show resolved Hide resolved
Eric-Arellano and others added 2 commits May 7, 2024 13:44
Co-authored-by: Arnau Casau <47946624+arnaucasau@users.noreply.github.com>
@Eric-Arellano Eric-Arellano enabled auto-merge May 7, 2024 17:46
@Eric-Arellano Eric-Arellano added this pull request to the merge queue May 7, 2024
Merged via the queue into main with commit 872ce62 May 7, 2024
2 checks passed
@Eric-Arellano Eric-Arellano deleted the EA/empty-dir branch May 7, 2024 17:50
Eric-Arellano added a commit that referenced this pull request May 7, 2024
This was getting in the way of adding the new qiskit-transpiler-service
docs, since its folder is empty. This also was a problem when rerunning
the script if the folder had been previously deleted without having
restored the deleted files before the rerun.

---------

Co-authored-by: Arnau Casau <47946624+arnaucasau@users.noreply.github.com>
frankharkins pushed a commit to frankharkins/documentation that referenced this pull request Jul 22, 2024
This was getting in the way of adding the new qiskit-transpiler-service
docs, since its folder is empty. This also was a problem when rerunning
the script if the folder had been previously deleted without having
restored the deleted files before the rerun.

---------

Co-authored-by: Arnau Casau <47946624+arnaucasau@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants