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 22:33:34 +08:00
|
|
|
{
|
|
|
|
"name": "docs",
|
|
|
|
"version": "0.1.0",
|
2023-12-03 07:18:40 +08:00
|
|
|
"description": "The documentation content home for https://docs.quantum.ibm.com.",
|
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 22:33:34 +08:00
|
|
|
"author": "Qiskit Development Team",
|
|
|
|
"license": "Apache-2.0",
|
|
|
|
"scripts": {
|
2023-12-05 02:26:49 +08:00
|
|
|
"check": "npm run check:metadata && npm run check:spelling && npm run check:links && npm run check:fmt",
|
2023-09-29 21:33:32 +08:00
|
|
|
"check:metadata": "node -r esbuild-register scripts/commands/checkMetadata.ts",
|
2023-10-19 22:51:58 +08:00
|
|
|
"check:links": "node -r esbuild-register scripts/commands/checkLinks.ts",
|
2023-12-01 00:41:17 +08:00
|
|
|
"check:spelling": "cspell --relative --no-progress docs/**/*.md* docs/api/**/*.md*",
|
2023-10-20 23:35:35 +08:00
|
|
|
"check:fmt": "prettier --check .",
|
2024-01-06 02:46:27 +08:00
|
|
|
"check-pages-render": "node -r esbuild-register scripts/commands/checkPagesRender.ts",
|
2023-10-20 23:35:35 +08:00
|
|
|
"fmt": "prettier --write .",
|
2023-09-29 21:33:32 +08:00
|
|
|
"test": "jest",
|
2023-11-10 12:48:05 +08:00
|
|
|
"typecheck": "tsc",
|
Automate the regeneration of the API docs (#739)
### Summary
Thanks to #737, the API generation script doesn't need an argument to
specify the CI artifact URL used in the generation. Because of that, we
can automatize the script to regenerate all API docs in the repository.
### New command
The PR adds a new command `regen-apis` where we can regenerate multiple
versions of our three APIs with one command:
```bash
npm run regen-apis
```
By default, all minor releases of each API will be regenerated, but we
can add the `--current-apis-only` argument to regenerate only the latest
stable versions.
```bash
npm run regen-apis -- --current-apis-only
```
Alternatively, you can regenerate only one of the three available APIs.
We can use the `-p` argument, which could be combined with the other
arguments, similarly to the API generation script:
```bash
npm run regen-apis -- -p <pkg-name>
```
### Git instructions
To run the script, we need to create a dedicated branch and have a clean
git status. The script will create a commit per version regenerated and
the developers can git cherry-pick them how they want to create
different PRs.
If the regeneration fails for a specific version, the script will call
`git restore` to avoid mixing changes from two different versions when
regenerating the next one.
### Output
At the end of each call to the new command, we will see a summarization
of all versions regenerated with three different possible outcomes per
version:
<table style="width:100%">
<tr>
<th>Possible Output</th>
<th>Meaning</th>
<th>Creates a new commit</th>
<th>Restores the files</th>
</tr>
<tr>
<td>✅ <pkg-name> <version> regenerated correctly</td>
<td>The regeneration was successful</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>☑️ <pkg-name> <version> is up-to-date</td>
<td>The regeneration was successful, but no files were modified</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>❌ <pkg-name> <version> failed to regenerate</td>
<td>The regeneration failed</td>
<td>No</td>
<td>Yes</td>
</tr>
</table>
Closes #720
---------
Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
2024-02-02 21:19:20 +08:00
|
|
|
"regen-apis": "node -r esbuild-register scripts/commands/regenerateApiDocs.ts",
|
2023-11-29 01:25:09 +08:00
|
|
|
"gen-api": "node -r esbuild-register scripts/commands/updateApiDocs.ts",
|
|
|
|
"make-historical": "node -r esbuild-register scripts/commands/convertApiDocsToHistorical.ts"
|
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 22:33:34 +08:00
|
|
|
},
|
|
|
|
"devDependencies": {
|
2023-09-29 21:33:32 +08:00
|
|
|
"@swc/jest": "^0.2.29",
|
2023-11-17 01:10:19 +08:00
|
|
|
"@types/fast-levenshtein": "^0.0.4",
|
2023-09-29 21:33:32 +08:00
|
|
|
"@types/jest": "^29.5.5",
|
|
|
|
"@types/lodash": "^4.14.198",
|
2023-09-19 22:01:28 +08:00
|
|
|
"@types/node": "^20.6.2",
|
2023-10-19 21:15:33 +08:00
|
|
|
"@types/yargs": "^17.0.28",
|
2023-09-29 21:33:32 +08:00
|
|
|
"cheerio": "^1.0.0-rc.12",
|
2023-09-19 22:01:28 +08:00
|
|
|
"cspell": "^7.3.2",
|
|
|
|
"esbuild-register": "^3.5.0",
|
2023-09-29 21:33:32 +08:00
|
|
|
"github-slugger": "^2.0.0",
|
2023-09-19 22:01:28 +08:00
|
|
|
"globby": "^13.2.2",
|
|
|
|
"gray-matter": "^4.0.3",
|
2023-09-29 21:33:32 +08:00
|
|
|
"hast-util-to-mdast": "^8.3.0",
|
|
|
|
"hast-util-to-text": "^3.1.0",
|
|
|
|
"is-absolute-url": "^4.0.1",
|
|
|
|
"jest": "^29.7.0",
|
|
|
|
"lodash": "^4.17.21",
|
|
|
|
"mdast": "^3.0.0",
|
2023-09-29 22:55:52 +08:00
|
|
|
"mkdirp": "^3.0.1",
|
|
|
|
"p-map": "^6.0.0",
|
2023-10-20 23:35:35 +08:00
|
|
|
"prettier": "^3.0.3",
|
2023-09-29 21:33:32 +08:00
|
|
|
"rehype-parse": "^8.0.0",
|
|
|
|
"rehype-remark": "^9.1.2",
|
|
|
|
"remark-gfm": "^3.0.1",
|
|
|
|
"remark-math": "^5.1.1",
|
|
|
|
"remark-mdx": "^2.3.0",
|
|
|
|
"remark-parse": "^10.0.1",
|
|
|
|
"remark-stringify": "^10.0.3",
|
|
|
|
"typescript": "^5.2.2",
|
|
|
|
"unified": "^10.0.0",
|
2023-09-29 22:55:52 +08:00
|
|
|
"unist-util-visit": "^4.0.0",
|
2023-10-19 21:15:33 +08:00
|
|
|
"yargs": "^17.7.2",
|
2023-09-29 22:55:52 +08:00
|
|
|
"zx": "^7.2.3"
|
2023-10-19 22:23:47 +08:00
|
|
|
},
|
|
|
|
"dependencies": {
|
2024-01-24 05:21:36 +08:00
|
|
|
"esbuild": "^0.19.11",
|
2023-11-17 01:10:19 +08:00
|
|
|
"fast-levenshtein": "^3.0.0",
|
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 18:48:41 +08:00
|
|
|
"markdown-link-extractor": "^3.1.0",
|
|
|
|
"transform-markdown-links": "^2.1.0"
|
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 22:33:34 +08:00
|
|
|
}
|
|
|
|
}
|