diff --git a/src/OpenMage/Composer/Plugin.php b/src/OpenMage/Composer/Plugin.php index cdb9cb3..0e0e789 100644 --- a/src/OpenMage/Composer/Plugin.php +++ b/src/OpenMage/Composer/Plugin.php @@ -53,8 +53,10 @@ public function processTinyMce(Event $event): void $composer = $event->getComposer(); $extra = $composer->getPackage()->getExtra(); - $magentoRootDir = array_key_exists(self::EXTRA_MAGENTO_ROOT_DIR, $extra) ? $extra[self::EXTRA_MAGENTO_ROOT_DIR] : '.'; - $magentoRootDir .= '/'; + $magentoRootDir = ''; + if (array_key_exists(self::EXTRA_MAGENTO_ROOT_DIR, $extra) && $extra[self::EXTRA_MAGENTO_ROOT_DIR] !== '.') { + $magentoRootDir = $extra[self::EXTRA_MAGENTO_ROOT_DIR] . '/'; + } $plugin = new Plugin\TinyMce(); $plugin->process($event, $magentoRootDir); diff --git a/src/OpenMage/Composer/Plugin/TinyMce.php b/src/OpenMage/Composer/Plugin/TinyMce.php index 098290b..4dae884 100644 --- a/src/OpenMage/Composer/Plugin/TinyMce.php +++ b/src/OpenMage/Composer/Plugin/TinyMce.php @@ -63,7 +63,7 @@ public function process(Event $event, string $magentoRootDir): void foreach (self::$modules as $moduleName => $copyTarget) { $tinyMceModule = $this->getTinyMceModule($event, $io, $moduleName); if ($tinyMceModule) { - $rootDir = getcwd(); + $rootDir = getcwd(); /** @var string $vendorDir */ $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); @@ -71,7 +71,7 @@ public function process(Event $event, string $magentoRootDir): void $mainVersion = $version[0] ?? null; $copySource = $vendorDir . '/' . $moduleName; - $copyTarget = $rootDir . '/' . $copyTarget; + $copyTarget = $rootDir . '/' . $magentoRootDir . $copyTarget; if ($moduleName === self::TINYMCE_MODULE) { switch ((int) $mainVersion) { @@ -93,7 +93,7 @@ public function process(Event $event, string $magentoRootDir): void $copySource = $copySource . '/langs' . $mainVersion; } - $this->copy($io, $copySource, $magentoRootDir . $copyTarget); + $this->copy($io, $copySource, $copyTarget); } } } @@ -133,7 +133,11 @@ private function copy(IOInterface $io, string $source, string $target): void { $filesystem = new Filesystem(); $finder = new Finder(); - $finder->in($source)->name('*.js'); + $finder + ->files() + ->in($source) + ->name('*.css') + ->name('*.js'); foreach ($finder as $file) { $copySource = $file->getPathname(); $copytarget = $target . '/' . $file->getRelativePathname();