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

Docusaurus v3 Update #237

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

james-kaguru
Copy link
Contributor

@james-kaguru james-kaguru commented Aug 1, 2024

Description

In this pr I tried to upgrade docusaurus from v2 to v3

Related Issues

Addresses #223

Check List

Not appilcable

Despite being able to upgrade to v3 there are some items that I have noted

Closes #223

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@Eomm Eomm self-assigned this Aug 23, 2024
Copy link
Member

@Eomm Eomm left a comment

Choose a reason for hiding this comment

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

It is not working for me. I get a lot of:

Error: MDX compilation failed for file "/Users/mspigolon/workspace/fastify-org/website-next/versioned_docs/version-v4.19.x/docs/Reference/TypeScript.md"
Cause: Unexpected character `,` (U+002C) in name, expected a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag
Details:
{
  "column": 66,
  "message": "Unexpected character `,` (U+002C) in name, expected a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag",
  "line": 1467,
  "name": "1467:66",
  "place": {
    "line": 1467,
    "column": 66,
    "offset": 52450,
    "_index": 0,
    "_bufferIndex": 59
  },
  "reason": "Unexpected character `,` (U+002C) in name, expected a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag",
  "ruleId": "unexpected-character",
  "source": "micromark-extension-mdx-jsx",
  "url": "https://github.com/micromark/micromark-extension-mdx-jsx#unexpected-character-at-expected-expect"
}

If I remove all the TS files:

find "versioned_docs/" -type f -name "TypeScript.md" -exec rm -f {} +

Now the build works - could ybe ou check it?
I hate this edit phase, but your solution is good, but the replace logic in latest build is not safe, because the line number can change, so we should skip it for it and try a simple find/replace.

@@ -200,7 +201,6 @@ const config = {
}),

plugins: [
'@orama/plugin-docusaurus',
Copy link
Member

Choose a reason for hiding this comment

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

This is a blocker, we need to wait for it

Copy link
Contributor Author

@james-kaguru james-kaguru Aug 25, 2024

Choose a reason for hiding this comment

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

Yes I also enoutered that issue where it says there are some missing items. I was able to pinpoint the issue ...I believe it was due a certain command copying docs from say version-folder/* into version-folder/docs . so when you tun the build website again which is designed to look into version-folder/* and not version-folder/docs which now causes a build error since the files in version-folder/docs were not updated. Will recreate this and get back to you

Copy link
Member

Choose a reason for hiding this comment

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

The fix has been released!

}

let currentLineContent = lines[lineNumber - 1]

Copy link
Member

Choose a reason for hiding this comment

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

Idempotency

Suggested change
if (currentLineContent.includes(newContent)) {
console.log('No changes needed')
return
}

const { join } = path

async function editLine(file, lineNumber, oldContent, newContent) {
const data = await fs.readFile(file, 'utf8')
Copy link
Member

Choose a reason for hiding this comment

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

We can avoid to read the file for each edit, but the script is trivial and fast anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had made the edits line by line so that it would be easy for anyone to identify what items were changed..but we could do a simple regex check in specific files ..cause I noticed that its only a few files that require changing so we could check only in those files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Eomm as for the latest branch I also noticed the issue where we'd be updating beyond the scope. To ensure this I believe it might require some steps

  1. Merge the changes with the latest branch still being checked
  2. Add a docusaurus v3 check in the fastify/fastify build to ensure the latest is always docusaurus compatiple
 npx docusaurus-mdx-checker
  1. Remove the latest check in the docusaurus v3 upgrade

@james-kaguru
Copy link
Contributor Author

@Eomm. The first image was for the a fresh install of the fastify website
Screenshot 2024-08-26 at 8 24 41 AM
as you can see there is no version-latest/docs/ folder that is generated during build

in contrast
Screenshot 2024-08-26 at 8 26 09 AM
the above shows a project later on in time that has version-latest/docs which has the same files as version-latest/* ..I cant seem to identify where the docs is being copied into version-latest/docs.. thats whats causing the issue with the typescript md files..if you take a look at the errors you pointed out it points to a version-v4.19.x/docs/... instead of version-v4.19.x/...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants