FriendsOfShopware / shopware-cli

CLI for Shopware Account and Shopware 6
MIT License
81 stars 31 forks source link

Commands for creating boilerplate code #352

Closed JuicyLung91 closed 3 months ago

JuicyLung91 commented 4 months ago

Please describe the feature you would like to see implemented.

How about a CLI approach to create boilerplate code with resolved names inside extensions/plugins similiar to the symfony maker bundle or Laravel artisan. It would be nice to have this in the shopware cli?

It could be similar to this tool I made a year ago: https://github.com/pureware/pureware-cli My tool already has commands for services like this:

The advantages would be a standardized approach to adding common services, such as consistent directory structure and naming conventions. Also, it would be helpful to have it inside your terminal, and the shopware cli tries to be the "swiss army knife" for shopware developers which should be a must-have for a real "swiss army knife" :D. It could also register the services automatically inside the services.xml if autoconfigure is not active.

What do you think @shyim ? I know it would also be nice to have PHP for this, but maybe it is enough to do this in the shopware-cli with static templates?

JuicyLung91 commented 4 months ago

I've spent some time creating an example of how I would build a generic approach to generating boilerplate code templates in Go. Check it out: https://github.com/JuicyLung91/example-go-template-generator
What do you think?

shyim commented 4 months ago

looks good :)

I would not do entity definition, we have a full definition generator in core already 🤔

JuicyLung91 commented 4 months ago

What? How comes I didn't notice this. But it is not in 6.4, is it? I am still stuck on 6.4 🤣

But maybe it would still be a good idea to have also EntityDefinitions inside the cli because I mostly work on plugins inside dockware. So I would need to connect with the container first. The shopware-cli runs on my machine and it would be needles to connect with the container.

Maybe we could generate the admin modules and components and admin cms stuff first, 🤔 as this is mostly the most time-consuming. Duno how to start from here but would really like to help if you want to have this stuff in the cli?

shyim commented 4 months ago

I think it makes more sense when it's part of https://github.com/FriendsOfShopware/FroshDevelopmentHelper

It's easier for people to add something as it's PHP 🤔

JuicyLung91 commented 4 months ago

Learning the php parser is not as easy as just adding new templates with some variables, when you have a generic way to do it.

I often thought about extending the frosh development helper but the php parser was always a hurdle to me. Also it would be a nice way to also add js and vue files in the administration.

But I understand your concerns. Having php to load stuff like file names inside the vendor oder stuff from the DB is also an advantage. I just thought it would be really helpful to open the cli when you work on a plugin and then quickly generate the files you need.

shyim commented 4 months ago

I am fine using simple templates in FroshDevelopmentHelper does not need to be php parser :)

shyim commented 3 months ago

I would do it in development helper