roots / acorn

Laravel components for WordPress plugins and themes
https://roots.io/acorn/
MIT License
815 stars 94 forks source link

Bug: ACF Composer not publishing correctly / unavailable. #210

Closed minemindmedia closed 2 years ago

minemindmedia commented 2 years ago

Terms

Description

What's wrong?

Sometimes packages cannot be published.

What have you tried?

Please see steps below.

What insights have you gained?

None.

Possible solutions

None I am aware of.

Temporary workarounds

Adding the Laravel service provider manually to /config/app.php will work occasionally.

Steps To Reproduce

Add ACF Composer to /sage/composer.json and update.

  "require": {
    "php": "^7.4|^8.0",
    "log1x/acf-composer": "^2.0",
    "roots/acorn": "^2.0.3"
  },

Discover packages:

wp acorn package:discover
Discovered Package: log1x/acf-composer
Discovered Package: nesbot/carbon
Discovered Package: roots/sage
Package manifest generated successfully.

Publish packages: (ACF Composer not in the list):

wp acorn vendor:publish

 Which provider or tag's files would you like to publish?:
  [0] Publish files from all providers and tags listed below
  [1] Provider: Roots\Acorn\Providers\AcornServiceProvider
  [2] Tag: acorn
 > 

Checking cache reveals ACF composer entry in array. /current/web/app/cache/acorn/framework/cache:

<?php return array (
  'log1x/acf-composer' => 
  array (
    'providers' => 
    array (
      0 => 'Log1x\\AcfComposer\\Providers\\AcfComposerServiceProvider',
    ),
  ),

Other packages can be discovered and published:

  "require": {
    "php": "^7.4|^8.0",
    "andreiio/blade-iconoir": "^1.4",
    "blade-ui-kit/blade-heroicons": "^1.3",
    "blade-ui-kit/blade-icons": "^1.2",
    "codeat3/blade-weather-icons": "^1.4",
    "log1x/acf-composer": "^2.0",
    "log1x/navi": "^2.0",
    "log1x/poet": "^2.0",
    "log1x/sage-html-forms": "^1.0",
    "roots/acorn": "^2.0.3"
  },
Discovered Package: andreiio/blade-iconoir
Discovered Package: blade-ui-kit/blade-heroicons
Discovered Package: blade-ui-kit/blade-icons
Discovered Package: codeat3/blade-weather-icons
Discovered Package: log1x/acf-composer
Discovered Package: log1x/navi
Discovered Package: log1x/poet
Discovered Package: log1x/sage-html-forms
Discovered Package: nesbot/carbon
Discovered Package: roots/sage
Package manifest generated successfully.
Which provider or tag's files would you like to publish?:
  [0 ] Publish files from all providers and tags listed below
  [1 ] Provider: AndreiIonita\BladeIconoir\BladeIconoirServiceProvider
  [2 ] Provider: BladeUI\Heroicons\BladeHeroiconsServiceProvider
  [3 ] Provider: BladeUI\Icons\BladeIconsServiceProvider
  [4 ] Provider: Codeat3\BladeWeatherIcons\BladeWeatherIconsServiceProvider
  [5 ] Provider: Log1x\Poet\PoetServiceProvider
  [6 ] Provider: Roots\Acorn\Providers\AcornServiceProvider
  [7 ] Tag: acorn
  [8 ] Tag: blade-heroicons
  [9 ] Tag: blade-heroicons-config
  [10] Tag: blade-iconoir
  [11] Tag: blade-icons
  [12] Tag: blade-weather-icons-config
  [13] Tag: blade-wi
  [14] Tag: config
 > 0

Copied Directory [/vendor/andreiio/blade-iconoir/resources/svg] To [/public/vendor/blade-iconoir]
Copied Directory [/vendor/blade-ui-kit/blade-heroicons/resources/svg] To [/public/vendor/blade-heroicons]
Copied Directory [/vendor/codeat3/blade-weather-icons/resources/svg] To [/public/vendor/blade-weather-icons]
Publishing complete.

Additional information and users with same problem can be found here: https://github.com/Log1x/acf-composer/issues/109

Expected Behavior

Expecting ACF Composer to be listed in the set of available packages to publish:

 [0 ] Publish files from all providers and tags listed below
  [1 ] Provider: AndreiIonita\BladeIconoir\BladeIconoirServiceProvider
  [2 ] Provider: BladeUI\Heroicons\BladeHeroiconsServiceProvider
  [3 ] Provider: BladeUI\Icons\BladeIconsServiceProvider
  [4 ] Provider: Codeat3\BladeWeatherIcons\BladeWeatherIconsServiceProvider
  [5 ] Provider: Log1x\Poet\PoetServiceProvider
  [6 ] Provider: Roots\Acorn\Providers\AcornServiceProvider
  [7 ] Tag: acorn
  [8 ] Tag: blade-heroicons
  [9 ] Tag: blade-heroicons-config
  [10] Tag: blade-iconoir
  [11] Tag: blade-icons
  [12] Tag: blade-weather-icons-config
  [13] Tag: blade-wi
  [14] Tag: config

Actual Behavior

ACF Composer package not becoming available.

Attempting to generate ACF Field, wp acorn acf:field Fleet results in: There are no commands defined in the "acf" namespace.

After adding and publishing additional packages, ACF Composer is listed in cache but not functioning:

<?php return array (
  'andreiio/blade-iconoir' => 
  array (
    'providers' => 
    array (
      0 => 'AndreiIonita\\BladeIconoir\\BladeIconoirServiceProvider',
    ),
  ),
  'blade-ui-kit/blade-heroicons' => 
  array (
    'providers' => 
    array (
      0 => 'BladeUI\\Heroicons\\BladeHeroiconsServiceProvider',
    ),
  ),
  'blade-ui-kit/blade-icons' => 
  array (
    'providers' => 
    array (
      0 => 'BladeUI\\Icons\\BladeIconsServiceProvider',
    ),
  ),
  'codeat3/blade-weather-icons' => 
  array (
    'providers' => 
    array (
      0 => 'Codeat3\\BladeWeatherIcons\\BladeWeatherIconsServiceProvider',
    ),
  ),
  'log1x/acf-composer' => 
  array (
    'providers' => 
    array (
      0 => 'Log1x\\AcfComposer\\Providers\\AcfComposerServiceProvider',
    ),
  ),
  'log1x/navi' => 
  array (
    'providers' => 
    array (
      0 => 'Log1x\\Navi\\Providers\\NaviServiceProvider',
    ),
    'aliases' => 
    array (
      'Navi' => 'Log1x\\Navi\\Facades\\Navi',
    ),
  ),
  'log1x/poet' => 
  array (
    'providers' => 
    array (
      0 => 'Log1x\\Poet\\PoetServiceProvider',
    ),
  ),
  'log1x/sage-html-forms' => 
  array (
    'providers' => 
    array (
      0 => 'Log1x\\HtmlForms\\HtmlFormsServiceProvider',
    ),
  ),
  'nesbot/carbon' => 
  array (
    'providers' => 
    array (
      0 => 'Carbon\\Laravel\\ServiceProvider',
    ),
  ),
  'roots/sage' => 
  array (
    'providers' => 
    array (
      0 => 'App\\Providers\\ThemeServiceProvider',
    ),
  ),
);

Relevant Log Output

No response

Versions

Acorn 2.0.3, Big Sur 11.6.1

retlehs commented 2 years ago

please only use this repo for produceable bugs that are specific to acorn — this is not the repo for reporting issues for 3rd party packages

ashleyvansoeren commented 2 years ago

please only use this repo for produceable bugs that are specific to acorn — this is not the repo for reporting issues for 3rd party packages

We asked this on the Acf composer repo but they said it was a acorn issue. So that's why we published it here.

ishigami commented 2 years ago

Hi @ashleyvansoeren I know that my reply is a little late. But today I've experienced the same issue reported by you.

In my case, I've discovered that for each package installed in sage 10 theme, you need to run the command below before publish the package assets:

wp acorn optimize:clear

Then you can publish the package's assets safely. Like:

wp acorn vendor:publish --provider="Log1x\AcfComposer\Providers\AcfComposerServiceProvider"

And @retlehs I think this is a acorn specific issue.

Log1x commented 2 years ago

And @retlehs I think this is a acorn specific issue.

This is not an Acorn issue and all related issues that may have caused this situation have long been fixed.

Also, you generally shouldn't have to optimize:clear after requiring a package if you have your composer.json properly setup with post-autoload-dump.

"scripts": {
    "post-autoload-dump": [
        "Roots\\Acorn\\ComposerScripts::postAutoloadDump"
    ]
}
ishigami commented 2 years ago

Hi @Log1x, thanks for your reply.

Really, I didn't have the post-autoload-dump entry in my composer.json. Now, I've added it.

Thank you very much, bro!