Skip to content

Conversation

solomon-ochepa
Copy link

@solomon-ochepa solomon-ochepa commented Jul 8, 2025

Summary
Resolve issues with the app/ path by supporting both default and custom names while ensuring proper namespace conversion.

Description
The app/ path was previously removed due to multiple issues. This task involves reintroducing support for it while ensuring:

  • It correctly supports both default (app/) and custom paths (src/, /).
  • The namespace is properly converted to StudlyCase.
  • No existing features are broken in the process.
  • Tests have been added to verify correctness and stability.

Acceptance Criteria:

  • app/ path works with both default and custom configurations.
  • Namespace is correctly converted to StudlyCase.
  • No feature breakages in this branch.
  • Tests validate the expected behavior.

Tests (PathNamespaceTest)

  • test_generates_app_path()
  • test_generates_custom_app_path()
  • test_generates_root_app_path()
  • test_removes_duplicate_app_path()
  • test_identifies_app_path()
  • test_recognizes_custom_app_path(), etc.

Let me know if you want any modifications! 🚀

Summary by CodeRabbit

  • New Features

    • Improved configuration options for Livewire integration with Laravel modules, including enhanced namespace handling and support for custom modules.
    • Added default layout and metadata placeholders to Livewire component stubs.
  • Bug Fixes

    • Resolved issues with module path and namespace resolution for both standard and custom modules.
  • Refactor

    • Simplified and clarified command and parser logic for module and component handling.
    • Removed internal dependency checks for Composer packages.
    • Reorganized code structure using new traits for better maintainability.
  • Chores

    • Updated project dependencies and development tooling in Composer configuration.
    • Added a .gitignore to exclude common build, dependency, and system files.
  • Style

    • Improved code style and readability through import aliasing and method signature updates.

coderabbitai[bot]

This comment was marked as duplicate.

coderabbitai[bot]

This comment was marked as duplicate.

@solomon-ochepa solomon-ochepa force-pushed the fix-issue-with-app-path-and-namespace branch from 2bb7c53 to bfcc23f Compare July 10, 2025 02:04
@solomon-ochepa solomon-ochepa force-pushed the fix-issue-with-app-path-and-namespace branch from bfcc23f to c51d53b Compare July 10, 2025 02:10
@solomon-ochepa solomon-ochepa force-pushed the fix-issue-with-app-path-and-namespace branch from c51d53b to b91925f Compare July 10, 2025 08:15
@mhmiton
Copy link
Owner

mhmiton commented Aug 2, 2025

@solomon-ochepa Sorry for the delay. Thanks for your PR. There is a lot of refactored code, and it's great.

Also, I checked, and I am getting some errors.

Errors:

Method Nwidart\Modules\Laravel\Module::app_path does not exist.
Call to undefined method Mhmiton\LaravelModulesLivewire\Providers\LivewireComponentServiceProvider::namespace()
command: php artisan module:make-livewire Pages/ContactPage Blog

Error: Class "Nwidart\Modules\Helpers\Path" not found

It seems not to register the Livewire component, only registers as a Volt component.

My component path:

Modules/Blog/app/Livewire/Pages/AboutPage.php

It's registering - "app/App\Livewire" directory. But this directory does not exist. Existing directory is - "app/Livewire".

So, without a volt, it's not working. The component was not found.

Could you explain the "app" namespace things, please? Would you like to support just the "app" or the "src" namespace for components? It will be registered by the modules config - "app_path"?

I checked with:

Laravel: 12
Laravel Modules: 12
Livewire: 3.6

@solomon-ochepa
Copy link
Author

@solomon-ochepa Sorry for the delay. Thanks for your PR. There is a lot of refactored code, and it's great.

Also, I checked, and I am getting some errors.

Errors:

Method Nwidart\Modules\Laravel\Module::app_path does not exist.
Call to undefined method Mhmiton\LaravelModulesLivewire\Providers\LivewireComponentServiceProvider::namespace()
command: php artisan module:make-livewire Pages/ContactPage Blog

Error: Class "Nwidart\Modules\Helpers\Path" not found

It seems not to register the Livewire component, only registers as a Volt component.

My component path:

Modules/Blog/app/Livewire/Pages/AboutPage.php

It's registering - "app/App\Livewire" directory. But this directory does not exist. Existing directory is - "app/Livewire".

So, without a volt, it's not working. The component was not found.

Could you explain the "app" namespace things, please? Would you like to support just the "app" or the "src" namespace for components? It will be registered by the modules config - "app_path"?

I checked with:

Laravel: 12
Laravel Modules: 12
Livewire: 3.6

This is a complementary branch for the laravel-modules package. You must checkout to the same branch on both repositories - I named both branches the same.

Repository owner deleted a comment from coderabbitai bot Aug 2, 2025
@solomon-ochepa
Copy link
Author

Please let me know if you need more clarification.

This is a complimentary PR for nWidart/laravel-modules: Fix issues with app path and namespace #2042

You must check out both branches simultaneously.

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