Conversation
There was a problem hiding this comment.
Pull request overview
This PR standardizes module installation paths to use a lowercase root directory and lowercase slug-based module directory names (hyphens preserved), updating the installer behavior and aligning tests with the new paths.
Changes:
- Change default module root directory from
Modulestomodules. - Update module directory naming from StudlyCase to lowercase slug (e.g.,
something-nice). - Update install-path expectations in tests and add test coverage for
getModuleName()slug behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Installer.php |
Updates default root and module directory naming logic + related docblock text. |
tests/ModuleInstallerTest.php |
Updates install-path assertions and adds new test cases for slug-based module names. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const DEFAULT_ROOT = 'modules'; | ||
|
|
There was a problem hiding this comment.
Changing the default root/module directory naming (DEFAULT_ROOT and getModuleName) will change the install path for existing installations. During update(), stashModuleDir($this->getInstallPath($initial)) will now look in the new path, so previously-installed modules (e.g. Modules/StudlyCase) won’t be stashed/merged and Composer may also fail to uninstall the old path, leaving an orphaned directory. Consider adding a migration/legacy-path fallback (e.g., detect and stash/remove the legacy Modules/<StudlyCase> / <StudlyCase> location when it exists) and/or overriding uninstall() to clean up legacy paths.
| * Get the module directory name from the package name. | ||
| * "saucebase/something-nice" → "something-nice" (lowercase slug, hyphens preserved). | ||
| * | ||
| * @param PackageInterface $package Compose Package Interface | ||
| * @return string Module Name | ||
| * @param PackageInterface $package Composer Package Interface | ||
| * @return string Module directory name |
There was a problem hiding this comment.
Some documentation is now inconsistent with the new lowercase install root and slug-based directory naming. In particular, the getBaseInstallationPath() doc comment in this file still says it defaults to Modules/, and the repo README/composer.json description also reference Modules/<StudlyCase> behavior. Please update those docs to match the new modules/<lowercase-slug> behavior so consumers aren’t misled.
This pull request refactors how module directory names are generated and stored, standardizing them to use lowercase slugs with hyphens preserved (e.g.,
something-niceinstead ofSomethingNice). It updates both the implementation inInstaller.phpand the corresponding tests to reflect this change.Module naming and path generation changes:
modulesinstead ofModules).saucebase/something-nicebecomessomething-nice.Installer.phpto clarify that module directory names are lowercase slugs.Test updates:
ModuleInstallerTest.phpto expect lowercase module directory names and root directory (modules/something-niceinstead ofModules/SomethingNice). [1] [2] [3]getModuleNamereturns the expected lowercase slug for various package names.…ated tests