Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable API in versioned docs #146

Open
fgatti675 opened this issue Jul 12, 2024 · 3 comments
Open

Disable API in versioned docs #146

fgatti675 opened this issue Jul 12, 2024 · 3 comments

Comments

@fgatti675
Copy link

Hi, me again :)
My docusaurus project has 3 versions, and I only want to generate the API for the latest one. I would like to leave older versions as they are.
If I don't add versioned APIs, I get the error:

[cause]: Error: ENOENT: no such file or directory, open '/website/versioned_docs/version-2.0.0/api-packages.json'

If I generate that file with yarn docusaurus api:version 2.0.0 I get an error for each different API item:

 Error: Can't render static file for pathname "/docs/api/next/function/getValueInPath"

(note that is using next instead of 2.0.0 which is the version name, there are no references to next anywhere in my codebase)

I don't need the API in older versions and would rather have it disabled. Is it possible?
Thanks!

@fgatti675
Copy link
Author

Alternative, I have been trying to simply create a placeholder of the config json files to make the plugin happy, but no luck.
Would you have some examples by any chance?
Thanks!

@milesj
Copy link
Owner

milesj commented Jul 15, 2024

This plugin piggy-backs off docusaurus's official versioning system, so we don't really have much control over it.

However, docusuaurus supports a few options that the plugin inherits, that maybe can work here? They are disableVersioning, onlyIncludeVersions, lastVersion, and a few others.

@sedghi
Copy link

sedghi commented Sep 12, 2024

I'm facing the same issue. I don't want to completely disable the API in my older version, but I'd like to make it functional so it displays something.

Currently, when I run yarn run docusaurus docs:version 1.0, it creates a version but doesn't transfer the API-related content.

The next time (after versioning) I run docusaurus (yarn start), it throws an error stating it can't find api-packages.json.

I considered locating that JSON file and manually copying it to the versioned_docs folder, but I can't find it anywhere.

@milesj, do you know where this file is being saved? I've checked inside the .docusaurus folder, but it's not there.

Here is my docusaurus config

** Update **: If i just dummy create the two files it complains about (api-packages.json and api-typedoc.json) and put them inside the packages/docs/versioned_docs/version-1.0 it successfully compiles, but my current docs (not versioned) lose the api

CleanShot 2024-09-12 at 17 55 24@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants