-
Notifications
You must be signed in to change notification settings - Fork 0
fix!: standardize module directory naming to lowercase and update rel… #9
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,7 @@ | |
| */ | ||
| class Installer extends LibraryInstaller | ||
| { | ||
| const DEFAULT_ROOT = 'Modules'; | ||
| const DEFAULT_ROOT = 'modules'; | ||
|
|
||
| const DEFAULT_MODULE_TYPE = 'laravel-module'; | ||
|
|
||
|
|
@@ -59,10 +59,11 @@ protected function getBaseInstallationPath() | |
| } | ||
|
|
||
| /** | ||
| * Get the module name, i.e. "saucebase/something-nice" will be transformed into "SomethingNice" | ||
| * 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 | ||
|
Comment on lines
+62
to
+66
|
||
| * | ||
| * @throws ModuleInstallerException | ||
| */ | ||
|
|
@@ -74,13 +75,10 @@ protected function getModuleName(PackageInterface $package) | |
| throw new ModuleInstallerException("Invalid package name: $name"); | ||
| } | ||
|
|
||
| // Take only the part after the vendor (index 1) | ||
| [$vendor, $packageName] = explode('/', $name, 2); | ||
| // Take only the part after the vendor (index 1) and lowercase it | ||
| [, $packageName] = explode('/', $name, 2); | ||
|
|
||
| // Split by "-" and convert each segment to ucfirst | ||
| $parts = explode('-', $packageName); | ||
|
|
||
| return implode('', array_map('ucfirst', $parts)); | ||
| return strtolower($packageName); | ||
| } | ||
|
|
||
| public function supports($packageType) | ||
|
|
||
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.
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 legacyModules/<StudlyCase>/<StudlyCase>location when it exists) and/or overridinguninstall()to clean up legacy paths.