Log1x / acf-composer

Compose ACF Fields, Blocks, Widgets, and Option Pages with ACF Builder on Sage 10.
https://github.com/Log1x/acf-composer
MIT License
414 stars 56 forks source link

Issue with publishing. Acf composer with sage 10 #109

Closed ashleyvansoeren closed 2 years ago

ashleyvansoeren commented 2 years ago

Hi, Not sure if this question fits here. Im trying to use acf composer with sage 10. Installation goes well until i hit wp acorn vendor:publish --provider="Log1x\AcfComposer\Providers\AcfComposerServiceProvider"

the error i get is this:

No publishable resources for tag []. Publishing complete.

i googled and tried to use the acf.php in config. This doesnt solve it. I also tried wp acorn vendor:publish. This doesnt fix it either.

I cant use the wp acorn acf:field Example. It wil give me: There are no commands defined in the "acf" namespace. I think this has to do with the publish issue.

I installed acf in the theme folder.

I can make the field folder and files manually but i dont get any fields in wordpress.

Does anyone have a solution for me?

Thanks!

estudiooka commented 2 years ago

+1

Log1x commented 2 years ago

Are you on Acorn 2.0.3?

Try running wp acorn optimize:clear first.

ashleyvansoeren commented 2 years ago

Are you on Acorn 2.0.3?

Try running wp acorn optimize:clear first.

Thank you for your answer.

After I run this it got rid of the Acf name space issue. But i still don't get any fields in Wordpress. I forgot to edit this in my post after reposting it here. Sorry about that. Any idea why I don't get any fields?

estudiooka commented 2 years ago

wp acorn package:discover fixes the issue.

minemindmedia commented 2 years ago

Yep, having the same issue here.

I have Acorn 2.0.3 installed via Sage.

wp acorn package:discover:

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.

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: 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
 > 

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

No publishable resources for tag [].

wp acorn acf:field Fleet

There are no commands defined in the "acf" namespace.

ashleyvansoeren commented 2 years ago

wp acorn package:discover fixes the issue.

wp acorn vendor:publish --provider="Log1x\AcfComposer\Providers\AcfComposerServiceProvider" No publishable resources for tag []. Publishing complete.

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

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

unfortunatly it doesnt fix my issue. i cant publish it from the list, it will only give me these options. I still get the acf is not defined in the name space. optimize doesnt work either.

minemindmedia commented 2 years ago

I was chatting with Brandon last week and I know he's aware of this inconsistent issue. I believe he is investigating and working on a fix for this. Hang tight.

Log1x commented 2 years ago

I'm still unsure what the issue is but it is not specific to ACF Composer and would be a bug with Acorn. 😞

I'm not being able to reproduce it consistently.

Can someone with the issue share more on their current environment? OS, PHP version, where Acorn is installed (plugin vs bedrock vs Sage), etc.

ashleyvansoeren commented 2 years ago

I'm still unsure what the issue is but it is not specific to ACF Composer and would be a bug with Acorn. 😞

I'm not being able to reproduce it consistently.

Can someone with the issue share more on their current environment? OS, PHP version, where Acorn is installed (plugin vs bedrock vs Sage), etc.

Im using a macbook with high sierra. I believe i am using php 7.4. This time i set up the project with bedrock. Then use the terminal to install sage in the theme folder.

I have used acf composer before but i believe i used local wp host(the green and white logo) then instead of bedrock. So maybe bedrock is the issue or acorn.

Should i be able to use acf composer without acorn? I tried to use the acf.php in config as stated in another issue but this doesnt fixed it for me...

minemindmedia commented 2 years ago

Big Sur 11.6.1 PHP 7.4.28 Acorn 2.0.3 (via Sage)

Ok, so I setup a completely new install of the latest versions of Trellis, Bedrock and Sage 10 - today.

Looks like Trellis is packaged with PHP 8.0. After booting up, I attempted to first require ACF Composer in the theme and the package was not discovered.

I switched to PHP 7.4 and provisioned. Then I was able to discover ACF Composer and publish it.

Next, I installed Navi via the theme and it was discovered but not available in the publish list:

vagrant@trellis:/srv/www/acorntest.com/current$ wp acorn package:discover
Discovered Package: log1x/acf-composer
Discovered Package: log1x/navi
Discovered Package: nesbot/carbon
Discovered Package: roots/sage
Package manifest generated successfully.
vagrant@trellis:/srv/www/acorntest.com/current$ 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: Log1x\AcfComposer\Providers\AcfComposerServiceProvider
  [2] Provider: Roots\Acorn\Providers\AcornServiceProvider
  [3] Tag: acorn
  [4] Tag: config
 > 0

Now, while typing up the response I have required Poet via Sage:

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

And it is not immediately discoverable:

vagrant@trellis:/srv/www/acorntest.com/current$ wp acorn package:discover
Discovered Package: log1x/acf-composer
Discovered Package: log1x/navi
Discovered Package: nesbot/carbon
Discovered Package: roots/sage
Package manifest generated successfully.

After running wp acorn optimize:clear it becomes discoverable:

vagrant@trellis:/srv/www/acorntest.com/current$ wp acorn package:discover
Discovered Package: log1x/acf-composer
Discovered Package: log1x/navi
Discovered Package: log1x/poet
Discovered Package: nesbot/carbon
Discovered Package: roots/sage
Package manifest generated successfully.

And it also shows up in packages:

vagrant@trellis:/srv/www/acorntest.com/current$ 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: Log1x\AcfComposer\Providers\AcfComposerServiceProvider
  [2] Provider: Log1x\Poet\PoetServiceProvider
  [3] Provider: Roots\Acorn\Providers\AcornServiceProvider
  [4] Tag: acorn
  [5] Tag: config
 > 

Now I have removed Navi from my composer file, removed composer.lock and re-ran composer update:

  "require": {
    "php": "^7.4|^8.0",
    "log1x/acf-composer": "^2.0",
    "log1x/poet": "^2.0",
    "roots/acorn": "^2.0.3"
  },
➜  joshb composer update
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking log1x/navi (v2.0.2)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing log1x/navi (v2.0.2): Extracting archive
Generating optimized autoload files
42 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Now back to discovering:

vagrant@trellis:/srv/www/acorntest.com/current$ wp acorn package:discover
Discovered Package: log1x/acf-composer
Discovered Package: log1x/navi
Discovered Package: log1x/poet
Discovered Package: nesbot/carbon
Discovered Package: roots/sage
Package manifest generated successfully.

Now to publish (not visible):

vagrant@trellis:/srv/www/acorntest.com/current$ 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: Log1x\AcfComposer\Providers\AcfComposerServiceProvider
  [2] Provider: Log1x\Poet\PoetServiceProvider
  [3] Provider: Roots\Acorn\Providers\AcornServiceProvider
  [4] Tag: acorn
  [5] Tag: config
 > 

Now to clear:

vagrant@trellis:/srv/www/acorntest.com/current$ wp acorn optimize:clear
Compiled views cleared!
Configuration cache cleared!
Compiled services and packages files removed!
Caches cleared successfully!

And back to publish:

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

Checking packages.php in cache displays the following, where all 3 packages do exist:

vagrant@trellis:/srv/www/acorntest.com/current/web/app/cache/acorn/framework/cache

<?php return array (
  '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',
    ),
  ),
  'nesbot/carbon' => 
  array (
    'providers' => 
    array (
      0 => 'Carbon\\Laravel\\ServiceProvider',
    ),
  ),
  'roots/sage' => 
  array (
    'providers' => 
    array (
      0 => 'App\\Providers\\ThemeServiceProvider',
    ),
  ),
);

Although Navi doesn't appear to have published, I decided to see if I could use it anyhow and added a basic menu setup based on the example: https://github.com/Log1x/navi/tree/master/examples/sage-10 -- and it does work.

So, now I am able to publish ACF Composer but unable to publish Navi. Hopefully this wasn't too much information.

ashleyvansoeren commented 2 years ago

Big Sur 11.6.1 PHP 7.4.28 Acorn 2.0.3 (via Sage)

Ok, so I setup a completely new install of the latest versions of Trellis, Bedrock and Sage 10 - today.

Looks like Trellis is packaged with PHP 8.0. After booting up, I attempted to first require ACF Composer in the theme and the package was not discovered.

I switched to PHP 7.4 and provisioned. Then I was able to discover ACF Composer and publish it.

Next, I installed Navi via the theme and it was discovered but not available in the publish list:

vagrant@trellis:/srv/www/acorntest.com/current$ wp acorn package:discover
Discovered Package: log1x/acf-composer
Discovered Package: log1x/navi
Discovered Package: nesbot/carbon
Discovered Package: roots/sage
Package manifest generated successfully.
vagrant@trellis:/srv/www/acorntest.com/current$ 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: Log1x\AcfComposer\Providers\AcfComposerServiceProvider
  [2] Provider: Roots\Acorn\Providers\AcornServiceProvider
  [3] Tag: acorn
  [4] Tag: config
 > 0

Now, while typing up the response I have required Poet via Sage:

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

And it is not immediately discoverable:

vagrant@trellis:/srv/www/acorntest.com/current$ wp acorn package:discover
Discovered Package: log1x/acf-composer
Discovered Package: log1x/navi
Discovered Package: nesbot/carbon
Discovered Package: roots/sage
Package manifest generated successfully.

After running wp acorn optimize:clear it becomes discoverable:

vagrant@trellis:/srv/www/acorntest.com/current$ wp acorn package:discover
Discovered Package: log1x/acf-composer
Discovered Package: log1x/navi
Discovered Package: log1x/poet
Discovered Package: nesbot/carbon
Discovered Package: roots/sage
Package manifest generated successfully.

And it also shows up in packages:

vagrant@trellis:/srv/www/acorntest.com/current$ 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: Log1x\AcfComposer\Providers\AcfComposerServiceProvider
  [2] Provider: Log1x\Poet\PoetServiceProvider
  [3] Provider: Roots\Acorn\Providers\AcornServiceProvider
  [4] Tag: acorn
  [5] Tag: config
 > 

Now I have removed Navi from my composer file, removed composer.lock and re-ran composer update:

  "require": {
    "php": "^7.4|^8.0",
    "log1x/acf-composer": "^2.0",
    "log1x/poet": "^2.0",
    "roots/acorn": "^2.0.3"
  },
➜  joshb composer update
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
  - Locking log1x/navi (v2.0.2)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing log1x/navi (v2.0.2): Extracting archive
Generating optimized autoload files
42 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Now back to discovering:

vagrant@trellis:/srv/www/acorntest.com/current$ wp acorn package:discover
Discovered Package: log1x/acf-composer
Discovered Package: log1x/navi
Discovered Package: log1x/poet
Discovered Package: nesbot/carbon
Discovered Package: roots/sage
Package manifest generated successfully.

Now to publish (not visible):

vagrant@trellis:/srv/www/acorntest.com/current$ 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: Log1x\AcfComposer\Providers\AcfComposerServiceProvider
  [2] Provider: Log1x\Poet\PoetServiceProvider
  [3] Provider: Roots\Acorn\Providers\AcornServiceProvider
  [4] Tag: acorn
  [5] Tag: config
 > 

Now to clear:

vagrant@trellis:/srv/www/acorntest.com/current$ wp acorn optimize:clear
Compiled views cleared!
Configuration cache cleared!
Compiled services and packages files removed!
Caches cleared successfully!

And back to publish:

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

Checking packages.php in cache displays the following, where all 3 packages do exist:

vagrant@trellis:/srv/www/acorntest.com/current/web/app/cache/acorn/framework/cache

<?php return array (
  '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',
    ),
  ),
  'nesbot/carbon' => 
  array (
    'providers' => 
    array (
      0 => 'Carbon\\Laravel\\ServiceProvider',
    ),
  ),
  'roots/sage' => 
  array (
    'providers' => 
    array (
      0 => 'App\\Providers\\ThemeServiceProvider',
    ),
  ),
);

Although Navi doesn't appear to have published, I decided to see if I could use it anyhow and added a basic menu setup based on the example: https://github.com/Log1x/navi/tree/master/examples/sage-10 -- and it does work.

So, now I am able to publish ACF Composer but unable to publish Navi. Hopefully this wasn't too much information.

How did you managed to get it working? I'm on PHP 7.4 but it is not working. I did clear too and tried new installations but no luck

minemindmedia commented 2 years ago

I didn't exactly manage to get it working. It appeared that in this case, Navi was not being published but still was being published based on the cached packages.php file.

A different and recent test project was similar. It was showing that ACF Composer was installed and published but would not recognize the namespace, even when it was appearing in the cahced packages.php file.

ashleyvansoeren commented 2 years ago

I didn't exactly manage to get it working. It appeared that in this case, Navi was not being published but still was being published based on the cached packages.php file.

A different and recent test project was similar. It was showing that ACF Composer was installed and published but would not recognize the namespace, even when it was appearing in the cahced packages.php file.

Oh I'm sorry. I read that you got something with Acf but didn't read it right!

Log1x commented 2 years ago

Although Navi doesn't appear to have published,

Navi doesn't publish anything so it is working as intended.

GiulioPecorella commented 2 years ago

I didn't exactly manage to get it working. It appeared that in this case, Navi was not being published but still was being published based on the cached packages.php file.

A different and recent test project was similar. It was showing that ACF Composer was installed and published but would not recognize the namespace, even when it was appearing in the cahced packages.php file.

I'm having the same issue too: thing is everything used to work at first but now doesn't work anymore.

I've updated Sage to the latest version (we were working on a 10.0.2-beta and installed Acorn in the Bedrock folder while I went back and forth installing acf-composer on Bedrock or Sage to no avail even though it appears in the cached packages.php file.

minemindmedia commented 2 years ago

@Log1x - Still having issues here where I can't get ACF Composer to publish like I can with other packages:

/sage/composer.json:

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

Clear:

wp acorn optimize:clear
Compiled views cleared!
Configuration cache cleared!
Compiled services and packages files removed!
Caches cleared successfully!

Discover:

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

Publish:

 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
 > 

Even when adding the following line to /config/app.php and clearing acorn cache, it still doesn't appear in the publishing list:

Log1x\AcfComposer\Providers\AcfComposerServiceProvider::class,

Attempting to run: $ wp acorn vendor:publish --provider="Log1x\AcfComposer\Providers\AcfComposerServiceProvider"

Returns:

No publishable resources for tag [].
Publishing complete.

Checking cache in: /current/web/app/cache/acorn/framework/cache

Shows ACF Composer as the very first entry in the array:

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

Do you want to make a bug report on the Acorn repo? You can reference this issue and the steps you've taken to try to get it to publish/discover.

minemindmedia commented 2 years ago

FYI everyone. Bug report has been issues here: https://github.com/roots/acorn/issues/210 Please follow for updates.

Log1x commented 2 years ago

This can't be reproduced.

joaodfmota commented 2 years ago

Isn't it related to the order of this?

https://github.com/Log1x/acf-composer/blob/f3efa1ba6e075e8868ca5ad9759cead9883b0ec5/src/Providers/AcfComposerServiceProvider.php#L29

I've moved to be right after the this->publishes and it shows up.

bantunesm commented 2 years ago

Hi guys I had the problem and it was weird because i got it working 1 hour before. I had 1 partial and 1 field sharing same name. After deleting the field, it works again.

Update I thought it was a conflict from names but it seems it don't like a Builder.php named file in fields/ folder. If i rename _Builder.php, acf command is working again

@Log1x

GiulioPecorella commented 2 years ago

If that's of any help we decided to scrape acf-composer on a project because we couldn't publish it... Turns out someone committed a file with a typo (AddText with a capital A) and that blocked the whole thing.

alexandre-tobia commented 2 years ago

Hi, same problem here

@Log1x - Still having issues here where I can't get ACF Composer to publish like I can with other packages:

/sage/composer.json:

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

Clear:

wp acorn optimize:clear
Compiled views cleared!
Configuration cache cleared!
Compiled services and packages files removed!
Caches cleared successfully!

Discover:

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

Publish:

 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
 > 

Even when adding the following line to /config/app.php and clearing acorn cache, it still doesn't appear in the publishing list:

Log1x\AcfComposer\Providers\AcfComposerServiceProvider::class,

Attempting to run: $ wp acorn vendor:publish --provider="Log1x\AcfComposer\Providers\AcfComposerServiceProvider"

Returns:

No publishable resources for tag [].
Publishing complete.

Checking cache in: /current/web/app/cache/acorn/framework/cache

Shows ACF Composer as the very first entry in the array:

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

Exactly the same problem here... does anyone have a solution ?

Thanks

RistoNiinemets commented 2 years ago

Same for me. However, I found out that 2.0.5 breaks it, 2.0.4 is working fine. @Log1x

Log1x commented 2 years ago

Same for me. However, I found out that 2.0.5 breaks it, 2.0.4 is working fine. @Log1x

Publishing doesn't work? There's no changes that'd affect the provider not being found / it not showing up in Acorn.

I'm not able to reproduce these issues. :( I'm using this on multiple sites in production.

RistoNiinemets commented 2 years ago

Any of the commands neither.

However, I went and tried switching code with 2.0.4, and this actually made a difference: https://github.com/Log1x/acf-composer/compare/v2.0.4...v2.0.5#diff-67c4aaeac6cc50d1ee56c23bb57abc7152a97c9525f39b02296b7214fe58479fL97-L101

When I switched this part back to 2.0.4, commands showed up, publishing started to work. However, then I finally got some error from my code - I had manually made App/Blocks namespace with blocks in it, and this conflicted. So I removed manually made blocks, reverted acf-composer back to original and it continued to work. However it is weird that this code change prevented commands to be available at all, and I didn't get any errors anywhere.

Log1x commented 2 years ago

Maybe I need to move https://github.com/Log1x/acf-composer/blob/master/src/Providers/AcfComposerServiceProvider.php#L29 to the bottom.

RistoNiinemets commented 2 years ago

I confirm that this actually makes a difference.

Log1x commented 2 years ago

Just pushed a release. Try v2.0.7 and let me know if it works.

RistoNiinemets commented 2 years ago

Working for me, thank you!

jrgd commented 3 months ago

I just had the There are no commands defined in the "acf" namespace. error on a fresh bedrock+sage install.

wp acorn package:discover sorted it

Log1x commented 3 months ago

I just had the There are no commands defined in the "acf" namespace. error on a fresh bedrock+sage install.

Make sure you run wp acorn acorn:install to properly put Acorn's post autoload dump in your composer.json so packages are discovered automatically.

DudeThatsErin commented 1 month ago

I'm running into this issue as well.

I'm using WP Engine's local site shell and this is what I am running and the result:

wp acorn acf:options Options --full

   ERROR  There are no commands defined in the "acf" namespace.  

This doesn't help:

wp acorn package:discover

   INFO  Discovering packages.  

  log1x/sage-directives ................................................. DONE
  nesbot/carbon ......................................................... DONE
  nunomaduro/termwind ................................................... DONE
  roots/sage ............................................................ DONE

Also tried reinstalling acorn:

wp acorn acorn:install

 ┌ Would you like to install the Acorn autoload dump script? ───┐
 │ Yes                                                          │
 └──────────────────────────────────────────────────────────────┘

 ┌ Would you like to initialize Acorn? ─────────────────────────┐
 │ Yes                                                          │
 └──────────────────────────────────────────────────────────────┘

 ┌ 🎉 All done! Would you like to show love by starring Acorn on GitHub? ┐
 │ No                                                                    │
 └───────────────────────────────────────────────────────────────────────┘

Then ran it again and same "no commands" error. Also tried the wp acorn optimize:clear and that didn't help either.

Log1x commented 1 month ago

Make sure you install ACF Composer alongside Acorn (same composer.json file) and have ACF Pro installed & activated.

DudeThatsErin commented 1 month ago

Just made sure:

composer require stoutlogic/acf-builder
./composer.json has been updated
Running composer update stoutlogic/acf-builder
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
2 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found
Using version ^1.12 for stoutlogic/acf-builder
erin@Erins-MacBook-Pro public % wp acorn acf:options Options --full    

   ERROR  There are no commands defined in the "acf" namespace.

ACF Pro is installed and activated.

Log1x commented 1 month ago

You only need to install ACF Composer it's self – it will install ACF Builder for you:

composer require log1x/acf-composer
DudeThatsErin commented 1 month ago

You only need to install ACF Composer it's self – it will install ACF Builder for you:

composer require log1x/acf-composer

Already ran that...

composer require log1x/acf-composer
./composer.json has been updated
Running composer update log1x/acf-composer
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Writing lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
2 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found
Using version ^3.0 for log1x/acf-composer
erin@Erins-MacBook-Pro public % wp acorn acf:options Options --full

   ERROR  There are no commands defined in the "acf" namespace.  

I ran that command first before everything else but ran it again just now just in case.

Log1x commented 1 month ago

I had no way of knowing that and your example of making sure was misleading.

Can you show me your full composer.json?

DudeThatsErin commented 1 month ago
{
  "name": "roots/sage",
  "type": "wordpress-theme",
  "license": "MIT",
  "description": "WordPress starter theme with a modern development workflow",
  "homepage": "https://roots.io/sage/",
  "authors": [
    {
      "name": "Ben Word",
      "email": "ben@benword.com",
      "homepage": "https://github.com/retlehs"
    },
    {
      "name": "Scott Walkinshaw",
      "email": "scott.walkinshaw@gmail.com",
      "homepage": "https://github.com/swalkinshaw"
    },
    {
      "name": "QWp6t",
      "email": "hi@qwp6t.me",
      "homepage": "https://github.com/qwp6t"
    },
    {
      "name": "Brandon Nifong",
      "email": "brandon@tendency.me",
      "homepage": "https://github.com/log1x"
    }
  ],
  "keywords": [
    "wordpress"
  ],
  "support": {
    "issues": "https://github.com/roots/sage/issues",
    "forum": "https://discourse.roots.io/"
  },
  "autoload": {
    "psr-4": {
      "App\\": "app/"
    }
  },
  "require": {
    "php": ">=8.1",
    "log1x/sage-directives": "^2.0",
    "roots/acorn": "^4.3"
  },
  "require-dev": {
    "laravel/pint": "^1.13"
  },
  "suggest": {
    "log1x/sage-directives": "A collection of useful Blade directives for WordPress and Sage (^1.0)."
  },
  "config": {
    "optimize-autoloader": true,
    "preferred-install": "dist",
    "sort-packages": true
  },
  "minimum-stability": "dev",
  "prefer-stable": true,
  "extra": {
    "acorn": {
      "providers": [
        "App\\Providers\\ThemeServiceProvider"
      ]
    }
  },
  "scripts": {
    "post-autoload-dump": [
      "Roots\\Acorn\\ComposerScripts::postAutoloadDump"
    ]
  }
}
Log1x commented 1 month ago

I don't see log1x/acf-composer there. Make sure you are running composer require log1x/acf-composer in the same directory as your composer.json file that contains Acorn like I said above.

DudeThatsErin commented 1 month ago

Well, that explains it. I was running the commands in the wrong folder. 🤦🏼‍♀️

Thanks! It works now.