Skip to content

Replace graphql-docs npm package with gem #8631

Merged
andreslucena merged 16 commits intodecidim:developfrom
i-need-another-coffee:ale/graphql-api
Jan 14, 2022
Merged

Replace graphql-docs npm package with gem #8631
andreslucena merged 16 commits intodecidim:developfrom
i-need-another-coffee:ale/graphql-api

Conversation

@alecslupu
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu commented Dec 20, 2021

🎩 What? Why?

Some NPM packages used by the project are very old. This could affect the project maintenaince and security, as it's not possible to update packages with recent versions. This PR tries to improve that.

These are the main issues found:

  • The graphql-docs npm package is very old and it's not maintained. I've tried to update it but it requires too much work to do it. I've found a gem also called graphql-docs that generates a very similar output but statically. I've created a rake task that uses it and generates those static files in the app/views/static/ folder. Then, I've embeded those files into the docs view, to get a result very similar to the existing solution. The task can be run manually, but it will be run after the creation of the app and after each decidim upgrade. The only "problem" is that this static files should be added to the app repository, and that's a bit ugly.

Most of the work has been done by @leio10 in #8335

📌 Related Issues

Link your PR to an issue

📷 Screenshots

Please add screenshots of the changes you're proposing
image
image

♥️ Thank you!

@alecslupu alecslupu changed the title Refactor Graphql API documentation Improve Graphql API documentation Dec 20, 2021
@alecslupu alecslupu mentioned this pull request Dec 20, 2021
12 tasks
@alecslupu alecslupu force-pushed the ale/graphql-api branch 9 times, most recently from c5fb725 to b5c32ad Compare December 30, 2021 22:29
@alecslupu alecslupu force-pushed the ale/graphql-api branch 3 times, most recently from 425a23f to 36c5304 Compare December 31, 2021 00:17
@alecslupu alecslupu marked this pull request as ready for review December 31, 2021 07:12
@alecslupu alecslupu requested a review from roxanaopr December 31, 2021 07:12
@alecslupu alecslupu mentioned this pull request Jan 2, 2022
12 tasks
roxanaopr
roxanaopr previously approved these changes Jan 3, 2022
@andreslucena
Copy link
Copy Markdown
Member

Most of the work has been done by @leio10 in #8335

On this kind of PRs, where we supersede work done by others and using that as the base, I prefer to have the original commits cherry-picked (or even directly using the original branch as a starter). This is important for respecting the authorship of the original developer.

Is there any other step to be done for seeing this? Locally, after creating the development_app, I see this:

image

I don't see any js nor rails exception

@andreslucena andreslucena changed the title Improve Graphql API documentation Reeplace graphql-docs npm package with gem Jan 4, 2022
@alecslupu
Copy link
Copy Markdown
Contributor Author

alecslupu commented Jan 4, 2022

On this kind of PRs, where we supersede work done by others and using that as the base, I prefer to have the original commits cherry-picked (or even directly using the original branch as a starter). This is important for respecting the authorship of the original developer.

@andreslucena, That particular PR has 22 commits, and i found it hard to cherry-pick the required commits.

On the other hand, in order to test this, you will need to run the following commands (after you refetch):

rake decidim:upgrade
rake decidim_api:generate_docs

additionally, you may want to remove the following:

rm -rf public/decidim-packs/
rm -rf  app/views/static/

@alecslupu alecslupu changed the title Reeplace graphql-docs npm package with gem Replace graphql-docs npm package with gem Jan 4, 2022
@alecslupu
Copy link
Copy Markdown
Contributor Author

Current coverage:
image

andreslucena
andreslucena previously approved these changes Jan 12, 2022
@andreslucena
Copy link
Copy Markdown
Member

Ready to be merged for me, great job 👏🏽 👏🏽

Please change the branch to develop so I can merge it.

@alecslupu
Copy link
Copy Markdown
Contributor Author

Ready to be merged for me, great job 👏🏽 👏🏽

Please change the branch to develop so I can merge it.

@andreslucena , i have added f721f0d that makes the repository switch back to Decidim Core.

Copy link
Copy Markdown
Member

@andreslucena andreslucena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor change (the last one, I promise 😄)

Co-authored-by: Andrés Pereira de Lucena <andreslucena@users.noreply.github.com>
@alecslupu
Copy link
Copy Markdown
Contributor Author

A minor change (the last one, I promise smile)

@andreslucena Fixed. Feel free to merge anytime :)

@andreslucena
Copy link
Copy Markdown
Member

Seems like the CI error in Generators is relevant @alecslupu:

   Don't know how to build task 'decidim_api:generate_docs' (See the list of available tasks with `rails --tasks`) 

Can you check it?

@alecslupu
Copy link
Copy Markdown
Contributor Author

Seems like the CI error in Generators is relevant @alecslupu:

   Don't know how to build task 'decidim_api:generate_docs' (See the list of available tasks with `rails --tasks`) 

Can you check it?

The generator errors is caused by the fact that specs cannot find the task in the develop branch.

Check f721f0d that makes the repository switch back to Decidim Core, and that is actually breaks the generators specs.

@andreslucena
Copy link
Copy Markdown
Member

The generator errors is caused by the fact that specs cannot find the task in the develop branch.

That makes perfect sense 😅

@andreslucena andreslucena merged commit f1939e4 into decidim:develop Jan 14, 2022
@alecslupu alecslupu added this to the 0.27.0 milestone Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants