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

Add --config and [siteDir] option #490

Closed
Dr-Electron opened this issue Mar 12, 2023 · 10 comments
Closed

Add --config and [siteDir] option #490

Dr-Electron opened this issue Mar 12, 2023 · 10 comments
Labels
wontfix This will not be worked on

Comments

@Dr-Electron
Copy link
Contributor

Is your feature request related to a problem?

Currently, we can't run the gen-api command in the same folder as we have the config, and our config has a different name.
For the built-in start/build command in Docusaurus we therefore use the above-mentioned arguments.

Describe the solution you'd like

Would be nice to pass the siteDir and config option to the gen-api command as well

@Dr-Electron Dr-Electron added the enhancement New feature or request label Mar 12, 2023
@welcome-to-palo-alto-networks

🎉 Thanks for opening your first issue here! Welcome to the community!

@sserrata
Copy link
Member

Hi @Dr-Electron, so if I am understanding correctly, when you pass these options to docusaurus they are not propagating to docusaurus-plugin-openapi-docs?

For example: yarn docusaurus --config path/to/docusaurus.config.js --siteDir /my/siteDir gen-api-docs all

@Dr-Electron
Copy link
Contributor Author

Hmm. So you are suggesting it should work? 😅
Then I probably just did something wrong. But I couldn't get it to work.
Will try again

@sserrata
Copy link
Member

Hi @Dr-Electron, was really just wanting to confirm the issue/behavior you are observing. I am not too familiar with the --config and --siteDir options. Can you share the command(s) you are attempting to run or more context? Thanks!

@Dr-Electron
Copy link
Contributor Author

Dr-Electron commented Mar 13, 2023

Got it. So as I said the docusaurus start command for example has the --config and [siteDir] option.
So now let's imagine for whatever reason the docusaurus.config.js is in a subfolder or has a different name.
To start the deployment I would run for example: yarn docusaurus start --config some-other-name.js.
But now how would I use gen-api-docs in this setup? I can't pass a different config name or directory to it

@sserrata
Copy link
Member

Thanks for the clarification. Not exactly sure how to support this since the Docusaurus config is read in before the OpenAPI plugin. I suspect this is more of a limitation in the Docusaurus CLI than it is a feature gap in our plugin. Perhaps the best step forward would be to open a feature request to request moving/supporting the --config option at the docusaurus level.

Today, it only appears to be supported at the command level, i.e. build, start, swizzle, etc. I suspect this could be the result of there not being many community plugins that extend the CLI, hence why they may have overlooked this use case. Interested to hear your thoughts on the matter.

@Dr-Electron
Copy link
Contributor Author

I never really used the docusaurus cli or looked at its code. So to me it seemed this would be a plugin issue. So thanks for clarifying this.
I will check the source code of the cli and talk with the docusaurus team. Is it fine if I keep this issue open in the meantime as a reference and we can hopefully close everything together later on?

@sserrata
Copy link
Member

Sure, no problem at all. Maybe the Docusaurus team has some idea of how we could support this functionality - please feel free to reference this issue. Thanks!

@sserrata sserrata added wontfix This will not be worked on and removed enhancement New feature or request labels Mar 27, 2024
@sserrata sserrata closed this as not planned Won't fix, can't repro, duplicate, stale Mar 27, 2024
@SirPhemmiey
Copy link

Hello, does anyone have an update on this?

@slorber
Copy link
Contributor

slorber commented Nov 15, 2024

In facebook/docusaurus#10685 I'm adding escape hatch env variables that could help you execute plugin code in other (non-cwd) siteDir and using custom config file names:

  • DOCUSAURUS_CLI_SITE_DIR
  • DOCUSAURUS_CLI_CONFIG

This is likely not the final implementation but the only idea I have without a breaking change. Should be in the upcoming v3.6.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants