diff options
Diffstat (limited to 'plugins/CoreVue/Commands/Build.php')
-rw-r--r-- | plugins/CoreVue/Commands/Build.php | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/plugins/CoreVue/Commands/Build.php b/plugins/CoreVue/Commands/Build.php index 5febd8db6e..601b340de4 100644 --- a/plugins/CoreVue/Commands/Build.php +++ b/plugins/CoreVue/Commands/Build.php @@ -67,23 +67,30 @@ class Build extends ConsoleCommand private function build(OutputInterface $output, $plugins, $printBuildCommand, $watch = false) { + if ($watch) { + $this->watch($plugins, $printBuildCommand, $output); + return; + } + $failed = 0; foreach ($plugins as $plugin) { - if ($watch) { - $this->watch($plugin, $printBuildCommand, $output); - } else { - $failed += (int) $this->buildFiles($output, $plugin, $printBuildCommand); - } + $failed += (int) $this->buildFiles($output, $plugin, $printBuildCommand); } return $failed; } - private function watch($plugin, $printBuildCommand, OutputInterface $output) + private function watch($plugins, $printBuildCommand, OutputInterface $output) { - $command = "FORCE_COLOR=1 " . self::getVueCliServiceBin() . ' build --mode=development --target lib --name ' - . $plugin . " ./plugins/$plugin/vue/src/index.ts --dest ./plugins/$plugin/vue/dist --watch &"; + $commandSingle = "FORCE_COLOR=1 MATOMO_CURRENT_PLUGIN=%1\$s " . self::getVueCliServiceBin() . ' build --mode=development --target lib --name ' + . "%1\$s ./plugins/%1\$s/vue/src/index.ts --dest ./plugins/%1\$s/vue/dist --watch &"; + + $command = ''; + foreach ($plugins as $plugin) { + $command .= sprintf($commandSingle, $plugin) . ' '; + } + if ($printBuildCommand) { $output->writeln("<comment>$command</comment>"); return; @@ -93,7 +100,7 @@ class Build extends ConsoleCommand private function buildFiles(OutputInterface $output, $plugin, $printBuildCommand) { - $command = "FORCE_COLOR=1 " . self::getVueCliServiceBin() . ' build --target lib --name ' . $plugin + $command = "FORCE_COLOR=1 MATOMO_CURRENT_PLUGIN=$plugin " . self::getVueCliServiceBin() . ' build --target lib --name ' . $plugin . " ./plugins/$plugin/vue/src/index.ts --dest ./plugins/$plugin/vue/dist"; if ($printBuildCommand) { |