1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/website/package.json
Alvin Bryan 54444a395c
Fixed OpenAPI URL renaming (#8726)
## Problem

Our API docs are generated from a specfile that is hosted in
https://us.app.unleash-hosted.com/ushosted

By default the API docs UI will show that URL, which we don't want


![image](https://github.com/user-attachments/assets/c125cf6c-8c97-4a56-84a8-3989725d2e95)

## Previously

We ran a find-and-replace after the mdx files were generated with
`replace-in-file`

## Now

The previous solution is no longer possible because the openapi plugin
changed. Basically, before it generated markdown files that looked like
this:

```
# Create API Key

https://unleash-hosted/whatever

bla bla bla
```
Now it generates files that do not contain the URL and look like this:

```
import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
import ParamsDetails from "@theme/ParamsDetails";

<Heading
  as={"h1"}
  className={"openapi__heading"}
  children={"Configure project access"}
>
</Heading>
```
which themselves get compiled.

## Solution

This PR now downloads the specfile, makes a local copy, then an alters
the server URL in the copy, then uses that local file to generate the
docs.


![image](https://github.com/user-attachments/assets/039644a6-1e72-4145-9c67-9e6203b1673b)


I didn't want to make any changes to the actual spec logic because this
essentially just a plugin quirk

---

[PREVIEW
LINK](https://unleash-docs-git-alvin-fix-openapi-rename-unleash-team.vercel.app/reference/api/unleash/get-addon)
2024-11-14 11:07:23 +00:00

63 lines
2.0 KiB
JSON

{
"name": "websitev-2",
"version": "0.0.0",
"private": true,
"engines": {
"node": ">=18"
},
"scripts": {
"docusaurus": "docusaurus",
"start": "yarn fetch-remote-content && docusaurus start",
"build": "yarn generate && yarn fetch-remote-content && docusaurus build",
"swizzle": "docusaurus swizzle",
"fetch-remote-content": "docusaurus download-remote-content-external && docusaurus download-remote-content-sdks",
"generate": "node prepare-generated-docs.mjs && docusaurus gen-api-docs all",
"deploy": "yarn generate && yarn fetch-remote-content && docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"test": "NODE_ENV=test node --trace-warnings ../node_modules/.bin/jest remote-content"
},
"dependencies": {
"@docusaurus/core": "^3.6.0",
"@docusaurus/plugin-client-redirects": "^3.6.0",
"@docusaurus/plugin-google-analytics": "^3.6.0",
"@docusaurus/preset-classic": "^3.6.0",
"@docusaurus/remark-plugin-npm2yarn": "3.6.0",
"@mdx-js/react": "^3.1.0",
"docusaurus-plugin-openapi-docs": "^4.2.0",
"docusaurus-plugin-remote-content": "^4.0.0",
"docusaurus-theme-openapi-docs": "^4.2.0",
"git-url-parse": "^15.0.0",
"plugin-image-zoom": "flexanalytics/plugin-image-zoom",
"prism-react-renderer": "^2.4.0",
"prism-svelte": "^0.5.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.6.0",
"@docusaurus/types": "^3.6.0",
"@tsconfig/docusaurus": "2.0.3",
"@types/react": "^18.3.12",
"typescript": "5.6.3"
},
"resolutions": {
"http-proxy-middleware": "3.0.3"
},
"packageManager": "yarn@4.5.1"
}