-
Notifications
You must be signed in to change notification settings - Fork 928
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
Docusaurus v2 Beta 17 Upgrade #557
Conversation
Thanks, Clark. I appreciate you being active here again. :)) What exactly has been changed in beta 17 that makes it necessary to version track auto-generated files? Could you please point me to that change? This was not done for a good reason as it creates a bunch of bloat and is completely unnecessary. |
I suggest we first look at exactly what is causing this problem before drawing any conclusions. Also unclear this "CIP-New.md" is not a file that should be created. Without looking at it closely, the probability is high that something else is creating this problem here. The best would be to create a Docusaurus upgrade in a clean separate PR not bundled with many other changes. |
That file was an example actually, and before the example I replicated this error with just exactly two steps: a docursaurus upgrade and then a yarn build as you have described which the lead to this PR. This PR is basically an packages upgrade change and then it broke yarn build so the next step was to fix the issue then submit the PR. So I am confident that docusaurus upgrade simply won't accept random files that's not in repository other wise it produces this error. So no further steps are required, but you are free to test the same thing on your side. The example CIP was my example because I've already fixed the issue for the real CIP files but before that they were also broken right after the docusaurus upgrade. In other words I've already done the work to check it and know the cause, then fixed it and that's why this PR exists now. 😄 |
Thanks, Clark👍, I looked into it and can confirm the issues and changes. I'm still hesitant on the gitignore file changes and I would like to clarify something: The word "bloat" should not judge the importance of these files. Of course, they are important. At the moment we were excluding this in gitignore because I was a little afraid that many people then always post with ShowCase PR etc dozens of automatically-generated files. (which indeed "bloat" the PR readability) It becomes even more difficult for the reviewers to see if the changes are automatic or if people have written manually in the files. In addition, it is no longer clear to people what is being generated automatically and they may make changes to the generated files. All this together with the uncertainty of whether the problem exists only in v17, is enough to discuss this first and not to change the gitignore right now. Most important: why would Docusaurus change this and not mention it in the release notes? (That alone is still an indication that this is simply a bug) And my suggestion is not to rush things now because of this version. Happy to hear other opinions on whether we want to version track auto-generated files (and we will have many more) and how we want to handle that in the future, so we can create an issue/discussion point on this. |
Typically these (for given use case for end users) would be put into deployment or object repository and use submodules instead, but then splitting repository complicates it further too . I appreciate the hard word went in...and do not doubt the details, but I agree with Tommy in that it could potentially complicate review and PR submission process, and would like to vote for waiting , especially given that we do not have a special feature we'd like to add yet. It's not to say we will stop upgrade for good, but just to give enough time for consideration in case fixed upstream |
Docusaurus maintainer here Not sure to understand everything but you should be able to run with a docgen step without any error message. It looks like we have a new bug due to this change: facebook/docusaurus#6593 If you can report it with a smaller repro that would be convenient for us to fix it |
This was also reported on Discord by (probably) another dev. I think it's because nothing is outputted from |
@slorber I appreciate that you are making the effort to post this here and want to thank you. 🙏🏻 Thanks also @Josh-Cena |
Do we already know why git log does not return anything? Just trying to understand the environment where the issue runs. |
It's because these files are dynamically generated during build and never tracked by git. |
@Josh-Cena understood. Thank you. I agree with you at:
|
But that's exactly what we do already: |
So, I think the logger level should be changed to Warning, rather than error. |
Because, still, this is something meaningful: relying on file creation date for the blog posts is totally misleading (or am I wrong?). The warning would serve the purpose for the user to refactor their generation process so that they add the date in the filename, for example. |
This is for docs, if I'm not mistakened. We also |
That is true, we exclude only a few folders below docs from version tracking (in gitignore): /docs/governance/cardano-improvement-proposals/* |
Ok, that's fair. However, there is something missing. If we let it go (as in the past), how the date will be shown in the website? I suspect a dummy date. But, is it really reasonable for production? Should we allow dates to be set as in blog posts? |
Nothing is shown. The docs don't necessarily need to show last update, as is the case of |
About explicitly setting a date, it's certainly something we want to do, see facebook/docusaurus#5691 and facebook/docusaurus#5598 |
Got it. Still, plugins that generates documentation files could easily be able to do the date inferring by their selves (by looking at the git history of the files which generated the docs?), and thereafter including the updated/creation date in the generated file (frontmatter?). |
Awesome, cool then. I'm going to refactor the code to only show the warning once, and make it a warning instead of error-like (although, currently, it just displays as error and do not stops the execution). |
These are not plugins; they are simply |
I said plugins because I know plugins that does such kind of things, like: https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/docusaurus-plugin-typedoc. Some git functions are exposed by the |
The PR facebook/docusaurus#6937 has been merged Can you test with the latest canary and see if there's any improvement? Is the error blocking or just an annoying log? |
Thank you so much @slorber. I can confirm it is fine with 0.0.0-4753. (only the "annoying" log) I'd like to flag that there is still the word "error" in the warning, so you might want to remove that as well. Example: [WARNING] Error: Failed to retrieve the git history for file "/Users/tommy/Sites/developer-portal/docs/governance/cardano-improvement-proposals/CIP-0024.md" because the file is not tracked by git. |
Yeah, that was caused by a logic error. See facebook/docusaurus#6937 (comment) In general, anything that doesn't block the build is only meant to alert you, and if you know what's going on, feel free to ignore it even when it literally says "error"😅 |
👍 Test next canary (facebook/docusaurus#6973 merged), you should now only see a single warning |
@slorber single warning confirmed in 0.0.0-4756. This looks very clean now: (okay, as clean as a warning message can look like) |
Closing this in favor of the Docusaurus v2 beta 18 upgrade #572. Thank you all again. |
This PR upgrades the
cardano-developer-portal
to the latest https://github.com/facebook/docusaurus stable beta.Notable Changes
colorMode
config is now depreciated, customization now requires swizzling the theme although this is a safe and recommended thing to do if really needed.docusaurus build
seems to check git history for the files its compiling, that means auto-generated files now need to be committed to git and just be updated when needed. Added a separateyarn scrap
to scrapCIP
Token Registry
andSerialization Lib
docsEverything else seems to be fully compatible with the upgrade.
Let me know if you guys have any questions