-
Notifications
You must be signed in to change notification settings - Fork 86
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
Update legacy release notes links #865
Update legacy release notes links #865
Conversation
Thanks for contributing to Qiskit documentation! Before your PR can be merged, it will first need to pass continuous |
Awesome! There are still a lot of links to 0.46 in these release notes, which would be good to point to 0.45 instead. Those can be a simple find and replace for Also you can simplify the link checker |
Thanks for contributing to Qiskit documentation! Before your PR can be merged, it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. Thanks! 🙌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Part of Qiskit#755 This PR changes the legacy release notes links to point to the qiskit 0.45 version folder. ### How the change was done I created a little script to transform every link in a release note file and re-write it in the same destination. I named it `updateLinks.ts`. ```ts import { zxMain } from "../lib/zx"; import { globby } from "globby"; import { pathExists, getRoot } from "../lib/fs"; import { readFile, writeFile } from "fs/promises"; import transformLinks from "transform-markdown-links"; zxMain(async () => { const allVersions = ( await globby("docs/api/qiskit/release-notes/[!index]*") ).map((releaseNotesPath) => releaseNotesPath.split("/").pop()!.split(".").slice(0, -1).join("."), ); for (const releaseNotesVersion of allVersions) { const source = `${getRoot()}/docs/api/qiskit/release-notes/${releaseNotesVersion}.md`; if (await pathExists(source)) { updateLinksFile('qiskit', releaseNotesVersion, source, source); } } }); async function updateLinksFile(pkgName: string, versionWithoutPatch: string, source: string, dest: string) { let markdown = await readFile(source, { encoding: "utf8" }); const regexAbsolutePath = new RegExp( "/api/" + pkgName + "/(?!release-notes)(?![0-9])", ); markdown = transformLinks(markdown, (link, _) => link.replace(regexAbsolutePath, `/api/${pkgName}/0.45/`), ); await writeFile(dest, markdown); } ``` To execute the script using `npm run update-legacy-links` you can modify the `package.json` file by adding the following line in the `scripts` section: ```ts "update-legacy-links": "node -r esbuild-register scripts/commands/updateLinks.ts" ```
Part of #755
This PR changes the legacy release notes links to point to the qiskit 0.45 version folder.
How the change was done
I created a little script to transform every link in a release note file and re-write it in the same destination. I named it
updateLinks.ts
.To execute the script using
npm run update-legacy-links
you can modify thepackage.json
file by adding the following line in thescripts
section: