1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/website/clean-generated-docs.mjs
Alvin Bryan a1d6795533
Docusaurus v3 (#8485)
- Upgrades to latest Docusaurus
- Upgrades our OpenAPI plugin to latest too
- Removes old, unneeded dependencies
- Our configs and sidebar files now use TypeScript

[Preview
link](https://unleash-docs-git-alvin-docusaurus-v3-unleash-team.vercel.app/)

---------

Co-authored-by: melindafekete <melinda.fekete@getunleash.io>
Co-authored-by: Christopher Kolstad <chriswk@getunleash.io>
2024-10-30 11:55:51 +00:00

31 lines
1.0 KiB
JavaScript

// Description:
//
// ## What
//
// This script replaces all references to the Unleash ushosted instance in the
// generated OpenAPI docs. It removes extra path segments (such as leading
// `/ushosted` instances) and replaces the ushosted base url with something
// user-agnostic.
//
// ## Why
//
// When we host the OpenAPI docs in our official documentation, the generated
// docs shouldn't necessarily point at _one specific instance_, and especially
// not one that the reader is unlikely to ever use. Instead, we can remove all
// the bits that are specific to the generation source we use, and make the docs
// easier to use. In particular, removing the leading `/ushosted` is likely to
// save us loooots of questions.
import { replaceInFileSync } from 'replace-in-file';
const options = {
files: 'docs/reference/api/**/*.api.mdx',
from: [
/\/ushosted/g,
/"https:\/\/us.app.unleash-hosted.com(\/ushosted)?"/g,
'"path":["ushosted",',
],
to: ['', '"<your-unleash-url>"', '"path":['],
};
replaceInFileSync(options);