Skip to content

fix!: standardize module directory naming to lowercase and update rel…#9

Merged
roble merged 1 commit into
mainfrom
dev
Apr 25, 2026
Merged

fix!: standardize module directory naming to lowercase and update rel…#9
roble merged 1 commit into
mainfrom
dev

Conversation

@roble

@roble roble commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator

This pull request refactors how module directory names are generated and stored, standardizing them to use lowercase slugs with hyphens preserved (e.g., something-nice instead of SomethingNice). It updates both the implementation in Installer.php and the corresponding tests to reflect this change.

Module naming and path generation changes:

  • The default root directory for modules is now lowercase (modules instead of Modules).
  • Module directory names are now generated as lowercase slugs, preserving hyphens, rather than being converted to PascalCase. For example, saucebase/something-nice becomes something-nice.
  • Updated method documentation in Installer.php to clarify that module directory names are lowercase slugs.

Test updates:

  • Updated tests in ModuleInstallerTest.php to expect lowercase module directory names and root directory (modules/something-nice instead of Modules/SomethingNice). [1] [2] [3]
  • Added a new test to ensure getModuleName returns the expected lowercase slug for various package names.…ated tests

Copilot AI review requested due to automatic review settings April 25, 2026 19:51
@roble roble merged commit a18914f into main Apr 25, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Modules to modules.
  • 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.

Comment thread src/Installer.php
Comment on lines +23 to 24
const DEFAULT_ROOT = 'modules';

Copilot AI Apr 25, 2026

Copy link

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 legacy Modules/<StudlyCase> / <StudlyCase> location when it exists) and/or overriding uninstall() to clean up legacy paths.

Copilot uses AI. Check for mistakes.
Comment thread src/Installer.php
Comment on lines +62 to +66
* 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

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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.

2 participants