wire-drupal / wire

Dynamic interfaces for Drupal
https://wire-drupal.com
Other
26 stars 0 forks source link

"Command "wire" is not defined." when doing "drush generate wire" #1

Closed stephencapellic closed 9 months ago

stephencapellic commented 9 months ago

Hello,

I'm following this guide [https://wire-drupal.com/docs/making-components] after installing Wire to make my first wire component. I did:

ddev drush generate wire

I got this error:

Command "wire" is not defined.

I then did:

ddev drush generate

And got this:

Drupal Code Generator 3.3.0.0

Run `drush generate [command]` and answer a few questions in order to write starter code to your project.

Available commands:                                                                                            
_global:                                                                                                       
  composer (composer.json)                                       Generates a composer.json file                
  controller                                                     Generates a controller                        
  field                                                          Generates a field                             
  hook                                                           Generates a hook                              
  install-file                                                   Generates an install file                     
  javascript                                                     Generates Drupal JavaScript file              
  layout                                                         Generates a layout                            
  module                                                         Generates Drupal module                       
  phpstorm-meta                                                  Generates PhpStorm metadata                   
  readme                                                         Generates README file                         
  render-element                                                 Generates Drupal render element               
  service-provider                                               Generates a service provider                  
  single-directory-component (sdc)                               Generates Drupal SDC theme component          
drush:                                                                                                         
  drush:alias-file (daf)                                         Generates a Drush site alias file.            
  drush:command-file (dcf)                                       Generates a Drush command file.               
  drush:generator (generator)                                    Generates Drush generator                     
  drush:symfony-command (symfony-command)                        Generates Symfony console command             
entity:                                                                                                        
  entity:bundle-class (bundle-class)                             Generate a bundle class for a content entity. 
  entity:configuration (config-entity)                           Generates configuration entity                
  entity:content (content-entity)                                Generates content entity                      
form:                                                                                                          
  form:config (config-form)                                      Generates a configuration form                
  form:confirm (confirm-form)                                    Generates a confirmation form                 
  form:simple (form)                                             Generates simple form                         
misc:                                                                                                          
  misc:apache-virtual-host (apache-virtual-host)                 Generates an Apache site configuration file   
  misc:nginx-virtual-host (nginx-virtual-host)                   Generates an Nginx site configuration file    
plugin:                                                                                                        
  plugin:action (action)                                         Generates action plugin                       
  plugin:block (block)                                           Generates block plugin                        
  plugin:ckeditor (ckeditor, ckeditor-plugin)                    Generates CKEditor plugin                     
  plugin:condition (condition)                                   Generates condition plugin                    
  plugin:constraint (constraint)                                 Generates constraint plugin                   
  plugin:entity-reference-selection (entity-reference-selection) Generates entity reference selection plugin   
  plugin:field:formatter (field-formatter)                       Generates field formatter plugin              
  plugin:field:type (field-type)                                 Generates field type plugin                   
  plugin:field:widget (field-widget)                             Generates field widget plugin                 
  plugin:filter (filter)                                         Generates filter plugin                       
  plugin:manager                                                 Generates plugin manager                      
  plugin:menu-link (menu-link)                                   Generates menu-link plugin                    
  plugin:migrate:destination (migrate-destination)               Generates migrate destination plugin          
  plugin:migrate:process (migrate-process)                       Generates migrate process plugin              
  plugin:migrate:source (migrate-source)                         Generates migrate source plugin               
  plugin:queue-worker (queue-worker)                             Generates queue worker plugin                 
  plugin:rest-resource (rest-resource)                           Generates rest resource plugin                
  plugin:views:argument-default (views-argument-default)         Generates views default argument plugin       
  plugin:views:field (views-field)                               Generates views field plugin                  
  plugin:views:style (views-style)                               Generates views style plugin                  
service:                                                                                                       
  service:access-checker (access-checker)                        Generates an access checker service           
  service:breadcrumb-builder (breadcrumb-builder)                Generates a breadcrumb builder service        
  service:cache-context (cache-context)                          Generates a cache context service             
  service:custom (custom-service)                                Generates a custom Drupal service             
  service:event-subscriber (event-subscriber)                    Generates an event subscriber                 
  service:logger (logger)                                        Generates a logger service                    
  service:middleware (middleware)                                Generates a middleware                        
  service:param-converter (param-converter)                      Generates a param converter service           
  service:path-processor (path-processor)                        Generates a path processor service            
  service:request-policy (request-policy)                        Generates a request policy service            
  service:response-policy (response-policy)                      Generates a response policy service           
  service:route-subscriber (route-subscriber)                    Generates a route subscriber                  
  service:theme-negotiator (theme-negotiator)                    Generates a theme negotiator                  
  service:twig-extension (twig-extension)                        Generates Twig extension service              
  service:uninstall-validator (uninstall-validator)              Generates a uninstall validator service       
test:                                                                                                          
  test:browser (browser-test)                                    Generates a browser based test                
  test:kernel (kernel-test)                                      Generates a kernel based test                 
  test:nightwatch (nightwatch-test)                              Generates a nightwatch test                   
  test:unit (unit-test)                                          Generates a unit test                         
  test:webdriver (webdriver-test)                                Generates a test that supports JavaScript     
theme:                                                                                                         
  theme                                                          Generates Drupal theme                        
  theme:settings                                                 Generates Drupal theme-settings.php file      
yml:                                                                                                           
  yml:breakpoints (breakpoints)                                  Generates a breakpoints yml file              
  yml:links:action (action-links)                                Generates a links.action yml file             
  yml:links:contextual (contextual-links)                        Generates links.contextual yml file           
  yml:links:menu (menu-links)                                    Generates a links.menu yml file               
  yml:links:task (task-links)                                    Generates a links.task yml file               
  yml:migration (migration, migration.yml)                       Generates a migration yml file                
  yml:module-libraries (module-libraries)                        Generates module libraries yml file           
  yml:permissions (permissions, permissions.yml)                 Generates a permissions yml file              
  yml:routing (routing, routing.yml)                             Generates a routing yml file                  
  yml:services (services, services.yml)                          Generates a services yml file                 
  yml:theme-libraries (theme-libraries)                          Generates theme libraries yml file  
hugronaphor commented 9 months ago

@stephencapellic Assuming you enabled the module and still not being able to use the generator I assume your drush version being fairly old is the issue as it doesn't recognize the generator registration.

Try to install Drush 11 in your local project composer.

stephencapellic commented 9 months ago

Hello @hugronaphor, thank you for addressing my issue so quickly. I'm running Drush 12, so the version is not the problem.

$ ddev drush
Drush Commandline Tool 12.4.3.0
hugronaphor commented 9 months ago

@stephencapellic OK, got it.

Drush 12 expects a new way to register generators( DCG3 ) [ drush-ops/drush/issues/5600 ].

For now it works only with Drush 11.

Have to think weather Drush 12 will now be a minimum requirement or support both.

stephencapellic commented 9 months ago

Ahhh... thanks!

Changed this:

"drush/drush": "^11 || ^12",

to:

"drush/drush": "^11",

by doing this:

ddev composer require drush/drush ^11 -W

Then:

$ ddev drush generate wire
 [warning] Undefined array key "no-ansi" GenerateCommands.php:76

 Welcome to wire generator!
––––––––––––––––––––––––––––

 Module machine name [web]:
 ➤ 

I'm not sure what the "Undefined array key "no-ansi" GenerateCommands.php:76" warning is all about, but it doesn't look important. FYI, I'm using VSCode in Gitpod, so maybe I'm missing a plugin in my Terminal settings.

I'm in business! Thank you for the support!

hugronaphor commented 9 months ago

@stephencapellic Since Drush 12 with DCG v3 now is recommended for Drupal ^10 and Wire works starting with Drupal 10 I dropped support for Drush 11 in favor of Drush 12.

Thanks for pointing out to this issue.

Available in new release 1.0.6

stephencapellic commented 9 months ago
  1. I upgraded to drupal-wire/wire 1.0.6
  2. I upgraded to Drush 12
  3. Tested:
$ ddev drush generate wire

 Welcome to wire generator!
––––––––––––––––––––––––––––

 Module machine name:
 ➤ 

Noting that the "Undefined array key "no-ansi" GenerateCommands.php:76" warning now longer appears.

Looks like we're good! Thanks!