github nWidart/laravel-modules v13.2.0

5 hours ago

Upgrade notes

Most apps on the default published config need no change. Read the items below if you use custom stubs, custom generator paths, or run module commands in scripts, CI or deploys.

Show upgrade notes

Action may be required

  • Custom stubs.path needs 'stubs' => ['enabled' => true]. Without it the path is ignored (#2198)
  • Custom paths.generator.<key> without namespace (actions, casts, enums, exceptions, helpers, interfaces, repository, services, traits) now derives the namespace from path. Add namespace to keep the old one (#2207)
  • module:make rejects generator paths outside paths.app_folder, and with app_folder => '' paths that do not match their StudlyCase namespace (Providers, not app/Providers). It exits 1 and lists the bad keys (#2209, #2225)
  • generate => false also skips the stub files the key owns. 'assets' => false no longer writes vite.config.js and package.json. Set the key to true to get them back (#2223)
  • Published route-provider.stub / scaffold/provider.stub: old copies keep working as before. To get the new behaviour (routes dropped when not in stubs.files or routes.generate is false; provider list follows generated providers), copy the %%START_WEB_ROUTES%%/%%END_WEB_ROUTES%% and %%START_API_ROUTES%%/%%END_API_ROUTES%% markers and protected array $providers = [$PROVIDERS$]; from src/Commands/stubs/ (#2216, #2180)
  • No published config/modules.php: translation auto-discovery is now off. Publish the config and set 'auto-discover' => ['translations' => true] if you relied on it (#2184)
  • module:publish-translation writes to lang/modules/{module}. Move old copies from resources/lang/{module}. While resources/lang exists, lang_path() points to it and lang/ stops loading. Modules generated with v11 stubs: use lang_path('modules/...') instead of resource_path('lang/modules/...') (#2185)
  • Module config files other than config.php publish to config/<module>/<file>.php. Move files published earlier (#2186)
  • modules_statuses.json must be a JSON object (module name to true/false). A corrupt file or a bad modules.activator config now throws (#2205)

Behaviour changes

  • Scripts, CI and deploys: a module command with no module and no --all in non-interactive mode prints No module given. Pass a module name or --all. and exits 1 (it did nothing and exited 0). Add --all or module names (#2212)
  • --all now runs non-interactively (-n, CI, scheduler): module:delete --all --force -n deletes every module (#2187)
  • More failures exit 1: failing seeders and nested calls, module:lang with missing translations, module:make-middleware and module:make-observer when the file exists (#2212, #2215, #2210)
  • module:make requires name when non-interactive (#2210)
  • module:migrate --subpath is now honoured. module:migrate-fresh --pretend is refused (#2212)
  • module:publish-translation and module:publish-migration skip existing files. Pass --force to overwrite (#2199)
  • Scheduled module:prune now deletes records (it found no models before) (#2197)
  • Reset and refresh also roll back loadMigrationsFrom() paths, so those tables are dropped too (#2226)
  • Rollback and reset run down() on the migration's connection ($connection, else --database). Check secondary databases (#2179)
  • Module listeners registered by hand and found by event discovery run twice. Remove one registration and re-run event:cache (#2219)
  • aliases in module.json are now registered. Check for clashes (#2206)

Extending the package

  • Installer and Publisher properties are nullable (redeclare them as nullable); Publisher defaults to $force = false (#2181, #2211, #2199)
  • BaseCommand subclasses overriding initialize() must call parent::initialize() (#2187)
  • GeneratorCommand adds a force option: remove your own (#2210)
  • MigrateCommand has no constructor, $migrator or $migration_list (#2226)

Deprecated (removed in v14)

Module::boot(), register(), registerTranslation(), isLoadFilesOnBoot(); FileRepository::boot() and register() (and on RepositoryInterface); ModuleEvent::BOOT and REGISTER; Traits\MigrationLoaderTrait; config keys modules.register.translations and modules.register.files; ContractsServiceProvider (#2204, #2196)

Features

  • vite: Add moduleRefreshPaths() for hot reload of module views (#2217) (fed50b9)

Bug Fixes

  • make: Look up created module by studly name when firing events (d175b6a)
  • migrations: Run rollback and reset down() on the selected connection (#2179) (17eca88)
  • make: Only list generated route/event providers in module $providers (#2180) (3ac69c1)
  • install: Allow module:install without version or --path (#2181) (f57a825)
  • Keep module_vite() from mutating the shared Vite instance (#2183) (2dff505)
  • Disable translation auto-discovery when modules config is not published (#2184) (2a2cb53)
  • Load translations published by module:publish-translation (#2185) (8443999)
  • Publish module config files to the path of their config key (#2186) (a97db87)
  • Resolve --all without interaction and honour --direction (#2187) (8613953)
  • publish: Fail with ModuleNotFoundException for unknown module in module:publish-config (#2195) (22c3f37)
  • Register the module repository as a single shared instance (#2196) (478968a)
  • prune: Discover module models and skip missing models directories (#2197) (b8e7743)
  • Use package stubs unless stubs.enabled is true (#2198) (deedc70)
  • publish: Keep published translations and migrations unless --force is given (#2199) (c96304f)
  • Remove the app folder as a path prefix instead of with ltrim() (#2200) (a6b3ba6)
  • make-migration: Keep every field and reverse fields correctly in generated migrations (#2202) (c00656a)
  • prune: Resolve modules through the repository (#2203) (26da9dc)
  • Fail clearly on bad activator config, corrupt statuses and unknown modules (#2205) (c1a91e6)
  • Build generated namespaces and paths from config (#2207) (d19f7bb)
  • Register module aliases, fix module:list --only=priority and the module cache path (#2206) (096ac14)
  • make: Stop module:make when generator paths are outside app_folder (#2209) (7158607)
  • commands: Return a failure status, validate modules up front and make migration commands safe (#2212) (2930a41)
  • install: Keep composer.json and phpunit.xml intact and handle failed installs (#2211) (0fb8ffb)
  • make: Return errors from generators, add --force everywhere and reject paths outside the module (#2210) (5404e9b)
  • stubs: Render stub placeholders in one pass and escape values per output format (#2213) (828eb93)
  • make: Stop module:make on invalid JSON stubs and report composer dump-autoload failures (#2214) (824b33a)
  • Fail module:lang on missing translations, read plural generator namespaces, fix --force help (#2215) (200c8dc)
  • Skip routes removed from stubs.files in generated RouteServiceProvider (#2216) (7155187)
  • events: Discover module listeners with Laravel event discovery (#2219) (2bb8b99)
  • make: Skip stub files whose generator is disabled (#2223) (7d77a57)
  • make: Reject root-mapped generator paths that mismatch their namespace (#2225) (f59c6aa)
  • make: Keep fully qualified --event class in module:make-listener (#2224) (a45a878)
  • migrations: Use the same module migration paths in every module:migrate command (#2226) (f273571)
  • seed: Warn when module:seed finds no seeder to run (#2227) (87f0ad4)

Refactor

  • Deprecate the unused module boot/register chain and remove dead code (#2204) (3a842c5)

Documentation

  • Document the trail code map in AGENTS.md (#2182) (c2818c7)
  • Rewrite README and add social preview image (#2194) (98922a5)
  • agents: Never use git stash in a worktree (#2201) (e20271d)

Other

  • Enable trail learnings (7469469)
  • Run tests without coverage by default, add check/analyse scripts and a phpstan config (#2208) (3137382)
  • phpstan: Add Larastan to static analysis (#2218) (44ae2d6)
  • phpstan: Raise level to 5 (#2222) (40a0821)

Don't miss a new laravel-modules release

NewReleases is sending notifications on new releases.