Skip to content
This repository was archived by the owner on Nov 2, 2024. It is now read-only.

Commit 3c55fc6

Browse files
committed
Add support for specifying web directory
1 parent f1e0671 commit 3c55fc6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/DrupalInitCommand.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ protected function configure()
3737
new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
3838
new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
3939
new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
40+
new InputOption('web-dir', 'w', InputOption::VALUE_REQUIRED, 'Specify the docroot (defaults to web)', 'web'),
4041
// new InputOption('extensions', 'm', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Extensions (such as modules or themes) to require with a version constraint, e.g. panels:^4.0'),
4142
// new InputOption('extensions-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Extensions (such as modules or themes) to require for development with a version constraint, e.g. panels:^4.0'),
4243
])
@@ -86,7 +87,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
8687
$options = $file->read();
8788
$options['extra'] = [
8889
'drupal-composer-helper' => [
89-
'web-prefix' => 'web',
90+
'web-prefix' => $input->getOption('web-dir'),
9091
],
9192
'enable-patching' => true,
9293
];
@@ -263,6 +264,13 @@ function ($value) use ($self, $minimumStability) {
263264
);
264265
$input->setOption('license', $license);
265266

267+
$web_dir = $input->getOption('web-dir') ?: false;
268+
$web_dir = $io->ask(
269+
'Public web directory [<comment>'.$web_dir.'</comment>]: ',
270+
$web_dir
271+
);
272+
$input->setOption('web-dir', $web_dir);
273+
266274
$input->setOption('core', $this->getCore($input));
267275

268276
$io->writeError(['', 'Define your dependencies.', '']);

0 commit comments

Comments
 (0)