adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
737 stars 745 forks source link

Explain how we should proxy the vX components #14

Closed henrykuijpers closed 7 years ago

henrykuijpers commented 7 years ago

I checked the Wiki section and it's empty.

How should we proxy these v1 v2 v3 components? I believe we should not use the versioned components directly.

Also, what happens if v1 exists and v2 introduces new changes in the clientlibs and v3 too?

davidjgonzalez commented 7 years ago

@hkuiyo to create proxy components simply sling:resourceSuperType to the desired version of the Core component. So for example:

/apps/my-site/components/content/title@sling:resourceSuperType=/apps/core/wcm/components/title/v1/title

When you add this component to 10k pages, it will create a content resources like so:

/content/my-site/pages/page/jcr:content/root/title@sling:resourceType=my-site/components/content/title

When v2 of the core title component is released, you simply update your component to:

/apps/my-site/components/content/title@sling:resourceSuperType=/apps/core/wcm/components/title/v2/title

and youre done! the content is pointing to your version agnostic resourceType!

davidjgonzalez commented 7 years ago

@hkuiyo wrt ro your clientlibs questions, the idea is each site would use a version of a component, so:

/apps/my-site/clientlibs/all clientlibrary, would embed the required clientlib categories:

core.wcm.components.image.v1
core.wcm.components.text.v2

You simply need to update those clientlibrary embeds to match the versions of the components you are pulling in.

See #15 for discussion around handling this use-case but for editor clientlibs.

henrykuijpers commented 7 years ago

Cool, that sounds like it could work well.

I definitely think there should be a (small) wiki article for this. I could not find anything about "proxying components" on Google. If I had known it was the thing you mentioned, it would have been more clear to me.

davidjgonzalez commented 7 years ago

@hkuiyo If you can hold out just a bit long for AEM 6.3 GA, the 6.3 documentation will be made public and it covers these topics.

raducotescu commented 7 years ago

The Proxy Component Pattern is described at https://docs.adobe.com/docs/en/aem/6-3/develop/components/core-components/guidelines.html#Proxy%20Component%20Pattern.