conedevelopment / i18n

Push your Laravel translations to the front-end and use them easily with JavaScript.
https://pineco.de/using-laravels-localization-js/
MIT License
129 stars 21 forks source link

Local package commands not found #23

Closed Futskito closed 4 years ago

Futskito commented 4 years ago

It's a rare bug that I found today...

If you have any local package registered in your app, and you have i18n installed, laravel seems to be unable to register package commands with the typical code in the package Service Provider:

if($this->app->runningInConsole()){ $this->commands([ MyCommandClass:class, ]); }

rafatga commented 4 years ago

Hi Adam, My colleague @Futskito and I started using your laravel package to handle the vue translations system. Unfortunately today we ran into an error that made us lose, quite some time and we decided to migrate to another library.

Even though we already moved to another library I will try to explain the error so you can fix it for your current and future users.

In all our projects we divide our code in domains, so we create Modules using composer and laravel. https://github.com/rafatga/thepinecode-i18n-issue

Issue description If your project has modules and you register your commands in you module provider you will see that as soon as you install the library (thepinecode /i18n) your commands will be unregistered and you will get the error ( There are no commands defined in the "resourcing" namespace. )

Screen Shot 2020-07-03 at 9 46 16 PM

https://github.com/rafatga/thepinecode-i18n-issue/blob/master/Modules/Admin/Providers/AdminServiceProvider.php

Screen Shot 2020-07-03 at 10 06 41 PM

Before installing (thepinecode /i18n) As you can see when you write the command (php artisan list) it appears the commands registered (admin:install) & (frontend:install)

Screen Shot 2020-07-03 at 9 44 31 PM

After the installation of (thepinecode /i18n) After the installation of the library you will see that the commands does not appear registered anymore.

Screen Shot 2020-07-03 at 9 47 29 PM

Bug The reason why the commands get unregistered is because the library (thepinecode /i18n) executes the command (view:clear) in the function boot of the provider.

Screen Shot 2020-07-03 at 10 16 38 PM
iamgergo commented 4 years ago

@rafatga @Futskito Hi,

Thanks for reporting the issue! I'll revert the view clear command. It can make local development a bit slower, but there are some interesting conflicts, so we need to fix this.

Thanks again!

iamgergo commented 4 years ago

https://github.com/thepinecode/i18n/pull/18 is reverted now.