diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2022-03-24 18:29:45 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-24 18:29:45 +0300 |
commit | 1c5769b5770397f85a3e3f644f295f47ebc9b6aa (patch) | |
tree | 45af7dd011280b8b221931f098c234b8076273b5 /plugins/CoreVue | |
parent | 1713349b9ef31cad5a27f74304220958dea790c2 (diff) |
Build plugin module dependencies if type output does not exist locally, otherwise build will fail. (#18994)
Diffstat (limited to 'plugins/CoreVue')
-rw-r--r-- | plugins/CoreVue/Commands/Build.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/plugins/CoreVue/Commands/Build.php b/plugins/CoreVue/Commands/Build.php index a021f0de69..5242c97d8b 100644 --- a/plugins/CoreVue/Commands/Build.php +++ b/plugins/CoreVue/Commands/Build.php @@ -62,6 +62,7 @@ class Build extends ConsoleCommand } } + $plugins = $this->ensureUntranspiledPluginDependenciesArePresent($plugins); $plugins = PluginUmdAssetFetcher::orderPluginsByPluginDependencies($plugins); // remove webpack cache since it can result in strange builds if present @@ -71,6 +72,26 @@ class Build extends ConsoleCommand return $failed; } + private function ensureUntranspiledPluginDependenciesArePresent($plugins) + { + $pluginDependenciesToAdd = []; + foreach ($plugins as $plugin) { + $dependencies = PluginUmdAssetFetcher::getPluginDependencies($plugin); + foreach ($dependencies as $dependency) { + if (!$this->isTypeOutputPresent($dependency)) { + $pluginDependenciesToAdd[] = $dependency; + } + } + } + return array_unique(array_merge($plugins, $pluginDependenciesToAdd)); + } + + private function isTypeOutputPresent($dependency) + { + $typeDirectory = PIWIK_INCLUDE_PATH . '/@types/' . $dependency . '/index.d.ts'; + return is_file($typeDirectory); + } + private function build(OutputInterface $output, $plugins, $printBuildCommand, $watch = false) { if ($watch) { |