Skip to content

Fix: Convert to silverstripe-module with PSR-4 autoload; add SS6 support - #1

Open
elliot-sawyer wants to merge 1 commit into
mainfrom
fix/module-autoload-and-docs
Open

Fix: Convert to silverstripe-module with PSR-4 autoload; add SS6 support#1
elliot-sawyer wants to merge 1 commit into
mainfrom
fix/module-autoload-and-docs

Conversation

@elliot-sawyer

Copy link
Copy Markdown
Owner

Problem

The module was typed as silverstripe-recipe, which means:

  • Composer doesn't apply PSR-4 autoloading to app/src/
  • SilverStripe's ClassManifest doesn't scan the module for extensions
  • Cashware\Bootswatcher\SiteConfigTheme can't be discovered by consuming projects
  • The Theme column is never added to SiteConfig
  • Incompatible with Silverstripe 6 (silverstripe/recipe-cms: 5.0.0 hard-pins SS5)

Changes

  • Change type from silverstripe-recipe to silverstripe-module
  • Move class files from app/src/Extensions/ and app/src/Tasks/ to app/src/ to match the flat Cashware\Bootswatcher namespace
  • Add autoload.psr-4 mapping: "Cashware\\Bootswatcher\\": "app/src/"
  • Broaden silverstripe/cms require to ^5 || ^6
  • Remove project-files-installed/public-files-installed (recipe-only scaffolding concepts)
  • Update README with composer require installation steps and theme config example

Test plan

  • composer require elliotsawyer/bootswatcher elliotsawyer/bootswatcher-theme in a fresh SS6 project
  • vendor/bin/sake dev/build flush=all registers Theme column on SiteConfig
  • CMS Settings → Theme shows Bootswatch theme picker
  • Selecting a theme applies the correct CSS

🤖 Co-authored with Iris

- Change type from silverstripe-recipe to silverstripe-module so ClassManifest
  discovers Cashware\Bootswatcher classes in consuming projects
- Move class files from app/src/Extensions/ and app/src/Tasks/ to app/src/
  to match the flat Cashware\Bootswatcher namespace under PSR-4
- Add autoload.psr-4 mapping so Composer can resolve the extension class
- Broaden silverstripe/cms require to ^5 || ^6 for SS6 compatibility
- Remove project-files-installed/public-files-installed (recipe-only concepts)
- Update README with composer require installation steps and theme config

Co-Authored-By: Iris <positronic.iris@gmail.com>
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.

1 participant