awcodes / scribble

MIT License
42 stars 6 forks source link

feat: Automatically register tools in the application #37

Closed Log1x closed 2 months ago

Log1x commented 2 months ago

This adds a registerToolPath(string $path, string $namespace) method to ScribbleManager to allow registering custom tools in a path and then uses that in the service provider to automatically register tools in the default expected app_path() to improve DX.

A future improvement if this PR were to be merged would perhaps be a cache command to cache the registered tool file paths into a manifest.

Related: #38

Log1x commented 2 months ago

Mentioned this in Discord but re-posting here for transparency/discussion:

If you end up being interested in this PR, we can perhaps rename/move https://github.com/awcodes/scribble/blob/main/config/scribble.php#L15-L18 out of generator to just tools or something and then use that config for the default (currently assumed) autoloaded path behavior on this PR as well as generation.

Possibly something like:

'tools' => [
    'namespace' => 'App\\Scribble\\Tools',
    'path' => app_path('Scribble/Tools'),
    'views' => 'scribble-tools',
],

Let me know if you want me to make any of those changes.

awcodes commented 2 months ago

Thank you for your work on this. It will be in the next release.

I didn't want you to have to do it again because I keep creating conflicts for you. LOL.

I have tagged this in the PR to make sure you still get credit.