Commit Graph

22 Commits

Author SHA1 Message Date
dependabot[bot] 883c198458
Bump micromatch from 4.0.7 to 4.0.8 in the npm_and_yarn group across 1 directory (#1890)
Bumps the npm_and_yarn group with 1 update in the / directory:
[micromatch](https://github.com/micromatch/micromatch).

Updates `micromatch` from 4.0.7 to 4.0.8
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/micromatch/micromatch/releases">micromatch's
releases</a>.</em></p>
<blockquote>
<h2>4.0.8</h2>
<p>Ultimate release that fixes both CVE-2024-4067 and CVE-2024-4068. We
consider the issues low-priority, so even if you see automated scanners
saying otherwise, don't be scared.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md">micromatch's
changelog</a>.</em></p>
<blockquote>
<h2>[4.0.8] - 2024-08-22</h2>
<ul>
<li>backported CVE-2024-4067 fix (from v4.0.6) over to 4.x branch</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="8bd704ec0d"><code>8bd704e</code></a>
4.0.8</li>
<li><a
href="a0e68416a4"><code>a0e6841</code></a>
run verb to generate README documentation</li>
<li><a
href="4ec288484f"><code>4ec2884</code></a>
Merge branch 'v4' into hauserkristof-feature/v4.0.8</li>
<li><a
href="03aa805217"><code>03aa805</code></a>
Merge pull request <a
href="https://redirect.github.com/micromatch/micromatch/issues/266">#266</a>
from hauserkristof/feature/v4.0.8</li>
<li><a
href="814f5f70ef"><code>814f5f7</code></a>
lint</li>
<li><a
href="67fcce6a10"><code>67fcce6</code></a>
fix: CHANGELOG about braces &amp; CVE-2024-4068, v4.0.5</li>
<li><a
href="113f2e3fa7"><code>113f2e3</code></a>
fix: CVE numbers in CHANGELOG</li>
<li><a
href="d9dbd9a266"><code>d9dbd9a</code></a>
feat: updated CHANGELOG</li>
<li><a
href="2ab13157f4"><code>2ab1315</code></a>
fix: use actions/setup-node@v4</li>
<li><a
href="1406ea38f3"><code>1406ea3</code></a>
feat: rework test to work on macos with node 10,12 and 14</li>
<li>Additional commits viewable in <a
href="https://github.com/micromatch/micromatch/compare/4.0.7...4.0.8">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=micromatch&package-manager=npm_and_yarn&previous-version=4.0.7&new-version=4.0.8)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/Qiskit/documentation/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-28 18:36:46 +00:00
Eric Arellano 852bf205d3
Upgrade cspell, Prettier, and transitive deps (#1767)
The main motivation is that old versions of `rimraf` and `glob` are not
supported, and were using `inflight` which was deprecated because it has
a memory leak.
2024-07-29 13:46:02 +00:00
Eric Arellano 8f49061837
Allow running `scripts/js` from other Node projects (#1747)
This PR allows other repositories to depend on this repo as a VCS
requirement, then to run our scripts, like this:

```json
  "scripts": {
    "check": "node node_modules/qiskit-documentation/dist/commands/checkMetadata.js"
  },
  "dependencies": {
    "qiskit-documentation": "qiskit/documentation#3422358984f9ede3a6ac8a2bbe7df517fbd306cb"
  },
```

```
❯ npm run check                       

> my-function-docs@0.1.0 check:metadata
> node node_modules/qiskit-documentation/dist/commands/checkMetadata.js
```

`node_modules/qiskit-documentation` will include only the contents of
`src/js` but compiled to JavaScript, along with `package.json`. That
results in the other project bringing in all of the transitive
dependencies of this repo.

Running scripts locally still works.

## Migration to ES Modules

Before, we were using CommonJS for how imports and module loading works.
However, this was causing issues when trying to run in other repos. The
easiest fix was to migrate to ES Modules by setting `"type": "module"`
in `package.json`.

This required that we set a `.js` file extension in all of our import
statements, and that we use `lodash-es` rather than `lodash`.

## Migration to Playwright

I could not get Jest to play nicely with TypeScript & ES Modules. The
simplest fix was to migrate to Playwright.

We already use Playwright in qiskit-sphinx-theme, so this brings nice
consistency to the open source projects.

## Followup work: fix individual scripts

Some of the scripts may need changes to work in other repositories, like
our internal link checker. For now, `checkMetadata.ts` and
`checkExternalLinks.ts` definitely work.
2024-07-23 17:19:24 +00:00
Eric Arellano 90a3549dfa Fix categorization of dev dependencies (#1740)
We're going to start having some projects install the scripts from this
project as a GitHub VCS requirement. They won't install any of our dev
deps, so we need to fix our categorization.

This only recategorizes and sorts deps. It does not change any version
numbers.
2024-07-19 12:35:33 +00:00
Frank Harkins 48653a0368 Remove tutorials (#1660)
This PR removes tutorial notebooks and related tools as they're being
moved to a closed-source repository.

---------

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
2024-07-15 20:17:34 +00:00
Frank Harkins 0dabb0559d Rewrite learning uploader (#1421)
The requirements for the learning uploader have changed since it was
first created.

It was originally intended to be used locally by writers to quickly push
content to the platform. I wrote it in Python so writers would not need
to install node, and using string manipulations to interact with the
REST API was good enough for just uploading the zip and linking the new
file. It also included functionality for a writer to log into the
database through a CLI.

Now, the uploader is only used in CI, so we don't care about logging in
or sticking to Python, and we want to be able to do more complex
manipulations such as adding new lessons and changing metadata. For this
reason, this PR rewrites the uploader using the official [Directus
SDK](https://docs.directus.io/guides/sdk/), which makes interacting with
the API a lot easier.

---------

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
Co-authored-by: Arnau Casau <47946624+arnaucasau@users.noreply.github.com>
Co-authored-by: Abby Mitchell <23662430+javabster@users.noreply.github.com>
2024-07-09 09:36:21 +00:00
dependabot[bot] f68dc7ce27 Bump braces from 3.0.2 to 3.0.3 in the npm_and_yarn group across 1 directory (#1545)
Bumps the npm_and_yarn group with 1 update in the / directory:
[braces](https://github.com/micromatch/braces).

Updates `braces` from 3.0.2 to 3.0.3
<details>
<summary>Commits</summary>
<ul>
<li><a
href="74b2db2938"><code>74b2db2</code></a>
3.0.3</li>
<li><a
href="88f1429a0f"><code>88f1429</code></a>
update eslint. lint, fix unit tests.</li>
<li><a
href="415d660c30"><code>415d660</code></a>
Snyk js braces 6838727 (<a
href="https://redirect.github.com/micromatch/braces/issues/40">#40</a>)</li>
<li><a
href="190510f79d"><code>190510f</code></a>
fix tests, skip 1 test in test/braces.expand</li>
<li><a
href="716eb9f12d"><code>716eb9f</code></a>
readme bump</li>
<li><a
href="a5851e57f4"><code>a5851e5</code></a>
Merge pull request <a
href="https://redirect.github.com/micromatch/braces/issues/37">#37</a>
from coderaiser/fix/vulnerability</li>
<li><a
href="2092bd1fb1"><code>2092bd1</code></a>
feature: braces: add maxSymbols (<a
href="https://github.com/micromatch/braces/issues/">https://github.com/micromatch/braces/issues/</a>...</li>
<li><a
href="9f5b4cf473"><code>9f5b4cf</code></a>
fix: vulnerability (<a
href="https://security.snyk.io/vuln/SNYK-JS-BRACES-6838727">https://security.snyk.io/vuln/SNYK-JS-BRACES-6838727</a>)</li>
<li><a
href="98414f9f1f"><code>98414f9</code></a>
remove funding file</li>
<li><a
href="665ab5d561"><code>665ab5d</code></a>
update keepEscaping doc (<a
href="https://redirect.github.com/micromatch/braces/issues/27">#27</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/micromatch/braces/compare/3.0.2...3.0.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=braces&package-manager=npm_and_yarn&previous-version=3.0.2&new-version=3.0.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/Qiskit/documentation/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-14 09:50:45 +00:00
Arnau Casau 37676b16be Add check for files in `qiskit_bot.yaml` (#1375)
Closes #1330

This PR adds a check for the qiskit bot config to avoid the
`qiskit_bot.yaml` becoming stale.

The check shows two lists of files that can lead to an error:

The first one is for files that exist in the repo but don't have any
entry in the qiskit bot entry. This case will be triggered when we add
new files or we rename old ones without changing the configuration. If
we don't want to track a new file, we can add its path to the
`ALLOWED_OWNERLESS_FILES` set to avoid the error message.

The second list of files are the ones that don't exist in the repo but
have an entry in the config file. This case will be triggered by files
that change their name, removed files with the entry as a leftover, or
files where we set the config beforehand. The last ones can be added to
the `ALLOWED_INEXISTENT_FILES` set to avoid the error message.

The renamed files trigger both errors and will show the old name in the
first list, and the new name in the second one. This could be useful to
identify the old entries in the config file and to associate the files
in case we have multiple errors.

---------

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
2024-05-15 16:13:30 +00:00
dependabot[bot] 230ea7fa08 Bump katex from 0.16.8 to 0.16.10 (#1092)
Bumps [katex](https://github.com/KaTeX/KaTeX) from 0.16.8 to 0.16.10.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/KaTeX/KaTeX/releases">katex's
releases</a>.</em></p>
<blockquote>
<h2>v0.16.10</h2>
<h2><a
href="https://github.com/KaTeX/KaTeX/compare/v0.16.9...v0.16.10">0.16.10</a>
(2024-03-24)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>\edef bypassing maxExpand via exponential blowup (<a
href="e88b4c357f">e88b4c3</a>)</li>
<li>escape \includegraphics src and alt (<a
href="c5897fcd1f">c5897fc</a>)</li>
<li>force protocol to be lowercase for better protocol filtering (<a
href="fc5af64183">fc5af64</a>),
closes <a
href="https://github.com//datatracker.ietf.org/doc/html/rfc3986/issues/section-3">/datatracker.ietf.org/doc/html/rfc3986#section-3</a></li>
<li>maxExpand limit with Unicode sub/superscripts (<a
href="085e21b5da">085e21b</a>)</li>
</ul>
<h2>v0.16.9</h2>
<h2><a
href="https://github.com/KaTeX/KaTeX/compare/v0.16.8...v0.16.9">0.16.9</a>
(2023-10-02)</h2>
<h3>Features</h3>
<ul>
<li>Support bold Fraktur (<a
href="https://redirect.github.com/KaTeX/KaTeX/issues/3777">#3777</a>)
(<a
href="240d5aede9">240d5ae</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/KaTeX/KaTeX/blob/main/CHANGELOG.md">katex's
changelog</a>.</em></p>
<blockquote>
<h2><a
href="https://github.com/KaTeX/KaTeX/compare/v0.16.9...v0.16.10">0.16.10</a>
(2024-03-24)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>\edef bypassing maxExpand via exponential blowup (<a
href="e88b4c357f">e88b4c3</a>)</li>
<li>escape \includegraphics src and alt (<a
href="c5897fcd1f">c5897fc</a>)</li>
<li>force protocol to be lowercase for better protocol filtering (<a
href="fc5af64183">fc5af64</a>),
closes <a
href="https://github.com//datatracker.ietf.org/doc/html/rfc3986/issues/section-3">/datatracker.ietf.org/doc/html/rfc3986#section-3</a></li>
<li>maxExpand limit with Unicode sub/superscripts (<a
href="085e21b5da">085e21b</a>)</li>
</ul>
<h2><a
href="https://github.com/KaTeX/KaTeX/compare/v0.16.8...v0.16.9">0.16.9</a>
(2023-10-02)</h2>
<h3>Features</h3>
<ul>
<li>Support bold Fraktur (<a
href="https://redirect.github.com/KaTeX/KaTeX/issues/3777">#3777</a>)
(<a
href="240d5aede9">240d5ae</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="ab323598fb"><code>ab32359</code></a>
chore(release): 0.16.10 [ci skip]</li>
<li><a
href="fc5af64183"><code>fc5af64</code></a>
fix: force protocol to be lowercase for better protocol filtering</li>
<li><a
href="085e21b5da"><code>085e21b</code></a>
fix: maxExpand limit with Unicode sub/superscripts</li>
<li><a
href="e88b4c357f"><code>e88b4c3</code></a>
fix: \edef bypassing maxExpand via exponential blowup</li>
<li><a
href="c5897fcd1f"><code>c5897fc</code></a>
fix: escape \includegraphics src and alt</li>
<li><a
href="5677f378ce"><code>5677f37</code></a>
chore: fix some typos (<a
href="https://redirect.github.com/KaTeX/KaTeX/issues/3936">#3936</a>)</li>
<li><a
href="d9640f1cde"><code>d9640f1</code></a>
chore(deps): update dependency json-stable-stringify to v1.1.1 [skip
netlify]...</li>
<li><a
href="9a1f2f2029"><code>9a1f2f2</code></a>
chore(deps): update dependency css-loader to v6.10.0 [skip netlify] (<a
href="https://redirect.github.com/KaTeX/KaTeX/issues/3887">#3887</a>)</li>
<li><a
href="185186013d"><code>1851860</code></a>
chore(deps): update dependency cssnano to v5.1.15 [skip netlify] (<a
href="https://redirect.github.com/KaTeX/KaTeX/issues/3883">#3883</a>)</li>
<li><a
href="e69d8b1e26"><code>e69d8b1</code></a>
chore(deps): update dependency browserslist to v4.23.0 [skip netlify]
(<a
href="https://redirect.github.com/KaTeX/KaTeX/issues/3886">#3886</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/KaTeX/KaTeX/compare/v0.16.8...v0.16.10">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=katex&package-manager=npm_and_yarn&previous-version=0.16.8&new-version=0.16.10)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/Qiskit/documentation/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-26 14:21:16 +00:00
Rebecca Dimock 8637cf98e1 Add expanded alt text for relevant images (#627)
Closes #626

---------

Co-authored-by: abbycross <across@us.ibm.com>
2024-01-23 21:21:36 +00:00
Arnau Casau ba9f3de7a9 Stop using a web server for the API docs generation (#578)
### Summary

This PR is part of #564 and changes the `updateApiDocs.ts` script to
stop using a web server and a web crawler for the API docs generation.
Instead, the script uses the HTML in the artifact zip file to convert it
into markdown and copies the images from the same zip to the respective
version folder without downloading it from any web server.

### Details

#### Convert HTML to markdown

After removing the web crawler used to download the HTML files that the
script translated into markdown, we need to take into account HTML files
that are used as a redirect, like `stubs/qiskit.utils.name_args.html`
for Qiskit v0.45:

```html
<html><head><meta http-equiv="refresh" content="0; url=https://qiskit.org/documentation/apidoc/utils.html#qiskit.utils.name_args"></head></html>
```

These files were not downloaded using the web crawler and therefore, not
processed by the `sphinxHtmlToMarkdown` function. Now, the script will
try to convert those files into markdown as well, ending up in an empty
markdown file we need to remove. That is translated into this
conditional in `updateApisDocs.ts`:

```ts
if (result.markdown == "") {
  continue;
}
```

#### Save images

As for the images, we don't need the web server because we can find them
in the folder called `_images` inside the artifact zip file. The script
will copy all the images to the correct API version images folder.
Moreover, the script only saves the images corresponding to the release
notes for the current APIs (not using the historical argument). This
change will allow us to remove unnecessary duplicate images we are
currently downloading.

#### Bug fix

In addition to that change, the PR fixes an underlying issue with the
old method. We were only downloading images when they were not present
in the API images folder by checking if we already had a file with the
same name. New versions of the same API have new images with the same
name as the old ones, and because of that, we were never saving the new
ones.

All the historical versions will be regenerated in a follow-up.

Commands used:
```bash
npm run gen-api -- -p qiskit -v 0.45.0 -a https://github.com/Qiskit/qiskit/actions/runs/6744953436/artifacts/1026798160
npm run gen-api -- -p qiskit-ibm-provider -v 0.7.3 -a https://github.com/Qiskit/qiskit-ibm-provider/actions/runs/7301486985/artifacts/1131430696
npm run gen-api -- -p qiskit-ibm-runtime -v 0.17.0 -a https://github.com/Qiskit/qiskit-ibm-runtime/suites/18863019852/artifacts/1100724937
```

Closes #564

---------

Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
2024-01-03 13:15:52 +00:00
Arnau Casau 3ccf20c3be Fix Qiskit release notes relative links (#400)
This PR fixes the broken relative links of the Qiskit release notes. The
links are originally valid, but because we have the release notes in a
subfolder, we need to update the relative paths.

To update every link, I used the `updateApiDocs.ts` script, but added
another function to read every link and add `/api/qiskit` in front of
each relative path. This function was executed in line 220, followed by
process.exit() to avoid doing anything else.

<details>
 <summary>Function to convert relative links</summary>

```typescript
async function updateLinksReleaseNotes(
  projectName: string,
  legacyReleaseNoteEntries: { title: string; url: string }[],
) {
  for (let entry of legacyReleaseNoteEntries) {
    let source = await readFile(
      `${getRoot()}/docs/api/${projectName}/release-notes/${entry.title}.md`,
      { encoding: "utf8" },
    );

    source = transformLinks(source, (link, _) =>
    link.startsWith("http") || link.startsWith("#") || link.startsWith("/")
      ? link
      : `/api/${projectName}/${link}`,
  );

    await writeFile(
      `${getRoot()}/docs/api/${projectName}/release-notes/${entry.title}.md`,
      source,
    );
  }
}
```
</details>

The PR still needs to modify the `updateApiDocs.ts` to update the
relative links of the newest release notes we download when we run the
script.

Closes #386
2023-11-24 10:48:41 +00:00
Arnau Casau 4f97791c29 Link checker: did you mean feature (#348)
### Summary

This PR adds a suggestion of a valid link for every broken link that the
link checker finds. This feature only works with internal links and
anchors.

To calculate the best replacement for a broken link, the function
`didYouMean` in `scripts/lib/LinkChecker.ts` uses the [Levenshtein
distance](https://en.wikipedia.org/wiki/Levenshtein_distance) between
the broken link and all the files we have in docs, as it was originally
suggested in #4.

The package used to implement the Levenshtein distance calculation is
[fast-levenshtein](https://www.npmjs.com/package/fast-levenshtein).
2023-11-16 18:10:19 +01:00
Eric Arellano fdfc2e5e2e Autoformat TypeScript with Prettier (#76)
Relates to https://github.com/Qiskit/documentation/issues/6, which is
about docs. This PR only adds Prettier to our support code. We might
want to extend Prettier to docs in a follow up.

Having a consistent format is convenient and saves us time so that
humans don't have to manually move things around.

We have a non-trivial amount of TypeScript tooling, so this is worth
adding imo.
2023-10-20 11:35:35 -04:00
dependabot[bot] 86c0ccd31e Bump @babel/traverse from 7.23.0 to 7.23.2 (#214)
Bumps
[@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse)
from 7.23.0 to 7.23.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/babel/babel/releases"><code>@​babel/traverse</code>'s
releases</a>.</em></p>
<blockquote>
<h2>v7.23.2 (2023-10-11)</h2>
<p><strong>NOTE</strong>: This release also re-publishes
<code>@babel/core</code>, even if it does not appear in the linked
release commit.</p>
<p>Thanks <a
href="https://github.com/jimmydief"><code>@​jimmydief</code></a> for
your first PR!</p>
<h4>🐛 Bug Fix</h4>
<ul>
<li><code>babel-traverse</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/16033">#16033</a>
Only evaluate own String/Number/Math methods (<a
href="https://github.com/nicolo-ribaudo"><code>@​nicolo-ribaudo</code></a>)</li>
</ul>
</li>
<li><code>babel-preset-typescript</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/16022">#16022</a>
Rewrite <code>.tsx</code> extension when using
<code>rewriteImportExtensions</code> (<a
href="https://github.com/jimmydief"><code>@​jimmydief</code></a>)</li>
</ul>
</li>
<li><code>babel-helpers</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/16017">#16017</a>
Fix: fallback to typeof when toString is applied to incompatible object
(<a href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
</ul>
</li>
<li><code>babel-helpers</code>,
<code>babel-plugin-transform-modules-commonjs</code>,
<code>babel-runtime-corejs2</code>, <code>babel-runtime-corejs3</code>,
<code>babel-runtime</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/16025">#16025</a>
Avoid override mistake in namespace imports (<a
href="https://github.com/nicolo-ribaudo"><code>@​nicolo-ribaudo</code></a>)</li>
</ul>
</li>
</ul>
<h4>Committers: 5</h4>
<ul>
<li>Babel Bot (<a
href="https://github.com/babel-bot"><code>@​babel-bot</code></a>)</li>
<li>Huáng Jùnliàng (<a
href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
<li>James Diefenderfer (<a
href="https://github.com/jimmydief"><code>@​jimmydief</code></a>)</li>
<li>Nicolò Ribaudo (<a
href="https://github.com/nicolo-ribaudo"><code>@​nicolo-ribaudo</code></a>)</li>
<li><a
href="https://github.com/liuxingbaoyu"><code>@​liuxingbaoyu</code></a></li>
</ul>
<h2>v7.23.1 (2023-09-25)</h2>
<p>Re-publishing <code>@babel/helpers</code> due to a publishing error
in 7.23.0.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/babel/babel/blob/main/CHANGELOG.md"><code>@​babel/traverse</code>'s
changelog</a>.</em></p>
<blockquote>
<h2>v7.23.2 (2023-10-11)</h2>
<h4>🐛 Bug Fix</h4>
<ul>
<li><code>babel-traverse</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/16033">#16033</a>
Only evaluate own String/Number/Math methods (<a
href="https://github.com/nicolo-ribaudo"><code>@​nicolo-ribaudo</code></a>)</li>
</ul>
</li>
<li><code>babel-preset-typescript</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/16022">#16022</a>
Rewrite <code>.tsx</code> extension when using
<code>rewriteImportExtensions</code> (<a
href="https://github.com/jimmydief"><code>@​jimmydief</code></a>)</li>
</ul>
</li>
<li><code>babel-helpers</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/16017">#16017</a>
Fix: fallback to typeof when toString is applied to incompatible object
(<a href="https://github.com/JLHwung"><code>@​JLHwung</code></a>)</li>
</ul>
</li>
<li><code>babel-helpers</code>,
<code>babel-plugin-transform-modules-commonjs</code>,
<code>babel-runtime-corejs2</code>, <code>babel-runtime-corejs3</code>,
<code>babel-runtime</code>
<ul>
<li><a
href="https://redirect.github.com/babel/babel/pull/16025">#16025</a>
Avoid override mistake in namespace imports (<a
href="https://github.com/nicolo-ribaudo"><code>@​nicolo-ribaudo</code></a>)</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="b4b9942a6c"><code>b4b9942</code></a>
v7.23.2</li>
<li><a
href="b13376b346"><code>b13376b</code></a>
Only evaluate own String/Number/Math methods (<a
href="https://github.com/babel/babel/tree/HEAD/packages/babel-traverse/issues/16033">#16033</a>)</li>
<li>See full diff in <a
href="https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@babel/traverse&package-manager=npm_and_yarn&previous-version=7.23.0&new-version=7.23.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/Qiskit/documentation/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-20 16:15:26 +01:00
abbycross 4cc3df1c14 Fixing straggler broken links (#206)
Closes #203 

I am making use of @frankharkins's new link checker!
2023-10-19 14:36:32 -04:00
Frank Harkins 49b403e762 Add script to check links (#173)
This PR adds a link-checking script to verify internal links work. It
should be easy to extend this to check external links, and anchors
within internal links. All comments welcome.

### Details

Uses `markdown-link-extractor`, which is used by `markdown-link-check`
(one of the proposed tools).

***

First part of #4
2023-10-19 10:23:47 -04:00
Eric Arellano 9daee97000 Allow generating API docs for specific projects (#196)
One of the ideas from https://github.com/Qiskit/documentation/issues/63.
This is useful to me right now because I want to only redo
qiskit-ibm-provider.

`yargs` is a popular command line library in JavaScript. I've used it in
a personal project and had a great experience with it.

There will be future config we need to add, like probably having users
tell us what CI URL to look at when generating the docs, whereas right
now we pull from the live websites (see #63). I think it's likely that
config will be best set via a config file, rather than command line
arguments. But, even if we have that config file in the future, I still
think we'd want `--packages` to be a CLI arg since that is a quick thing
that you want to be flexible with setting, vs updating a file. If we
switch 100% to a file, that's fine; we can always remove `yargs`.
2023-10-19 09:15:33 -04:00
Eric Arellano aee6374bc5 Migrate API pipeline script from closed source (#64)
Part 2 of https://github.com/Qiskit/documentation/issues/9.

The final part will run this script to generate the API docs. There are
some things I want to tweak in the script like that the
qiskit-ibm-runtime site has changed URLs, but I wanted to avoid making
changes to the script in this PR so that it simply copies them over.

This PR simply copies over the API pipeline written by @axelhzf from
closed source to open source. Its only modifications are adding
copyright headers and removing unused code from utility files.

https://github.com/Qiskit/documentation/issues/63 tracks some ideas to
simplify this pipeline in follow ups, such as not needing GitHub.

Co-authored-by: Axel Hernández Ferrera <axelhzf@gmail.com>
2023-09-29 10:55:52 -04:00
Eric Arellano 3b1aa5cc7a Add Jest and Sphinx parsing library (#61)
## Background

First part of https://github.com/Qiskit/documentation/issues/9. The docs
infrastructure expects MDX files, but `qiskit`, `qiskit-ibm-provider`,
and `qiskit-ibm-runtime` use Sphinx to generate their API references
from source code. So, @axelhzf created a pipeline to convert Sphinx
output to MDX.

We are moving that pipeline to live in open source since the API
references are also open source.

## What this PR does

This adds the `lib/sphinx` code and its tests. The code is copied over
without change, other than adding copyright headers. The PR also sets up
Jest.

A follow up PR will add the actual parsing script. I split up the PRs
since this adds non-trivial infrastructure like Jest, so to have a
smaller PR to review.

This code will be deleted from the internal repository once
https://github.com/Qiskit/documentation/issues/9 is complete and the
internal repository is consuming this one.

## Why Jest?

We use Playwright in https://github.com/Qiskit/qiskit_sphinx_theme, so I
considered using that too here for consistency.

But I stuck with the internal repo's decision to use Jest because
Playwright doesn't have an equivalent to `toMatchInlineSnapshot`. I
think Playwright is awesome, but we're never going to have Playwright
integration tests in this repository since we're not testing the docs
site itself in this repo, i.e. we don't need to spin up a server. Jest
is simpler for our unit tests.

Co-authored-by: Axel Hernández Ferrera <axelhzf@gmail.com>
2023-09-29 09:33:32 -04:00
Eric Arellano ca603cda4e Check for valid metadata (#56)
In the closed source repository that consumes Qiskit/docs, we have this
same check for valid file metadata. It is useful to run it here too so
that we fail more eagerly.

Like the internal code, this uses TypeScript. It makes the code more
readable and better aligned with the internal code.

---------

Co-authored-by: Axel Hernández Ferrera <axelhzf@gmail.com>
2023-09-19 08:01:28 -06:00
Eric Arellano dd9809bd5c Set up NPM, GitHub Actions, and cSpell (#52)
Closes https://github.com/Qiskit/docs/issues/5.

This sets up some initial infrastructure for the repository, like CI and
the folder structure from @axelhzf's proof of concept of how to open
source documentation content.

Follow up PRs will build on this infrastructure as part of
https://github.com/Qiskit/docs/milestone/1.

## Synchronizing cSpell config with closed source

This PR copies the closed source config for cSpell.

It's a bummer that this config is duplicated. I considered if we should
automate synchronizing the config file, which would need to be the
closed source repo pulling in the closed source file, since the open
source repo cannot access the closed source repo. But I think it's not
worth the complexity to automate this, at least for now.

The closed source repository will open up a PR to use a new version of
this qiskit/docs repository. That PR will run its own spellcheck. So if
there is new content with typos, the spellcheck will fail, which is a
signal that we need to update the closed source cSpell config.

If this ends up not being sustainable, then I recommend we figure out
how to automate syncing. But for now, keep it simple.

---------

Co-authored-by: Axel Hernández Ferrera <axelhzf@gmail.com>
Co-authored-by: Eric Harvey <eric@harvey.io>
2023-09-12 08:33:34 -06:00