Skip to content
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

Plugin generation shouldn't include composer.json & phpunit.xml by default #998

Closed
markstory opened this issue Jul 24, 2024 · 4 comments · Fixed by #1007
Closed

Plugin generation shouldn't include composer.json & phpunit.xml by default #998

markstory opened this issue Jul 24, 2024 · 4 comments · Fixed by #1007

Comments

@markstory
Copy link
Member

Description

The default behavior of bake plugin is to create an application plugin. However, plugin bake also generates phpunit.xml.dist and composer.json which are redundant for in-app plugins.

Adding a --standalone option to bake plugin would allow us to skip generating composer+phpunit configuration for in-app plugins but retain that behavior for standalone plugins.

Related to #991

@markstory markstory added this to the 3.x (CakePHP 5) milestone Jul 24, 2024
@dereuromark
Copy link
Member

The Alternative would be to add --vendor to put it into a vendor folder directly and adding those files. And otherwise skip them.
The flag --standalone could also be understood as vendor standalone compared to plugin and App related and might be a bit unclear.

@LordSimal
Copy link
Contributor

Wit the addition of cakephp/plugin-installer#64 the composer.json is NOT only needed for publishing the plugin on packagist but it instead moves the autoload namespace to the plugin itself.

Therefore removing it from the default template is not needed anymore.

phpunit.xml.dist on the other hand could easily be removed imho.
especially since the only parts special inside that file are the testsuite definition and the PHPUnitExtension for the fixtures.

@ADmad
Copy link
Member

ADmad commented Oct 6, 2024

..but it instead moves the autoload namespace to the plugin itself.

No it doesn't. That change is related to composer config of the app, it has nothing to do with the composer.json within the plugin itself.

So generating composer.json is still redundant for in-app plugins.

@LordSimal
Copy link
Contributor

I thought you used the namespaces configured inside those composer.json but looking at that PR again it indeed just uses the folder name inside plugins as the root namespace for that plugin.

With that I can agree, that the composer.json is actually doing nothing out of the box.

As long as that plugin name doesn't colide with another vendor namespace this seems fine by me, but it would still be a bit more configurable to actually define the plugin namesapce inside the composer.json of th plugin.

ADmad added a commit that referenced this issue Oct 6, 2024
This allows generating standalone plugins in paths outside the app.
By default in-app generated plugins no longer have unneeded files
like composer.json etc.

Closes #998
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants