diff --git a/src/bundle/Command/CompileAssetsCommand.php b/src/bundle/Command/CompileAssetsCommand.php index 86a8618da7..8c1f358bf9 100644 --- a/src/bundle/Command/CompileAssetsCommand.php +++ b/src/bundle/Command/CompileAssetsCommand.php @@ -51,6 +51,13 @@ protected function configure(): void 'Config name passed to webpack encore', null ) + ->addOption( + 'frontend-configs-name', + 'fcn', + InputOption::VALUE_REQUIRED, + 'Frontend configs name passed to webpack encore', + null + ) ; } @@ -63,20 +70,35 @@ protected function initialize(InputInterface $input, OutputInterface $output): v } } + protected function getFrontendConfigPath(string $configName): string + { + return "./node_modules/@ibexa/frontend-config/ibexa.webpack.{$configName}.configs.js"; + } + protected function execute(InputInterface $input, OutputInterface $output): int { $timeout = (float)$input->getOption('timeout'); $env = $input->getOption('env'); $configName = $input->getOption('config-name'); + $frontendConfigsName = $input->getOption('frontend-configs-name'); $output->writeln(sprintf('Compiling all %s assets.', $env)); $output->writeln(''); $encoreEnv = $env === 'prod' ? 'prod' : 'dev'; - $yarnEncoreCommand = "yarn encore {$encoreEnv}"; + $yarnBaseEncoreCommand = "yarn encore {$encoreEnv}"; + $yarnEncoreCommand = $yarnBaseEncoreCommand; if (!empty($configName)) { - $yarnEncoreCommand .= " --config-name {$configName}"; + $yarnEncoreCommand = "{$yarnBaseEncoreCommand} --config-name {$configName}"; + } + + if (!empty($frontendConfigsName)) { + $frontendConfigsNameArr = explode(',', $frontendConfigsName); + $yarnEncoreCommand = implode(' && ', array_map( + fn (string $configName) => "{$yarnBaseEncoreCommand} --config {$this->getFrontendConfigPath($configName)}", + $frontendConfigsNameArr + )); } $debugFormatter = $this->getHelper('debug_formatter'); diff --git a/src/bundle/DependencyInjection/IbexaAdminUiExtension.php b/src/bundle/DependencyInjection/IbexaAdminUiExtension.php index fc03950cd7..6c19e76863 100644 --- a/src/bundle/DependencyInjection/IbexaAdminUiExtension.php +++ b/src/bundle/DependencyInjection/IbexaAdminUiExtension.php @@ -28,6 +28,15 @@ class IbexaAdminUiExtension extends Extension implements PrependExtensionInterfa 'ibexa.webpack.custom.config.js' => [ 'ibexa.webpack.custom.config.js' => [], ], + 'ibexa.webpack.internal.config.js' => [ + 'ibexa.webpack.internal.config.js' => [], + ], + 'ibexa.webpack.richtext.config.js' => [ + 'ibexa.webpack.richtext.config.js' => [], + ], + 'ibexa.webpack.libs.config.js' => [ + 'ibexa.webpack.libs.config.js' => [], + ], 'ibexa.config.setup.js' => [ 'ibexa.config.setup.js' => [], ], diff --git a/src/bundle/Resources/encore/ibexa.webpack.custom.config.js b/src/bundle/Resources/encore/ibexa.webpack.libs.config.js similarity index 100% rename from src/bundle/Resources/encore/ibexa.webpack.custom.config.js rename to src/bundle/Resources/encore/ibexa.webpack.libs.config.js