plone / cookieplone-templates

Plone templates used with cookieplone
MIT License
1 stars 1 forks source link

Enable cookieplone add-ons via mrs.developer in pnpm-workspace.yaml #109

Open Fosten opened 5 days ago

Fosten commented 5 days ago

This line works within cookieplone add-ons https://github.com/plone/cookieplone-templates/blob/6e8c38d31c345198262caf5fc03c0a1e748dba4b/frontend_addon/%7B%7B%20cookiecutter.__folder_name%20%7D%7D/pnpm-workspace.yaml#L4

But for a project's pnpm-workspace file, this only supports generator-volto add-ons

As seen in kitconcept.volto-lite-theme https://github.com/kitconcept/volto-light-theme/blob/18c9fba394c41fafbf303dce877ae946735823ca/pnpm-workspace.yaml#L4-L6 This supports cookieplone addons within a cookieplone project

'packages/**/packages/*'

This also worked for me.

'packages/*/packages/*'

Additionally, if the project's pnpm-workspace.yaml is customized for any reason, the user will need to add this to the frontend Dockerfile

COPY --chown=node pnpm-workspace.yaml /app/
davisagli commented 5 days ago

@Fosten I'm not sure I understand the situation you're reporting. Could you provide steps to reproduce the problem starting from a fresh cookieplone project?

Fosten commented 4 days ago

Ah yes, sorry, I see that I left out a key detail. This is for cookieplone add-ons fetched via mrs.developer.

Steps to reproduce: 1) Add any cookieplone addon to mrs.developer.json 2) Enable add-on in volto.config.js 3) make install = ERR_PNPM_WORKSPACE_PKG_NOT_FOUND  In packages/volto-addon: "volto-addon@workspace:*" is in the dependencies but no package named "volto-addon" is present in the workspace

This is because it clones the entire repo including the "-dev" outer package where there is already declaration for "dependencies": { "volto-addon": "workspace:*"}.

In your cookieplone root project pnpm-workspace.yaml, you can add packages/volto-addon/packages/*

Or add a catch-all like packages/*/packages/*

Or simply change packages/* to recursive packages/**

And then for the Dockerfile additionally copy in your pnpm-workspace.yaml (Which should be done anyway to allow future user-customization of this file).

Perhaps there is a better way? Only clone the inner packages/src? Or change mrs.developer add-on path "output": "packages"? Or use hoist settings in .npmrc https://pnpm.io/npmrc ? However, the above solutions worked fine.

This ticket is related to issue #108.