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
{
2024-07-19 20:35:33 +08:00
"name" : "qiskit-documentation" ,
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
"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" ,
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-24 01:19:24 +08:00
"type" : "module" ,
"files" : [
2024-07-24 20:09:47 +08:00
"dist" ,
2024-07-25 21:15:18 +08:00
"scripts/config/cspell" ,
"scripts/config/internal-links.json"
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-24 01:19:24 +08:00
] ,
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
"scripts" : {
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-24 01:19:24 +08:00
"prepare" : "tsc" ,
2023-10-20 23:35:35 +08:00
"fmt" : "prettier --write ." ,
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-24 01:19:24 +08:00
"test" : "playwright test" ,
2023-11-10 12:48:05 +08:00
"typecheck" : "tsc" ,
2024-07-22 20:53:36 +08:00
"check" : "npm run check:qiskit-bot && npm run check:patterns-index && npm run check:metadata && npm run check:spelling && npm run check:internal-links && npm run check:orphan-pages && npm run check:fmt" ,
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-24 01:19:24 +08:00
"check:metadata" : "tsx scripts/js/commands/checkMetadata.ts" ,
2024-07-24 20:09:47 +08:00
"check:spelling" : "tsx scripts/js/commands/checkSpelling.ts" ,
2024-07-22 20:53:36 +08:00
"check:fmt" : "prettier --check ." ,
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-24 01:19:24 +08:00
"check:internal-links" : "tsx scripts/js/commands/checkInternalLinks.ts" ,
"check:external-links" : "tsx scripts/js/commands/checkExternalLinks.ts" ,
"check:pages-render" : "tsx scripts/js/commands/checkPagesRender.ts" ,
"check:patterns-index" : "tsx scripts/js/commands/checkPatternsIndex.ts" ,
"check:orphan-pages" : "tsx scripts/js/commands/checkOrphanPages.ts" ,
"check:qiskit-bot" : "tsx scripts/js/commands/checkQiskitBotFiles.ts" ,
"check:stale-images" : "tsx scripts/js/commands/checkStaleImages.ts" ,
"regen-apis" : "tsx scripts/js/commands/api/regenerateApiDocs.ts" ,
"gen-api" : "tsx scripts/js/commands/api/updateApiDocs.ts" ,
2024-07-25 21:15:18 +08:00
"make-historical" : "tsx scripts/js/commands/api/convertApiDocsToHistorical.ts" ,
2024-07-31 01:19:21 +08:00
"generate-historical-redirects" : "tsx scripts/js/commands/api/generateHistoricalRedirects.ts" ,
2024-07-25 21:15:18 +08:00
"save-internal-links" : "tsx scripts/js/commands/saveInternalLinks.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
} ,
2024-07-19 20:35:33 +08:00
"dependencies" : {
2023-09-29 21:33:32 +08:00
"cheerio" : "^1.0.0-rc.12" ,
2024-07-29 21:46:02 +08:00
"cspell" : "^8.12.1" ,
2024-07-19 20:35:33 +08:00
"fast-levenshtein" : "^3.0.0" ,
2023-09-29 21:33:32 +08:00
"github-slugger" : "^2.0.0" ,
2024-07-29 21:46:02 +08:00
"globby" : "^14.0.2" ,
2023-09-19 22:01:28 +08:00
"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" ,
2024-07-29 21:46:02 +08:00
"js-yaml" : "^4.1.0" ,
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-24 01:19:24 +08:00
"lodash-es" : "^4.17.21" ,
2024-07-19 20:35:33 +08:00
"markdown-link-extractor" : "^3.1.0" ,
2023-09-29 21:33:32 +08:00
"mdast" : "^3.0.0" ,
2023-09-29 22:55:52 +08:00
"mkdirp" : "^3.0.1" ,
"p-map" : "^6.0.0" ,
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" ,
2024-07-19 20:35:33 +08:00
"transform-markdown-links" : "^2.1.0" ,
2023-09-29 21:33:32 +08:00
"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" ,
2024-07-29 21:46:02 +08:00
"zx" : "^8.1.4"
2023-10-19 22:23:47 +08:00
} ,
2024-07-19 20:35:33 +08:00
"devDependencies" : {
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-24 01:19:24 +08:00
"@playwright/test" : "^1.45.2" ,
2024-07-19 20:35:33 +08:00
"@types/fast-levenshtein" : "^0.0.4" ,
"@types/js-yaml" : "^4.0.9" ,
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-24 01:19:24 +08:00
"@types/lodash-es" : "^4.14.198" ,
2024-07-19 20:35:33 +08:00
"@types/node" : "^20.6.2" ,
"@types/yargs" : "^17.0.28" ,
2024-07-29 21:46:02 +08:00
"prettier" : "^3.3.3" ,
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-24 01:19:24 +08:00
"tsx" : "^4.16.2" ,
2024-07-19 20:35:33 +08:00
"typescript" : "^5.2.2"
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
}
}