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

Module Federation Documentation. #1253

Open
wants to merge 26 commits into
base: 6.0
Choose a base branch
from
Open

Module Federation Documentation. #1253

wants to merge 26 commits into from

Conversation

thet
Copy link
Member

@thet thet commented May 16, 2022

No description provided.

@netlify
Copy link

netlify bot commented May 16, 2022

Deploy Preview for 6-docs-plone-org ready!

Name Link
🔨 Latest commit cfe78b0
🔍 Latest deploy log https://app.netlify.com/sites/6-docs-plone-org/deploys/662f5108579a32000792d0c9
😎 Deploy Preview https://deploy-preview-1253--6-docs-plone-org.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@thet thet marked this pull request as draft May 16, 2022 09:12
@reinhardt
Copy link

@reinhardt
Copy link

Thanks for the suggestion! I'm actually starting to doubt whether it makes sense to have a separate chapter on module federation. With plone/bobtemplates.plone#507 you will get it for free in the future when creating a pattern with plonecli/bobtemplates. There should probably be documentation how to customize a pattern, including a sentence that mentions module federation, but maybe not a full explanation.

@ksuess
Copy link
Member

ksuess commented Jun 1, 2022

Thanks for the suggestion! I'm actually starting to doubt whether it makes sense to have a separate chapter on module federation. With plone/bobtemplates.plone#507 you will get it for free in the future when creating a pattern with plonecli/bobtemplates. There should probably be documentation how to customize a pattern, including a sentence that mentions module federation, but maybe not a full explanation.

Module federation is independent of Mockup patterns, but is the way JS bundles are composed the Plone 6 way, am I correct?

So, will this draft also be an instruction for "I have a Plone 5 add-on with some arbitrary Javascript code, not necessary a Mockup pattern, and I want to know, how I to lift this Plone 5 add-on to Plone 6"?

@reinhardt
Copy link

Yes and no... Probably @thet can explain that better?

Co-authored-by: Katja Süss <k.suess@rohberg.ch>
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
Copy link
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

In this review, I cover the entire document to date.

It's looking good. Thank you!

docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
thet and others added 11 commits July 21, 2022 01:10
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Copy link
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

One minor fix, and this is good to go.

If there are more things that need to be added, I would suggest adding an outline of those items at the least. Then we can fill in details.

Thank you!


```{seealso}
Webpack's documentation on [Module Federation](https://webpack.js.org/concepts/module-federation/).
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move the above part after the content for this section, after "Add-ons can add bundles called "remotes" which are initialized for module federation by the host bundle." and before "## Using module federation". We need an introduction before showing a link to an external site.

@ksuess
Copy link
Member

ksuess commented Jul 21, 2022

Please include "classic-ui/module-federation" in naviagation.

@ksuess ksuess marked this pull request as ready for review July 21, 2022 06:18
Copy link
Member

@ksuess ksuess left a comment

Choose a reason for hiding this comment

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

I have questions. This is how to get the custom pattern (js pattern code) of my add-on up and running. What about other js code. For example old jquery code. Would it maybe make sense to provide information about this traditional stuff also here, or would that go in another chapter?

docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Show resolved Hide resolved
@thet
Copy link
Member Author

thet commented Jul 21, 2022

@ksuess that doc here was not really meant to get you started from scratch. It's more about how to configure module federation.
But I agree - we need a how to start document, also a bobtemplates integration (started but here: plone/bobtemplates.plone#507 but not finished yet).
Not sure if these docs should be extended for a full start-from-scratch, or should it?

Btw. the https://github.com/Patternslib/pat-PATTERN_TEMPLATE is IMO a good patterns generator and a perfect starting point.
However, it does not provide a plone integration (registering of resources, etc) - this is what the bobtemplates PR‌ is about.

@petschki I added some fixes for the recent webpack.mf.js changes plus some references to full, working examples.

Btw. I'm on vacation the next two weeks, so don't expect any updates from me.. :)

Copy link
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

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

A couple of English syntax improvements, using shorter sentences, and an optional suggestion for link syntax.

@@ -44,28 +44,50 @@ Add the following line near the top of the file:
const mf_config = require("@patternslib/dev/webpack/webpack.mf");
```

Import all the dependencies you want to share.
Potentially these are the ones from Patternslib, Mockup and your own dependencies.
Copy link
Contributor

Choose a reason for hiding this comment

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

When a term is first introduced on a page, we must either define it or provide a reference to its meaning, either with a Glossary entry or a link to an external website where it is defined. Please amend the link to whatever is preferred.

I also noticed that I overlooked that Mockup lacks a definition or reference when it is was first introduced, so that should be done above as well.

Suggested change
Potentially these are the ones from Patternslib, Mockup and your own dependencies.
Potentially these are the ones from [Patternslib](https://github.com/Patternslib/pat-PATTERN_TEMPLATE), Mockup, and your own dependencies.

docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
docs/classic-ui/module-federation.md Outdated Show resolved Hide resolved
and replace `myaddon.min` with the corresponding key in `config.entry` that points to your `index.js`.

For a full but simple example, see the Patterns generator [pat-PATTERN-TEMPLATE][2] or any other Pattern addon in the patternslib GitHub organisation.
For a complex example with Mockup integration see [plone.app.mosaic][3] and [Mockup][4] itself.
Copy link
Contributor

Choose a reason for hiding this comment

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

This suggestion is optional. In general, I prefer to keep the URL next to its label as in [label](https://url.com/path), instead of this reference style. They both render the same for readers. But for authors it has advantages:

  • Simpler syntax.
  • It associates the label with the link directly, instead of requiring the author to scroll down to reference it.
  • When a link is broken, linkcheck and linkcheckbroken refer to the line of the label, not the URL, in the error, so you would see something like classic-ui/module-federation: line 31) broken https://pypi.org/project/plonecli-404/ - 404 Client Error: Not Found for url: https://pypi.org/project/plonecli-404/
  • Preferred by most authors.

Perhaps that style was carried over from the dogma of keeping line lengths to 80 characters. In narrative documentation, line length does not matter. It is not code and most editors can soft wrap long lines of text these days.

@ksuess
Copy link
Member

ksuess commented Jul 22, 2022

@ksuess that doc here was not really meant to get you started from scratch. It's more about how to configure module federation. But I agree - we need a how to start document, also a bobtemplates integration (started but here: plone/bobtemplates.plone#507 but not finished yet). Not sure if these docs should be extended for a full start-from-scratch, or should it?

Btw. the https://github.com/Patternslib/pat-PATTERN_TEMPLATE is IMO a good patterns generator and a perfect starting point. However, it does not provide a plone integration (registering of resources, etc) - this is what the bobtemplates PR‌ is about.

@petschki I added some fixes for the recent webpack.mf.js changes plus some references to full, working examples.

Btw. I'm on vacation the next two weeks, so don't expect any updates from me.. :)

Ah, OK, then this is chapter is focused on Module Federation. And it assumes knowledge on how to work with static resources in general, how to add static resources (js, css) to a custom theme (based on Barceloneta or not).

Then the questions of a theme / add-on creator should be answered in a general chapter on static resources, which indeed already exists! After your comment, I found it: https://6.dev-docs.plone.org/classic-ui/theming/from-scratch.html#theme . The chapter title "Plone Classic UI Theming based on Barceloneta" should probable read something like "Plone Classic UI Theming independent of Barceloneta".
I'll mark my former imaginary theme creator questions as resolved and find a way to add them to https://6.dev-docs.plone.org/classic-ui/theming/from-scratch.html#theme if appropriate.

@jensens
Copy link
Sponsor Member

jensens commented Jul 22, 2022

I read the instructions and I am a bit clueless. Could we have some very minimal but complete and working example?

@MrTango
Copy link
Contributor

MrTango commented Aug 3, 2022

Then the questions of a theme / add-on creator should be answered in a general chapter on static resources, which indeed already exists! After your comment, I found it: https://6.dev-docs.plone.org/classic-ui/theming/from-scratch.html#theme . The chapter title "Plone Classic UI Theming based on Barceloneta" should probable read something like "Plone Classic UI Theming independent of Barceloneta".

from-scratch here stays for no Diazo, only templates overrides vs diazo.
In the docs there is not much for theming sofar, but the training has already quite some infos, but they need an update before the conference.

like in the training: Create a Theme from scratch vs Create a theme based on Diazo

@stevepiercy
Copy link
Contributor

@thet @reinhardt @ksuess @jensens @MrTango I updated the base branch and tidied up the MyST and English grammar and syntax. I'd appreciate your collaboration to get this PR finished and deployed to the documentation. Thank you!

@jensens
Copy link
Sponsor Member

jensens commented Apr 29, 2024

Overall this looks good, what is missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: In Progress
Development

Successfully merging this pull request may close these issues.

None yet

7 participants