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: set up optimize docs instance and move one doc over #1166

Merged
merged 10 commits into from
Aug 31, 2022

Conversation

pepopowitz
Copy link
Collaborator

@pepopowitz pepopowitz commented Aug 16, 2022

Part of #1116.

  • Adds a second docs plugin for Optimize documentation
  • Moves what-is-optimize doc into Optimize docs plugin
  • Configures sidebars for cross-plugin navigation
  • Updates links in documentation for cross-plugin navigation (what-is-optimize doc only)
  • Updates mappings in expandVersionedUrl based on the fact that there are no optimize versions yet
  • Adds a script and some instructions for generating the optimize_sidebars.js file

Scope

Only one doc is moved in this PR! But, it is completely moved, and the PR includes all setup needed so that we can iteratively move docs in ensuing PRs. It also demonstrates what all needs to be done to move a doc, so we should be able to follow it as a guide.

Out of scope of this PR

There are several details that are not included in this PR which disrupt the experience of reading/navigating docs within the Optimize section:

  • The "Components" top-nav item is not active within the Optimize section
    image
  • The version selector shows main versions, instead of Optimize versions, in the Optimize section
    image
  • The "this is unreleased documentation, see the latest version" warning does not appear in the Optimize section. (This one will likely take care of itself when I get to the stage of adding more Optimize versions)
    image
  • The footer links to the next/previous documents are empty at the beginning/end of the Optimize section, and for the components surrounding Optimize the links skip over the Optimize section:

These items are all in scope of #1116, the parent issue, but I've elected to exclude them from this PR. I think they're all important issues for us to resolve, but I don't think they are required to move docs iteratively into the Optimize section. If you think I'm incorrect, and they are important to include in this PR, let me know!

Proof that it includes all latest Optimize updates

Note the last updated timestamp in the docs/components/optimize folder:

image

These timestamps are all older than the timestamp for the first commit in which I moved the what-is-optimize doc:

image

Implementation notes

Other notes

Note to future us: docusaurus has an item on their roadmap to enable separate docs plugins to talk to each other, at which time we might be able to undo this cross-linking experience in favor of something built into docusaurus 🙌

id: "optimize",
path: "optimize",
routeBasePath: "optimize",
// sidebarPath: require.resolve("./optimize_sidebars.js"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll remove this, it looks like it assumes this same path anyway.

- Automate
- Improve

A user can design process flows through our [Modeler](/docs/next/components/modeler/about-modeler/). In a production scenario, you can deploy through Desktop Modeler, Web Modeler, or programmatically. A user can use [Tasklist](/docs/next/components/tasklist/introduction-to-tasklist/) to review and complete tasks, and [Operate](/docs/next/components/operate/operate-introduction) to view and analyze process instances.
Copy link
Collaborator Author

@pepopowitz pepopowitz Aug 16, 2022

Choose a reason for hiding this comment

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

👋 👀

FYI I'm going to add an issue for the outcome of this very long note, but I also want to get feedback from people @christinaausley @akeller @korthout in case you think I'm wasting my time and being overly dramatic.


This is ....kind of sucky. These links all had to change from the originals. e.g. [Operate](/components/operate/operate-introduction.md) changed to [Operate](/docs/next/components/operate/operate-introduction)

Why?

This is because the links cross from one docs plugin to the other (that's how we implement multi-versioning in docusaurus -- two docs plugins, one for each set of versions).

Previously we were able to specify the doc ID and path via source....and docusaurus would magically find the doc you were linking to. We didn't need to know the URL, and we didn't have to specify a version because it used the same version you were browsing.

But now that they're cross-plugin, we have to specify the full URL of the target doc. This includes the version....which to some degree makes sense, because d-rex doesn't know that Optimize v3.8.0 is associated with C8 v8.0.

Why it's awful

Where it especially stinks though, is in the "next" and "current" docs. In the "next" docs, we'll want Optimize to link to C8 "next", and C8 to link to Optimize "next". When we cut versions 3.9.0/8.1 from that, we'll have to go through and replace every markdown link in those versions to remove the "/next" from the path. And then we'll have to go through the current 3.8.0/8.0 docs, and replace all those markdown links to add "/3.8.0" or "8.0".

This feels like a lot of friction. I didn't catch this when building the POCs. It'll be a pain for people writing docs because they can't just copy/paste their changes from the next version into current (or vice versa). It'll be a pain for reviewers because we'll overlook it all the time. It'll be a pain when we cut new versions.

There is also friction caused by sidebars needing to be expanded to include full URLs when crossing docs plugins. But I'm comfortable over-looking that friction because we don't modify the sidebars files very often.

Introducing friction on every markdown link, though, seems like it'll be extremely un-fun.

What I think we can do about it

So right now my theory is this: we could write an MDX plugin for these docs so that we can write something like this in the markdown:

Hello I like Camunda especially [the modeler]($docs$/components/modeler/about-modeler)

and the mdx plugin would see the $docs$ token, and replace it with the correctly mapped version path. e.g:

  • if it was found in a doc from optimize/next, it would replace it with /docs/next/
  • if it was found in a doc from optimize/3.7.0, it would replace it with /docs/1.3/
  • if it was found in a doc from optimize/3.8.0, /docs/ (at least right now....when 8.0 is current.)
  • and same to go backwards, from links found in docs from c8 into optimize.

A caveat

I haven't worked with MDX plugins before. I'm looking forward to the fun of writing one, but I don't really know what is or isn't possible in the context of a docusaurus site. So I guess we'll find out if my theory (or something similar) is anywhere feasible.

Copy link
Member

Choose a reason for hiding this comment

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

@RomanJRW wanted to pull you in here as well for feedback since you are the EM of Optimize.

@pepopowitz This friction aligns with what I expected from supporting this multi-version structured approach. I like the idea of the MDX plugin and would find it critical to support the Optimize and DX teams moving forward to reduce this friction.

This also assumes (or maybe implies is a better word here) that the versioning is tightly coupled.

  • Optimize 3.7.0 + CC 1.3
  • Optimize 3.8.0 + C8.0
  • Optimize 3.9.0 + C8.1

On the product side, I would want to understand if this is true. From a SaaS perspective, I think everything gets upgraded together when you hit the update button.

I tested with Zeebe 8.0.4 (Optimize 3.8.1) -> Zeebe 8.0.5 (Optimize 3.8.5). I had no option to update anything separately.

But what about for Self-Managed? Or can I upgrade/update Zeebe but not Optimize, or vice versa? This would be a question for the Optimize team. I would love for the documentation to mirror the recommended structure or coupling.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

two bits of context I should have shared, from a conversation with @RomanJRW:

  1. This list of optimize releases.
  2. Optimize has decided to align their release schedule with that of C8. (I don't have this in writing anywhere, but I think that's what Josh told me)

Those two facts, combined with the fact that we only have "Optimize" docs starting in the platform version 1.3 docs, lead me to believe that the versioning is tightly coupled, with the specific versions you listed, and will be in the future.

Copy link
Member

@korthout korthout Aug 17, 2022

Choose a reason for hiding this comment

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

@pepopowitz As part of the summerhackdays 2022, I recently created some MDX pages for Docusaurus that embed 2 custom build React components (LiveFeel, and Editor). This was rather simple TBH. I was surprised by the freedom we had in there.

I think that MDX plugins work similarly, but are embedded in a different way. As I understand it, the plugins are configured in docusaurus.config.js, instead of imported and embedded in each markdown file directly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🔗 See the other comment in this file for an example of escaping this linking hell!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For posterity: it sounds like docusaurus has plans for v3 to enable different plugins to see each other's stuff. When that happens we might be able to undo this work 🙌

Comment on lines 3 to 1051
{
type: "link",
label: "Overview Components",
href: "/docs/next/components",
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sidebars.js Show resolved Hide resolved
@pepopowitz pepopowitz force-pushed the pepopowitz/1116-configure-optimize-docs branch from 0c50270 to 915c7f0 Compare August 17, 2022 18:56
@pepopowitz pepopowitz changed the base branch from main to pepopowitz/1167-markdown-links August 17, 2022 18:57
Copy link
Collaborator Author

@pepopowitz pepopowitz left a comment

Choose a reason for hiding this comment

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

Adding more comments based on another PR I'm about to open, for an MDX plugin that allows us to use tokens to represent paths that will be expanded based on the directory of the source file. In other words, much-easier-to-maintain cross-instance docs linking.

@@ -63,7 +63,7 @@ With [Tasklist](../tasklist/introduction-to-tasklist.md), process owners can ach

### Optimize

[Optimize](../optimize/what-is-optimize.md) leverages process execution data to continuously [provide actionable insights](../../guides/improve-processes-with-optimize.md). Optimize specializes in BPMN-based analysis and can show users exactly what their process model needs for successful execution.
[Optimize]($optimize$/what-is-optimize) leverages process execution data to continuously [provide actionable insights](../../guides/improve-processes-with-optimize.md). Optimize specializes in BPMN-based analysis and can show users exactly what their process model needs for successful execution.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🔗 This uses the MDX plugin I wrote in (TODO: PR number) to have the site interpret which version of the optimize docs to send the user to, based on the location of the source file.

id: "optimize",
path: "optimize",
routeBasePath: "optimize",
beforeDefaultRemarkPlugins: [versionedLinks],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🔗 This configures the optimize docs to use the MDX plugin that interprets link target URLs based on the source file directory.

@@ -207,6 +219,7 @@ module.exports = {
// Please change this to your repo.
editUrl:
"https://github.com/camunda/camunda-platform-docs/edit/main/",
beforeDefaultRemarkPlugins: [versionedLinks],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🔗 This configures the main docs to use the MDX plugin that interprets link target URLs based on the source file directory.

---

:::note
New to Optimize? Visit our introductory guide to [Optimize]($docs$/guides/improve-processes-with-optimize/) to get started.
Copy link
Collaborator Author

@pepopowitz pepopowitz Aug 17, 2022

Choose a reason for hiding this comment

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

🔗 This uses the MDX plugin from #1170 to have the site interpret which version of the main docs to send the user to, based on the location of the source file.

- Automate
- Improve

A user can design process flows through our [Modeler](/docs/next/components/modeler/about-modeler/). In a production scenario, you can deploy through Desktop Modeler, Web Modeler, or programmatically. A user can use [Tasklist](/docs/next/components/tasklist/introduction-to-tasklist/) to review and complete tasks, and [Operate](/docs/next/components/operate/operate-introduction) to view and analyze process instances.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🔗 See the other comment in this file for an example of escaping this linking hell!

@akeller akeller added component:docs Documentation improvements, including new or updated content dx Documentation infrastructure typically handled by the Camunda DX team labels Aug 18, 2022
Base automatically changed from pepopowitz/1167-markdown-links to main August 22, 2022 15:14
@pepopowitz pepopowitz force-pushed the pepopowitz/1116-configure-optimize-docs branch from 54996b2 to e5ba999 Compare August 25, 2022 17:11
@pepopowitz pepopowitz changed the title (WIP) feat: give optimize docs the correct versions feat: give optimize docs the correct versions Aug 25, 2022
@pepopowitz pepopowitz marked this pull request as ready for review August 25, 2022 19:36
Copy link
Collaborator Author

@pepopowitz pepopowitz left a comment

Choose a reason for hiding this comment

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

Adding some more comments for my recent changes

path: "optimize",
routeBasePath: "optimize",
beforeDefaultRemarkPlugins: [versionedLinks],
sidebarPath: require.resolve("./optimize_sidebars.js"),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@akeller this is the line I had commented out that caused me to go down a rabbit hole yesterday.........docusaurus wasn't using my sidebars because I wasn't telling docusaurus to use them. 😅 😬

Copy link
Member

Choose a reason for hiding this comment

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

Funny how that works 😬


- Make sure the results get formatted, as the script generates an object that does not match prettier's desired format.

5. Replace/revert any Optimize links that exist within the optimize docs
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As I move more and more docs over, this step might become enough of a pain that I figure out a way to make the script do doc-based links for already-moved docs.

Copy link
Member

Choose a reason for hiding this comment

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

You can always call in back up too if manually moving things gets the job done. I love the automated approach though.

Comment on lines +1 to +7
function docsComponentsLink(label, href) {
return {
type: "link",
label: label,
href: `/docs/next/${href}`,
};
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Long term vision:

I could have generated this file without this helper, but it would have resulted in /docs/next/ littered throughout it. This seems like it'd be not fun when we generate a new version of optimize -- we'd have to do a find/replace and include all those changes in the version PR.

Extracting the prefix of the paths to this one spot means we can just replace it in this one spot when we cut a new version.

It might be YAGNI, but it made sense to me.


{
Optimize: [
"what-is-optimize",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the only link in this sidebar file that is doc-based instead of URL based (because it's the only doc moved over in this PR).

@pepopowitz pepopowitz changed the title feat: give optimize docs the correct versions feat: set up optimize docs instance and move one doc over Aug 26, 2022
@pepopowitz pepopowitz self-assigned this Aug 26, 2022
@pepopowitz
Copy link
Collaborator Author

Heads up that this is ready for final review.

Also cc @christinaausley for visibility.

Copy link
Member

@akeller akeller left a comment

Choose a reason for hiding this comment

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

Nothing obviously concerning popping up for me. It makes sense the changes are only in /next/.

@pepopowitz pepopowitz merged commit f5bc440 into main Aug 31, 2022
@pepopowitz pepopowitz deleted the pepopowitz/1116-configure-optimize-docs branch August 31, 2022 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:docs Documentation improvements, including new or updated content dx Documentation infrastructure typically handled by the Camunda DX team epic:optimize-versions
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants