zhouzi / docusaurus-graphql-plugin

Docusaurus plugin generating Markdown documentation from a GraphQL schema.
https://gabinaureche.com/docusaurus-graphql-plugin/
24 stars 9 forks source link

Specify minimum dependency for graphql #12

Closed McManning closed 1 year ago

McManning commented 1 year ago

Hi,

I recently ran into the following issue:

> docusaurus docs:generate:graphql
[ERROR] TypeError: Cannot read properties of undefined (reading 'QUERY')
    at Object.convertToMarkdown (/home/chase/orapps/wwwroot/review/node_modules/docusaurus-graphql-plugin/build/converters/index.js:24:73)
    at Object.<anonymous> (/home/chase/orapps/wwwroot/review/node_modules/docusaurus-graphql-plugin/build/index.js:92:48)
    at Generator.next (<anonymous>)
    at fulfilled (/home/chase/orapps/wwwroot/review/node_modules/docusaurus-graphql-plugin/build/index.js:24:58)
[INFO] Docusaurus version: 2.3.1
Node version: v16.18.1

Ended up happening because our project was locked to graphql^15. Upgrading to v16 worked, but the cause was definitely unclear until I traced it down.

It might be helpful for others like me if this package specified its minimum peer dependencies.

McManning commented 1 year ago

My mistake, I see you do specify 15 as a minimum. In which case, this issue is a bit different. OperationTypeNode.QUERY did not look like it was available in v15.

zhouzi commented 1 year ago

Thanks for reporting @McManning 🙏 I looked into this and you are right, the plugin is impacted by a few breaking changes between v15 and v16, making it incompatible with v15.

I just published v0.8.2 with a fixed version range, dropping v15 and only keeping ^16.0.0.