Skip to content

Commit

Permalink
Delete stale images (#2529)
Browse files Browse the repository at this point in the history
Found with `npx tsx scripts/js/commands/checkStaleImages.ts`. CI's link
checker will validate that no images were removed that shouldn't have
been.

---------

Co-authored-by: Arnau Casau <[email protected]>
  • Loading branch information
Eric-Arellano and arnaucasau authored Dec 23, 2024
1 parent a149464 commit 33a35b5
Show file tree
Hide file tree
Showing 75 changed files with 18 additions and 860 deletions.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed public/images/api/qiskit/1.1/circuit-3.png
Binary file not shown.
Binary file removed public/images/api/qiskit/1.1/circuit-5.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed public/images/api/qiskit/circuit-3.png
Diff not rendered.
Binary file removed public/images/api/qiskit/circuit-5.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-1.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-2.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-3.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-4.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-5.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-6.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-7.png
Diff not rendered.
Binary file removed public/images/api/qiskit/dev/release_notes-8.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed public/images/guides/paulibasis.png
Diff not rendered.
32 changes: 0 additions & 32 deletions public/images/guides/sessions/ExtendedSession.svg
Diff not rendered.
38 changes: 0 additions & 38 deletions public/images/guides/sessions/[email protected]
Diff not rendered.
32 changes: 0 additions & 32 deletions public/images/guides/sessions/SessionTTL.svg
Diff not rendered.
34 changes: 0 additions & 34 deletions public/images/guides/sessions/[email protected]
Diff not rendered.
Binary file removed public/images/migration/admin-UI1.png
Diff not rendered.
Binary file removed public/images/migration/dedicated_queue1.jpg
Diff not rendered.
Diff not rendered.
Binary file removed public/images/migration/switcher-small2.png
Diff not rendered.
Binary file removed public/images/optimize/m3.png
Diff not rendered.
Binary file removed public/images/optimize/resilience-2.png
Diff not rendered.
Binary file removed public/images/optimize/sampling-overhead.png
Diff not rendered.
Binary file removed public/images/optimize/stratified.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
26 changes: 18 additions & 8 deletions scripts/js/lib/api/saveImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ import { Pkg } from "./Pkg.js";
import { Image } from "./HtmlToMdResult.js";
import { pathExists, rmFilesInFolder } from "../fs.js";

function skipReleaseNote(imgFileName: string, pkg: Pkg): boolean {
const isReleaseNote =
imgFileName.includes("release_notes") ||
imgFileName.includes("release-notes");
if (!isReleaseNote) return false;

if (pkg.hasSeparateReleaseNotes()) {
// If the pkg has dedicated release notes per release, we should copy its images
// unless it's the dev version. We don't (yet) support release notes for dev versions:
// https://github.com/Qiskit/documentation/issues/1296
return pkg.isDev();
} else {
// Else, if the pkg has only a single release note file, only 'latest' should copy images.
return !pkg.isLatest();
}
}

export async function saveImages(
images: Image[],
originalImagesFolderPath: string,
Expand All @@ -34,14 +51,7 @@ export async function saveImages(
}

await pMap(images, async (img) => {
// For packages with only a single release notes file, the release notes images are only saved
// in the current version to avoid having duplicate files.
if (
pkg.isHistorical() &&
(img.fileName.includes("release_notes") ||
img.fileName.includes("release-notes")) &&
!pkg.hasSeparateReleaseNotes()
) {
if (skipReleaseNote(img.fileName, pkg)) {
return;
}

Expand Down
2 changes: 0 additions & 2 deletions scripts/pr-previews/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ def _copy_local_content(root_dir: Path) -> None:
"docs/open-source",
"public/videos",
"public/images/guides",
"public/images/migration",
"public/images/optimize",
"public/images/qiskit-ibm-runtime",
"public/images/qiskit-patterns",
]:
dest = (
Expand Down

0 comments on commit 33a35b5

Please sign in to comment.