-
Notifications
You must be signed in to change notification settings - Fork 27
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
feat: add multi-instance support #449
feat: add multi-instance support #449
Conversation
CodeSee Review Map:Review in an interactive map View more CodeSee Maps Legend |
Thank you @elias-pap for this new feature!!! That's awesome. I will deep dive into the code asap. In the meanwhile, could you add some tests that cover the multi instance case? |
This is a basic e2e test for the simple case.
Thanks for this useful plugin @edno ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I finished the 1st review.
A few comments, but nothing that requires major changes.
Great job @elias-pap 💪
tests/e2e/docusaurus2-graphql-doc-generator-multi-instance-2.config.js
Outdated
Show resolved
Hide resolved
tests/e2e/docusaurus2-graphql-doc-generator-multi-instance-2.config.js
Outdated
Show resolved
Hide resolved
tests/e2e/docusaurus2-graphql-doc-generator-multi-instance.config.js
Outdated
Show resolved
Hide resolved
I am wondering if this feature should be closer to the current Docusaurus multi-instance approach, see https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-plugin-content-docs/src/index.ts#L71 This would mean one command per instance (id), instead of one command for all. That would give a more granular control over the generation to users, and users can still merge both command into a single one with a script. |
That's right, this is how I had implemented it initially and the change required is far more simpler:
"default" is the value of DEFAULT_PLUGIN_ID. I changed my mind later on because this mutates the name of the command, and this seemed a bit weird. Docusaurus handles that detail internally for their But yeah, we can do this instead ! Whatever you think is best. |
Docusaurus also changes the command name (and description): https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-plugin-content-docs/src/index.ts#L89 Both approaches are valid. I would like to stay as close as possible to Docusausus behaviour for the v1 (the v2 will one day allow breaking the dependency to Docusaurus). Ideally, I'd love to see the default command running all. But that will be a nightmare to solve this. And, to stick to KISS principle (I should add this to the contrib guidelines), I think we should go with Docusaurus command per const isDefaultId = opts.id === "default";
const command = isDefaultId ? "graphql-to-doc" : `graphql-to-doc:${opts.id}`;
const description = `Generate GraphQL Schema Documentation for ${opts.schema}`; // trick for helping users
return {
name: "docusaurus-graphql-doc-generator",
extendCli(cli) {
cli
.command(command)
.description(description) And, we can keep the |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
closes #255