-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
Updates for Mockup integration. #2112
Conversation
@sneridagh Not sure if the change from root imports |
@thet: the ~ root import alias is needed for Volto projects. When Volto imports from |
I think it might be possible to allow projects to re-alias the plone/volto/config and use the alternative alias |
Hey @thet ! Anyways, I think that you don't need to get rid of this in the Volto source, but adapt your build to play with this constraint. You can create a "config" module like the Volto projects do: and comply with the Volto constraint easily from your code. As a bonus, you'll be able to modify the config if you need it from Mockup (if required). As said, I'm interested as well in see this work, so I'm open to do a call and discuss your approach and what might be required to overcome all the blockers. What do you think? |
Probably a better solution to this would be to have volto components as a separate library. Because that's what I understood we could need to use in a project that's not a Volto project, am I right? |
The We could extract the Also, I don't know if slicing Volto we will gain something... see current Plone. We wanted to reduce the number of packages in the last years, just because we sliced it too much... Testing, deployability, version management... all gets more complex when you have the components distributed. My gut feeling is that we should avoid it unless we have a huge win on the other side. However, right now we cannot escape the tight entanglement that all components inside Volto have. Although the |
@sneridagh @tiberiuichim @pnicolli thanks for the helpful comments! I feared that the root import trick is doing more than I was able to see. I'll try to work around that. Maybe just adding an alias in Mockup's webpack config for "~" which points to the Volto source will do it... Having the components in seperate libraries would help for reusability. I do totally understand the arguments against it too. I'd love to fave a call to discuss this more. I think I'll first need to get my fingers dirty a bit more. Let's find a slot, maybe sometime fridays? |
The home-grown form library in Volto could benefit from being exposed as a separate package, though there are similar form libraries "out there". For the form library to be really useful, it would have to also provide integration with the widgets, and I can imagine that you won't get very far with widgets before they need tight Volto integration. It's easy to integrate focused third-party libraries into other systems (Volto or Plone). I've asked myself the same questions recently, how to develop systems that run on both "plain React" and Volto. I've decided to develop that component standalone and then provide Volto integration. It may not be ideal, but it will be sane for the current situation. |
Updated the PR description with a link to the Mockup branch integrating Volto. |
@thet maybe you are not aware of it, but we are moving to a more sane, non-import-based configuration. It's already merged in master, we are in alpha phase now (which should be short). Take a look at the migration guide, how it works now (it's using a centralised singleton instead) which might be easier to integrate in Mockup (if you provide a few defaults to it). https://docs.voltocms.com/upgrade-guide/#upgrading-to-volto-12xx Hope this helps! |
@thet wondering if you had the chance to try it using Volto 12. As said, now with the new configuration registry I think all the problems you had will go away. I don't know if you know that we are also working in the Storybook of Volto too (although not completed, we try to add any new component there), I also thought that in fact, what we are doing in the Storybook is what you want to accomplish. So Storybook is an external app with its own build process (that you can extend to match your own Babel requirements) that gets your components in isolation and puts them nicely in the app. You can take a look at it here: https://docs.voltocms.com/storybook/ Hope this helps! |
@sneridagh that sounds very good, thanks for the update. |
Update: I'm trying to integrate the Contents component to replace Mockup's structure pattern. I started over without the need of changing the root imports (except for one occurrence). This is not necessary, as the "babel-plugin-root-import" can be configured for root-imports depending on specific paths. This is the Volto integration part in mockup: plone/mockup#1037 I'm almost there - currently the integration fails with |
@@ -5,7 +5,7 @@ import { connectRouter, routerMiddleware } from 'connected-react-router'; | |||
import { save, load } from 'redux-localstorage-simple'; | |||
|
|||
import config from '@plone/volto/registry'; | |||
import reducers from '~/reducers'; | |||
import reducers from '@plone/volto/reducers'; |
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.
instead of doing this i can also add an ~/reducers
alias in Mockup's webpack.
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.
@thet: I think you should add the alias in mockup. The problem is that Volto projects (which are the ~
root when Volto runs as a bootstrapped project) still have the reducers folder inside them. See https://github.com/plone/volto/tree/master/packages/generator-volto/generators/app/templates/src/reducers . IMHO it would be better if we'd somehow get rid of that root import, too.
@thet @sneridagh Is any of this still relevant? |
I'd say let's close it. The integration with Mockup should come in the times to come through |
@thet just in case you don't realised yet: https://github.com/plone/plone.restapi-client |
@davisagli yes, this is PR is experimental and not the right approach. Looking forward for a |
This is a WIP.
Changes:
See commits.
Change root imports to@plone/volto
.Replace all~
root imports with the@plone/volto
alias and remove related dev dependencies.This change allows Volto to be defined as a importable module dependency in another library where the root is different.
plone/mockup#1037