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

feat: adding ability to build docs (sidebar and toc) with generic script, small refactor to build-post-script #458

Closed

Conversation

boyney123
Copy link
Contributor

@boyney123 boyney123 commented Nov 8, 2021

Description

I'm currently working on #442 which allows us to pull down docs from external repos and render them on our website, a small part of that process the the ability to generate the needed .json file required for the side navigation and table of contents in the docs.

I started by writing my own file which you can see in #442, but after talking to @derberg we explored the ability to reuse what we already have.

This PR introduced and reuses what we already have to allow us to use this code more generically in the future.

Changes

  • build-post-list.js is now build-doc-list.js
  • the script now accepts arguments which allow us to make it more generic (also for use case feat: docs for tools #442).
  • added .node-version file to tell Netlify which version of node to use when building, yargs won't work on super old version

New Arguments

  • output - You can set the output of the file
  • directory - You can specify the directory to process
  • groupByCategories - This allows you to run the script and support the frontmatter format to group categories.
Grouping by front-matter

When groupByCategories is true, the front matter for the menu will be read and consumed. Here is an example

---
weight: 2
title: Installing Modelina
menu:
  docs:
    parent: 'Getting Started'
---

This example will render (in the sidebar):

  • Getting Started
    • Modelina

At the moment the script relies on you having a _section.md file to group your docs (which is OK for a website, but #442 we want to make this abit more generic), and I want to give tool builders the ability to add docs without having to know about _section.md files and enforcing a folder structure on them too much. If they follow this standard markdown pattern they can render what they want on the website (under their tools url which needs to be decided still)

This solution allows people (from external tools) to group their docs without folders and _section.md format.

All they have to do is document the menu > docs > parent which will build the side navigation for them.

@netlify
Copy link

netlify bot commented Nov 8, 2021

❌ Deploy Preview for asyncapi-website failed.
Built without sensitive environment variables

🔨 Explore the source changes: 8c9d69f

🔍 Inspect the deploy log: https://app.netlify.com/sites/asyncapi-website/deploys/618a8101712cfb000882d11a

scripts/build-doc-list.js Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
scripts/build-doc-list.js Outdated Show resolved Hide resolved
boyney123 and others added 3 commits November 9, 2021 10:58
Co-authored-by: Fran Méndez <fmvilas@gmail.com>
…ey123/website into making-build-post-list-more-generic
Copy link
Member

@magicmatatjahu magicmatatjahu left a comment

Choose a reason for hiding this comment

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

Great, but it needs some improvements :)

scripts/build-doc-list.js Outdated Show resolved Hide resolved
scripts/build-doc-list.js Outdated Show resolved Hide resolved
scripts/build-doc-list.js Outdated Show resolved Hide resolved
scripts/build-doc-list.js Outdated Show resolved Hide resolved
@boyney123
Copy link
Contributor Author

Thanks for the reviews.

I decided to look at this again, and I felt the code was bloating in areas, and I think it was time to separate some of the logic.

The new improvements are:

  • new utils.js file (within the scripts dir to share some functions)
  • new build-tools-list.js file which will be used later as part of the GitHub Actions process (for inserting external tools)
  • edited build-docs-list.js just moved common code into the utils and kept it the same.

This will allow us to continue using build-docs-list as we were, but also use yargs in built-tools-list as I need to pass in arguments to build docs for particular tools.

Hopefully, that makes sense.

Copy link
Member

@magicmatatjahu magicmatatjahu left a comment

Choose a reason for hiding this comment

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

One suggestion and one question :)

components/layout/Layout.js Outdated Show resolved Hide resolved
scripts/build-doc-list.js Outdated Show resolved Hide resolved
boyney123 and others added 3 commits November 9, 2021 14:08
Co-authored-by: Maciej Urbańczyk <urbanczyk.maciej.95@gmail.com>
…ey123/website into making-build-post-list-more-generic
@quetzalliwrites
Copy link
Member

quetzalliwrites commented Nov 9, 2021

The main issue I see here (if I am following correctly 😱), is the urls proposed?

So I wanted to give another explanation here of how you want to structure the urls for tools.

(First, remember that I'm talking to you about how I'm already planning on changing our docs main domain as well, so my examples below will make more sense.)

docs.asyncapi.com/tools/modelina

No subsections yet, cause one thing at a time.

Later, we can add/migrate the tools docs and create needed subsections.

@boyney123
Copy link
Contributor Author

Thanks @alequetzalli

The main issue I see here (if I am following correctly 😱), is the URLs proposed?

Yeah at the moment this PR will extend what we have to get the docs onto the main website, but from what I'm reading maybe we should hold fire on this work until you have docs.asyncapi.com ready to go?

Sorry I'm not up to speed on whats happening with docs.asyncapi.com and the plans (maybe I've missed some threads etc)

@quetzalliwrites
Copy link
Member

quetzalliwrites commented Nov 10, 2021

Yeah at the moment this PR will extend what we have to get the docs onto the main website, but from what I'm reading maybe we should hold fire on this work until you have docs.asyncapi.com ready to go?

IMHO, I think you are correct and that we should hold off on merging this one until the new URL redirects are in place. I am thinking I shall prioritize and do this the week after the conference because if I try to get it done before, I don't think Lukasz will have time to process my PRs. 😂😂😂

Sorry I'm not up to speed on whats happening with docs.asyncapi.com and the plans (maybe I've missed some threads etc)

Yes, you're totally right! Sorry about that, I noticed context was missing here.

I have created a Docs issue in our Docs Board to detail all the change implications from this URL cleanup I'm talking here: #459

@boyney123 boyney123 marked this pull request as draft November 21, 2021 19:48
@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation.

There can be many reasons why some specific pull request has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this pull request forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Mar 22, 2022
@quetzalliwrites quetzalliwrites removed their request for review May 26, 2022 01:41
@github-actions github-actions bot removed the stale label Jul 30, 2022
@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation.

There can be many reasons why some specific pull request has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this pull request forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Nov 28, 2022
@derberg derberg removed the stale label Feb 28, 2023
@derberg
Copy link
Member

derberg commented Feb 28, 2023

closing this PR as there is no progress and there were also many changes in related scripts. Better open fresh Pr if you still want to work on it

@derberg derberg closed this Feb 28, 2023
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.

5 participants