Log1x / pagi

A better WordPress pagination.
https://github.com/Log1x/pagi
MIT License
51 stars 8 forks source link

Package not automatically discovered in Radicle #18

Closed nikolov-tmw closed 4 months ago

nikolov-tmw commented 1 year ago

I've started using Radicle and was looking for a way to do pagination with blade templates and found your package. I installed it with composer, then when I tried to run wp acorn vendor:publish --provider='Log1x\Pagi\PagiServiceProvider' I got this:

 INFO  No publishable resources for tag [].

I then tried running wp acorn package:discover and noticed that pagi wasn't listed in the output:

   INFO  Discovering packages.  

  blade-ui-kit/blade-heroicons ................................................................................................................ DONE
  blade-ui-kit/blade-icons .................................................................................................................... DONE
  nesbot/carbon ............................................................................................................................... DONE
  nunomaduro/collision ........................................................................................................................ DONE
  nunomaduro/termwind ......................................................................................................................... DONE
  pestphp/pest ................................................................................................................................ DONE
  spatie/laravel-ignition ..................................................................................................................... DONE
  roots/bedrock ............................................................................................................................... DONE

By looking through the composer.json of some of these packages, I noticed that they have extra.laravel property defined. Looking at pagi's composer.json I see the property is extra.acorn instead. So I modified locally the composer.json to use laravel instead of acorn and auto-discovery and publishing works now :slightly_smiling_face:

I'm not sure if this is a problem with pagi, or maybe Radicle does something different compared to just Acorn or if it is a regression in how Acorn discovers packages. Actually digging up through Acorn a bit I found this commit from 3 years ago - https://github.com/roots/acorn/commit/8053a4559904afe0b2f62ae256533b57f6d7f3da#diff-3d6f9f59a29536cc3cf940254daab52d5f7aaafb8af71a61140dd6eef34c7b81R5 - where PackageDiscoverCommand switched from using Roots\Acorn\PackageManifest(which supports both extra.laravel and extra.acorn) to using Illuminate\Foundation\PackageManifest(which doesn't support extra.acorn obviously :slightly_smiling_face: ).

So do you think your package should switch over to using extra.laravel, or should Acorn consider adding back support for extra.acorn? I saw that you work at/are part of Roots, so I am guessing you'll have a good understanding of how to approach this :slightly_smiling_face:

Thank you for your time!

Log1x commented 4 months ago

Hey, sorry – didn't see this. It should be fixed now assuming you're on the latest Radicle Acorn bootloader.

nikolov-tmw commented 4 months ago

No worries and thank you for fixing it! :slightly_smiling_face: