-
Notifications
You must be signed in to change notification settings - Fork 68
Add plugin rename script #479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.1
Are you sure you want to change the base?
Conversation
9b28ff9 to
951cb7f
Compare
Rafikooo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Camille,
nice work on the automation :)
My main concern here is using Castor for what's essentially a one-time operation. After you run make rename once, Castor just sits there as a dead dev dependency in composer.json forever. The skeleton is supposed to be minimal, and we're adding a whole task runner library that'll never be used again after initial setup.
I'd suggest converting this to plain PHP using Symfony Console (which Sylius already includes anyway) and hooking it into composer's post-create-project-cmd. That way it runs automatically after
composer create-project, uses zero additional dependencies, and doesn't leave dead weight behind. The conversion is pretty straightforward, all your logic stays the same, just swap the IO layer. Any LLM can help with that in 5 minutes if needed.
Few other things that should be fixed:
You're missing composer dump-autoload after updating composer.json (line 219), which means the new namespaces won't work until someone manually runs it. Also using @ to suppress errors in file_get_contents (line 165) is risky - if file operations fail silently, users won't know what went wrong. Should check git status upfront too, otherwise someone with uncommitted changes might accidentally clobber their work. A dry-run or preview mode would be nice before actually modifying files.
Minor stuff: there's inconsistency in what files you exclude between updateFileContents and checkRemainingReferences, the hardcoded sylius_%kernel.environment% pattern might not be universal, and helper functions like toKebabCase probably deserve some tests since they're doing critical transformations.
Overall solid work though - just think the composer hook approach would be more idiomatic for a skeleton project and cleaner long-term.
ll look into implementing all the points tonight, thanks for the review |
951cb7f to
71a7ef0
Compare
71a7ef0 to
184b113
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The self-deletion mechanism would be useful since this is a one-run purpose script.
|
Summary
This PR adds an interactive Symfony Console script to automate the plugin skeleton renaming process, replacing the manual steps from RENAME_GUIDE.md.
Changes
make renameshortcutUsage