3 namespace DrupalCodeGenerator\Command\Drupal_8;
5 use DrupalCodeGenerator\Command\BaseGenerator;
6 use DrupalCodeGenerator\Utils;
7 use Symfony\Component\Console\Input\InputInterface;
8 use Symfony\Component\Console\Output\OutputInterface;
9 use Symfony\Component\Console\Question\ConfirmationQuestion;
10 use Symfony\Component\Console\Question\Question;
13 * Implements d8:composer command.
15 class Composer extends BaseGenerator {
17 protected $name = 'd8:composer';
18 protected $description = 'Generates a composer.json file';
19 protected $alias = 'composer.json';
20 protected $label = 'composer.json';
25 protected function interact(InputInterface $input, OutputInterface $output) {
26 $questions['machine_name'] = new Question('Project machine name');
27 $questions['machine_name']->setValidator([Utils::class, 'validateMachineName']);
28 $questions['description'] = new Question('Description');
29 $questions['type'] = new Question('Type', 'drupal-module');
30 $questions['type']->setValidator([Utils::class, 'validateRequired']);
31 $questions['type']->setAutocompleterValues([
38 $questions['drupal_org'] = new ConfirmationQuestion('Is this project hosted on drupal.org?', FALSE);
40 $this->collectVars($input, $output, $questions);
43 ->path('composer.json')
44 ->template('d8/composer.twig');