An addon I'm developing has an addon dependency. I know that if this is a released addon I can simply yarn add my-sub-dependency
and include it in my addons addons
key and it works. However, I'm not quite sure how to best handle the cast where the sub-dependency also needs to be developed.
For a concrete example nsw-design-system-plone6 is dependent on volto-form-block. I've used a git submodule for this dependency and set the dependency in package.json
to point to the submodule.
This has the tradeoff that I can't simply yarn add nsw-design-system-plone6
, because there's no way to initialise that submodule.
I'd be very interested to hear how others are approaching this!
I think I may not understand the problem you have. Just don't add the submodules and use mrs-developer to do the git checkouts for the addons.
Assuming I'm developing volto-slots-editor and I need to add another dependency for it, another Volto addon - volto-form-block.
yarn workspace volto-slots-editor add volto-form-block
You can also skip this step and directly edit the package.json
in volto-slots-editor.
Now, add the volto-form-block in the mrs-developer.json
. Run make develop
, which in turn adjusts ts/jsconfig.json, then make sure to load the src/addons/volto-form-block as a workspace (See this for example: https://github.com/eea/cca-frontend/blob/6f69c84e2a214aa0375f2f2a39283b880414eeed/package.json#L44-L46 ). Finally, run yarn
to bring in the dependencies for the new workspace addon.
I think the workspaces
part of the package.json is the piece that you were missing.
So I can use mrs.developer in an addon too? I'm guessing I'd need to run both the mrs.developer that's in the project and the mrs.developer in the addon manually?
No, sorry, you have to manage them all in the project (top level nsw-design-system-plone6).
With the EEA work that we do we kind of "agree" that the Volto project (top level frontend) is meant for development and we even tolerate toggling back and forth the develop
flag for packages in mrs-developer.json. We keep an empty jsconfig.json.proj
in the repo, which we use to overwrite the real jsconfig.json in the Dockerfile