refine icon indicating copy to clipboard operation
refine copied to clipboard

Add CLI switch to "add resource" to inject the code that is auto-generated by the Inferencer feature into each file

Open dervishmoose opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

The Inferencer feature is an amazing time saver. I find myself building the database, then creating empty Create, Edit, List, and Show pages, then adding the routes, and then visiting each page and copying and pasting the Inferencer code into each file, repeat for each resource type. After 40 mins of doing this, I started thinking, this could be done by the CLI? Could an "-addcode" switch be added to the Refine CLI when running the add resource command?

npm run refine add resource resume-skills -addcode

Describe alternatives you've considered

I realize this is a bit like the hole and the shovel. I really want a hole, but I need to go and buy a shovel to make the hole. What I really want in this context is the auto-generated form code. Starting function and visual tweaks, with a form that has all of the fields and query lookups, is a massive time save. Perhaps there would be another way to fill the need, but I can not see it at the moment.

Additional context

I am wondering if this could be done through a Curl or similar request. Perhaps the CLI already has a way to bootstrap the refine app and deal with authentication. .

Describe the thing to improve

Adding a way to include the Inferencer auto-generated code into each file generated by the "refine add resource" would create a much more robust scaffold code and save many hours on larger projects.

dervishmoose avatar Dec 20 '23 14:12 dervishmoose

Hello @dervishmoose thanks for the issue!

So we are already generating resources with Inferencer component, but the thing is, inferencer is working on the client-side, this means you need to navigate to the route for inferencer to work. Inferencer will make requests to you api and bootstrap the code for you.

Having inferencer work through CLI may require big effort, but it should be possible.

One solution could be to have another button in Inferencer component, where we show the generated code. This button could basically update the relevant file with the generated code. But since inferencer works on the client-side, we wouldn't have access to file system.

I think it can be handled through our devtools tho. Since devtools has a running local express server, could navigate through your files and update it.

We need to discuss how it can be implemented. cc @aliemir @alicanerdurmaz

BatuhanW avatar Jan 03 '24 08:01 BatuhanW

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 03 '24 09:03 stale[bot]