Skip to content

Commit 5d9cc76

Browse files
committed
After CR
1 parent 76ab332 commit 5d9cc76

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/bundle/Command/CompileAssetsCommand.php

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ protected function configure(): void
5252
null
5353
)
5454
->addOption(
55-
'frontend-config-name',
55+
'frontend-configs-name',
5656
'fcn',
5757
InputOption::VALUE_REQUIRED,
58-
'Frontend config name passed to webpack encore',
58+
'Frontend configs name passed to webpack encore',
5959
null
6060
)
6161
;
@@ -70,25 +70,35 @@ protected function initialize(InputInterface $input, OutputInterface $output): v
7070
}
7171
}
7272

73+
protected function getFrontendConfigPath(string $configName): string
74+
{
75+
return "./node_modules/@ibexa/frontend-config/ibexa.webpack.{$configName}.configs.js";
76+
}
77+
7378
protected function execute(InputInterface $input, OutputInterface $output): int
7479
{
7580
$timeout = (float)$input->getOption('timeout');
7681
$env = $input->getOption('env');
7782
$configName = $input->getOption('config-name');
78-
$frontendConfigName = $input->getOption('frontend-config-name');
83+
$frontendConfigsName = $input->getOption('frontend-configs-name');
7984

8085
$output->writeln(sprintf('Compiling all <comment>%s</comment> assets.', $env));
8186
$output->writeln('');
8287

8388
$encoreEnv = $env === 'prod' ? 'prod' : 'dev';
84-
$yarnEncoreCommand = "yarn encore {$encoreEnv}";
89+
$yarnBaseEncoreCommand = "yarn encore {$encoreEnv}";
90+
$yarnEncoreCommand = $yarnBaseEncoreCommand;
8591

8692
if (!empty($configName)) {
87-
$yarnEncoreCommand .= " --config-name {$configName}";
93+
$yarnEncoreCommand = "{$yarnBaseEncoreCommand} --config-name {$configName}";
8894
}
8995

90-
if (!empty($frontendConfigName)) {
91-
$yarnEncoreCommand .= " --config ./node_modules/@ibexa/frontend-config/ibexa.webpack.{$frontendConfigName}.configs";
96+
if (!empty($frontendConfigsName)) {
97+
$frontendConfigsNameArr = explode(',', $frontendConfigsName);
98+
$yarnEncoreCommand = implode(' && ', array_map(
99+
fn (string $configName) => "{$yarnBaseEncoreCommand} --config {$this->getFrontendConfigPath($configName)}",
100+
$frontendConfigsNameArr
101+
));
92102
}
93103

94104
$debugFormatter = $this->getHelper('debug_formatter');

0 commit comments

Comments
 (0)