Skip to content

Docusaurus2 upgrade for master#14411

Merged
techdocsmith merged 64 commits intoapache:masterfrom
317brian:docusaurus2
Aug 17, 2023
Merged

Docusaurus2 upgrade for master#14411
techdocsmith merged 64 commits intoapache:masterfrom
317brian:docusaurus2

Conversation

@317brian
Copy link
Copy Markdown
Contributor

@317brian 317brian commented Jun 12, 2023

Description

This PR updates master to Docusaurus 2. It backs up the previous website directory to website_old. We can delete it after we’re ready to merge this PR.

You can see a build preview here: https://druid-n5fxtlvhm-317brian.vercel.app/docs/latest/design/. It is completely unstyled and uses OOTB Docusaurus2 settings since this repo only acts as the source of truth for docs. apache/druid-website-src is what builds the prod site.

Related PRs:

Benefits

  • No longer EOL backend!
  • More nesting in the side nav
  • Support for extended Markdown (MDX), which lets you add Javascript to Markdown pages.

Changed

  • The Markdown parser is stricter for Docusaurus2. Impacted docs have already been updated.
  • The format of redirects. To add a new redirect, follow the ones that have already been converted in website/redirects.json in this PR.
  • Sidebar syntax
    • subcategory -> category
    • ids -> items
  • The tab syntax used for things like showing the curl and Python equivalent API calls.
  • The new config file for the site settings is website/docusaurus.config.js
  • Minor change but this PR also deletes docs/operations/getting-started.md. There was a redirect that was written for it. The redirect never gets generated though because the page existed. Deleting the file allows for the redirect to get built.)

Stayed the same

  • Install Docusaurus with npm/yarn install and run the site with npm/yarn start.
  • All the website pages, like the home page and "Downloads" page are still in apache/druid-website-src.
  • The source of truth for the CSS and styling of the prod site is apache/druid-website-src. I didn’t see a need to style this repo since the main concern would be the Markdown rendering correctly, and they both use the same Markdown parser.
  • druid-website-src still builds the production site
  • This repo is the source of truth for the docs, sidebar, and redirects.

Need help on the following:

The link checking script and broken link behavior. I copied the link checking script over and updated the path to actually point at the build output from npm run build, but the output is different depending on how the filepath is declared:

  • const entries = fg.sync(['./build/docs/**/*.html']) results in:There are 13232 issues. That's definitely wrong

  • const entries = fg.sync(['./build/docs/latest/*.html']) results in 1 issue: Could not find '/docs/latest/design/' linked from './build/docs/latest/index.html. I think the issue is that it's not going through the directories recursively, so it can't find the file. But if we do the ** instead of latest, we get 13k issues.

Neither of these are the actual link I broke intentionally to test the link checker, which Docusaurus 2 detects when you run npm run build:

[INFO] Docs markdown link couldn't be resolved: (./bob.md) in "/Users/brian/my-druid-fork/docs/ingestion/ingestion-spec.md" for version current

In the meantime, we can configure Docusaurus 2 to do a one of 2 things on broken links when someone runs the site or tries to build it:

We can either set it to log a command line msg like so for npm run start/build:

[WARNING] Docs markdown link couldn't be resolved: (../ingestion/in.md) in "/Users/brian/my-druid-fork/docs/tutorials/index.md" for version current

We went with this option. See #14411 (comment)
Or we can surface an error in the rendered site:
image

The user can close the error and navigate around the site still.


This PR has:

  • been self-reviewed.

Thanks @ektravel, @writer-jill, @techdocsmith, and @vtlim for helping get this together.

@317brian
Copy link
Copy Markdown
Contributor Author

317brian commented Aug 11, 2023

@vtlim and @techdocsmith can you review and approve this PR:

Check out the PR and do npm start and npm run build in website to verify the docs build

Should we add a GHA step that just runs npm run build to do the link checking built into Docusaurus 2 and do a markdown syntax check on prs?

I guess i should also update https://github.com/apache/druid/blob/master/distribution/asf-release-process-guide.md#update-druidapacheorg in this PR

@317brian
Copy link
Copy Markdown
Contributor Author

Updated asf-release-process-guide.md too, so that's also ready for review.

@317brian
Copy link
Copy Markdown
Contributor Author

f6ec159 (#14411) works as intended. The CI failed with the errant link in the output. Will revert the fake link I put in.
image

Comment thread docs/querying/filters.md Outdated
Comment thread README.md Outdated
Comment thread distribution/asf-release-process-guide.md Outdated
Co-authored-by: Victoria Lim <vtlim@users.noreply.github.com>
Comment thread website_old/README.md Outdated
~ under the License.
-->

# Druid doc builder
Copy link
Copy Markdown
Member

@clintropolis clintropolis Aug 15, 2023

Choose a reason for hiding this comment

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

why do we still need 'website_old' path and small set of files? since this was already merged into a release branch it seems safe to just dump it

Copy link
Copy Markdown
Contributor

@techdocsmith techdocsmith left a comment

Choose a reason for hiding this comment

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

LGTM

@techdocsmith techdocsmith merged commit 6b4dda9 into apache:master Aug 17, 2023
@LakshSingla LakshSingla added this to the 28.0 milestone Oct 12, 2023
@xvrl
Copy link
Copy Markdown
Member

xvrl commented Dec 11, 2023

@techdocsmith @317brian it looks like this removed the website/pom.xml but I couldn't find an explanation for that. This seems to have broken dependabot, because the module is still referenced in one of the maven profiles in the main pom.xml. It's fine if we want to remove the maven build for the website, but can we at least add a comment to explain why we removed it? Thanks!

@317brian
Copy link
Copy Markdown
Contributor Author

Hi @xvrl, this removed the pom.xml for the website directory cause the Druid docs for staging/production aren't built in this repo anymore: #15113 (comment)

I forgot to do that piece of the followup. I'll put up a PR that deletes the profile.

xvrl added a commit to xvrl/druid that referenced this pull request Dec 11, 2023
The website pom was removed as part of
apache#14411 so we no longer need to
reference it as a module and the profile can be removed.

Dependabot is currently failing trying to look for this module, so
removing it should also fix that.
@xvrl
Copy link
Copy Markdown
Member

xvrl commented Dec 11, 2023

no worries @317brian, I already have a PR up to remove the module here #15540

xvrl added a commit that referenced this pull request Dec 12, 2023
The website pom was removed as part of
#14411 so we no longer need to
reference it as a module and the profile can be removed.

Dependabot is currently failing trying to look for this module, so
removing it should also fix that.
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.

7 participants