laravel-code-generator icon indicating copy to clipboard operation
laravel-code-generator copied to clipboard

How can I store resource path details, etc in corresponding json file and have create:{foo} commands act on them?

Open CyberiaResurrection opened this issue 6 years ago • 4 comments

Environment:

  • Laravel-Code-Generator Version: 2.2.7
  • Laravel Version: 5.5.40

Description:

To save more typing, and to further the idea that the code generator already embodies, how can I store (for example), the output directories for the generated controller(s), views, with/without form request, etc in the resource's resource.json file (eg BlogPost.json)?

Idea being when these are set in the resource file, the resource file version of whatever setting is used unless overridden by command line parameters. I've found this package to be very handy saving time when generating boilerplate for various bits, it's just that having to remember (and remember to type in) all the command line parameters (for a nontrivial Laravel app, I'm regularly having to type in at least 5).

Steps/Commands To Reproduce:

N/A

Content Of The Resource-File:

N/A

CyberiaResurrection avatar Jun 28 '18 15:06 CyberiaResurrection

If you’re planning on regenerating the resources over and over, the ‘php artisan create:mapped-resources’ command may come in handy. If you have not tried it yet, you may want to give it a shot. Otherwise, i’ll Try to figure something out to accommodate your thoughts on future releases

MikeAlhayek avatar Jun 28 '18 16:06 MikeAlhayek

Sweet, thanks for the quick response. This is an awesome tool already - I only hope I can make it better.

I find I get a lot more done if I can rapidly iterate, try out new ideas, and chuck the bad ideas early. Tripping over missed or wonky command line arguments is not my idea of fun.

CyberiaResurrection avatar Jun 28 '18 16:06 CyberiaResurrection

It's not just regenerating the resources over and over, it's regenerating them with a specific set of command-line options each time.

For example, on a project I'm hacking on currently:

create:controller Report --controller-directory=api --views-directory=api --with-form-request --form-request-directory=api/reports
create:migration Report --connection-name=sideways --engine-name=InnoDB --with-soft-delete

As experimentation and iteration can occur over multiple hours or even days, simply going through CLI history doesn't really work. Having to remember more than 7 command line options, and which part they fit into, would seem to be something that a computer can do better than squishy, fallible, meat.

CyberiaResurrection avatar Jun 28 '18 18:06 CyberiaResurrection

Yes I understand. We’ll add this request to the lab’s list.

MikeAlhayek avatar Jun 28 '18 20:06 MikeAlhayek