qiskit-documentation/package.json

74 lines
2.7 KiB
JSON
Raw Normal View History

{
"name": "qiskit-documentation",
"version": "0.1.0",
"description": "The documentation content home for https://docs.quantum.ibm.com.",
"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": [
"dist",
"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
],
"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",
"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",
"typecheck": "tsc",
"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",
"check:spelling": "tsx scripts/js/commands/checkSpelling.ts",
"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",
"make-historical": "tsx scripts/js/commands/api/convertApiDocsToHistorical.ts",
"save-internal-links": "tsx scripts/js/commands/saveInternalLinks.ts"
},
"dependencies": {
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 21:33:32 +08:00
"cheerio": "^1.0.0-rc.12",
"cspell": "^7.3.2",
"fast-levenshtein": "^3.0.0",
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 21:33:32 +08:00
"github-slugger": "^2.0.0",
"globby": "^13.2.2",
"gray-matter": "^4.0.3",
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 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",
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",
"markdown-link-extractor": "^3.1.0",
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 21:33:32 +08:00
"mdast": "^3.0.0",
"mkdirp": "^3.0.1",
"p-map": "^6.0.0",
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 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",
"transform-markdown-links": "^2.1.0",
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 21:33:32 +08:00
"unified": "^10.0.0",
"unist-util-visit": "^4.0.0",
"yargs": "^17.7.2",
"zx": "^7.2.3"
},
"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",
"@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",
"@types/node": "^20.6.2",
"@types/yargs": "^17.0.28",
"prettier": "^3.0.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",
"typescript": "^5.2.2"
}
}