Skip to content

Conversation

@camilleislasse
Copy link

@camilleislasse camilleislasse commented Nov 9, 2025

Q A
Branch? 2.1
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets #478
License MIT

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

  • bin/rename-plugin.php: Interactive Symfony Console script for renaming
  • Makefile: Added make rename shortcut

Usage

make rename
Capture d’écran 2025-11-09 à 19 42 24 Capture d’écran 2025-11-09 à 19 42 48

@camilleislasse camilleislasse force-pushed the feature/castor-rename-script branch 2 times, most recently from 9b28ff9 to 951cb7f Compare November 11, 2025 08:09
Copy link
Contributor

@Rafikooo Rafikooo left a 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.

@camilleislasse
Copy link
Author

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

@camilleislasse camilleislasse force-pushed the feature/castor-rename-script branch from 951cb7f to 71a7ef0 Compare November 12, 2025 17:32
@camilleislasse camilleislasse force-pushed the feature/castor-rename-script branch from 71a7ef0 to 184b113 Compare November 12, 2025 17:37
@camilleislasse camilleislasse changed the title Add Castor rename feature Add plugin rename script Nov 12, 2025
@Rafikooo Rafikooo linked an issue Nov 21, 2025 that may be closed by this pull request
Copy link
Contributor

@Rafikooo Rafikooo left a 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.

@camilleislasse
Copy link
Author

[6abfd9a](/Sylius/PluginSkeleton/pull/479/commits/6abfd9a9c9f33108c85aa825f981ebde716f4b4f)

6abfd9a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add automated plugin renaming script

2 participants