Feat: Add script to replace keyword placeholders with user input#6
Feat: Add script to replace keyword placeholders with user input#6KIKOmanasijev wants to merge 5 commits intoroots:mainfrom
Conversation
Fix: config file name not changing Opt: remove unused variables Fix: author_email not changing in composer.json Fix: composer package name placeholder use correct variable Fix: don't run composer test script because it does not exist
|
I'd like to get rid of all the curl/endpoint stuff as well as any over the top "automation" where possible. The Filament team's take in their plugin skeleton might be a good place to draw some inspiration on simplifying things: https://github.com/filamentphp/plugin-skeleton/blob/main/configure.php |
|
Thanks for the comments @Log1x 🙇♂️. The code styling in composer.json is corrected, and I've simplified the configure.php. Let me know what you think now. |
|
Was playing with a script setup for replacing base example package details , but it seems this Laravel / Filament kind of way is much better. Hope we get this merged soon. Did a test running so would be better when it would have been three words. Furthermore I had to make some tweaks:
But beyond that I do not see issues yet. But will have to test some more. Here the script for reference: https://gist.github.com/jasperf/7fb70fd696d39666475581f62cf7cc43 |
|
Nice work @KIKOmanasijev and @jasperf ! @Log1x any plans on merging this or are there any pending things to be done? |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 939aa14ac0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| match (true) { | ||
| str_contains($file, determineSeparator('src/Example.php')) => rename($file, determineSeparator('./src/'.$className.'.php')), | ||
| str_contains($file, determineSeparator('src/Providers/ExampleServiceProvider.php')) => rename($file, determineSeparator('./src/providers/'.$className.'ServiceProvider.php')), |
There was a problem hiding this comment.
Preserve directory case when renaming service provider file
On case-sensitive filesystems (common in Linux CI/production), renaming to ./src/providers/... fails because the committed directory is src/Providers. The script still rewrites class names in the file, so the file remains ExampleServiceProvider.php while the class becomes <ClassName>ServiceProvider, which breaks PSR-4 autoloading after configuration.
Useful? React with 👍 / 👎.
| match (true) { | ||
| str_contains($file, determineSeparator('src/Example.php')) => rename($file, determineSeparator('./src/'.$className.'.php')), | ||
| str_contains($file, determineSeparator('src/Providers/ExampleServiceProvider.php')) => rename($file, determineSeparator('./src/providers/'.$className.'ServiceProvider.php')), | ||
| str_contains($file, determineSeparator('src/Console/ExampleCommand.php')) => rename($file, determineSeparator('./src/console/'.$className.'.php')), |
There was a problem hiding this comment.
Keep
Command suffix when renaming console command file
This rename target drops the Command suffix (.../$className.php), but the earlier global replacement changes ExampleCommand to <ClassName>Command inside the file. That leaves the class name and filename out of sync under PSR-4, so the command class will not autoload correctly after running the configurator.
Useful? React with 👍 / 👎.
|
Thanks for putting this together and appreciate you taking the initiative here, and apologies on taking so long to provide more feedback here We're going to go a different direction with our own implementation in #7 |
This PR adds a PHP script that automates the process of replacing the dummy Class Names, Namespaces, File names and etc, with real user entered data.
Ref #5