processwire-issues icon indicating copy to clipboard operation
processwire-issues copied to clipboard

Should type "library" be "project" in composer.json ?

Open BernhardBaumrock opened this issue 11 months ago • 5 comments

I have added a PR to add ProcessWire to the list of CMS on the DDEV docs: https://github.com/ddev/ddev/pull/6879

One user suggested to use composer to install PW. I tried it and got the following warning: https://github.com/ddev/ddev/pull/6879#discussion_r1903843619

Another user suggested to change the composer type from "library" to "project" to prevent this warning from showing up: https://github.com/ddev/ddev/pull/6879#discussion_r1904038777

I have no experience with using/installing ProcessWire from composer, so please use caution with this issue report as it might be nonsense! I think @teppokoivula is using composer to install PW?

BernhardBaumrock avatar Jan 06 '25 11:01 BernhardBaumrock

@BernhardBaumrock you mention:

I have tried your suggested version and it works. The warning mentioned above is not nice to see though. Is that something PW has to change or is that on ddev side?

I think this could be completely ignored? At least until ProcessWire is updated? I believe it's completely composer related and the fix to removing the warning would be what you suggest, so 👍 on this proposal.

Although, from the looks of composer documentation, updating this to project seems to be appropriate.

I wonder if this would affect the composer installer @teppokoivula ?

elabx avatar Jan 07 '25 02:01 elabx

Hi @elabx I'm afraid I don't understand what you say?! First you mention you think it can be ignored, then you mention you support it and the docs sound like "project" would be the right thing to choose.

Thx for the link to the docs, which supports this request :)

BernhardBaumrock avatar Jan 07 '25 09:01 BernhardBaumrock

First you mention you think it can be ignored, then you mention you support it and the docs sound like "project" would be the right thing to choose.

I propose that it can be ignored in the sense that it's not an error but a warning, and won't stop the project creation.

elabx avatar Jan 07 '25 14:01 elabx

Every warning is a potential bug. If not now then maybe in the future. So I think if possible it's good to not ignore warnings :) But yes, at the moment it works without issues with the warning.

BernhardBaumrock avatar Jan 07 '25 14:01 BernhardBaumrock

I have no experience with using/installing ProcessWire from composer, so please use caution with this issue report as it might be nonsense! I think @teppokoivula is using composer to install PW?

Yes, but in our case ProcessWire is a dependency — e.g. composer require processwire/processwire. Since ProcessWire requires some files under wire to be publicly accessible, we also use Composer scripts (post-install-cmd and post-update-cmd) that duplicate the wire directory to a public path.

That's probably not very helpful to you, though, as it sounds like you are doing something completely different: trying to set up a new project using ProcessWire as the base.

For our purpose "library" makes sense, since that's the way we use ProcessWire; as a library that is installed via Composer. That being said, I don't think that the type param really matters for our use case. Composer docs state that library "will copy the files to vendor", but at least based on very limited testing "project" seems to do the same by default.

If it didn't, that would be a major breaking change.

I wonder if this would affect the composer installer @teppokoivula ?

It shouldn't: wireframe-framework/processwire-composer-installer is only relevant for package types "pw-module" and "pw-site-profile".

TL;DR here is that 1) while I'm not aware of issues caused by changing type from "library" to "project", 2) for my specific use case "library" works well and may be what makes most sense, but it also seems that 3) for Bernhard's use case it seems that "project" would be the technically correct choice 🙂

teppokoivula avatar Jan 08 '25 20:01 teppokoivula