-
Notifications
You must be signed in to change notification settings - Fork 186
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
Conversation
docusaurus.config.js
Outdated
id: "optimize", | ||
path: "optimize", | ||
routeBasePath: "optimize", | ||
// sidebarPath: require.resolve("./optimize_sidebars.js"), |
There was a problem hiding this comment.
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.
optimize/what-is-optimize.md
Outdated
- 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
- This list of optimize releases.
- 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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 🙌
optimize_sidebars.js
Outdated
{ | ||
type: "link", | ||
label: "Overview Components", | ||
href: "/docs/next/components", | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a foreseen down-side to the multi-version docs -- having to rewrite the sidebars files, and duplicate them, due to the two plugins not knowing about each others' docs.
0c50270
to
915c7f0
Compare
There was a problem hiding this 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. |
There was a problem hiding this comment.
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], |
There was a problem hiding this comment.
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], |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
optimize/what-is-optimize.md
Outdated
- 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. |
There was a problem hiding this comment.
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!
…ere are no optimize versions yet
…t links at the optimize one
…ing between docs/optimize
54996b2
to
e5ba999
Compare
There was a problem hiding this 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"), |
There was a problem hiding this comment.
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. 😅 😬
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
function docsComponentsLink(label, href) { | ||
return { | ||
type: "link", | ||
label: label, | ||
href: `/docs/next/${href}`, | ||
}; | ||
} |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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).
Heads up that this is ready for final review. Also cc @christinaausley for visibility. |
There was a problem hiding this 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/
.
Part of #1116.
optimize_sidebars.js
fileScope
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:
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:
These timestamps are all older than the timestamp for the first commit in which I moved the
what-is-optimize
doc: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 🙌