Skip to content

Commit

Permalink
Bugfix: wrong target, missing css files
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel committed Dec 8, 2024
1 parent 70d8eb2 commit 43369eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/OpenMage/Composer/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 8 additions & 4 deletions src/OpenMage/Composer/Plugin/TinyMce.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ 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');

$version = $this->getInstalledVersion(self::TINYMCE_MODULE);
$mainVersion = $version[0] ?? null;

$copySource = $vendorDir . '/' . $moduleName;
$copyTarget = $rootDir . '/' . $copyTarget;
$copyTarget = $rootDir . '/' . $magentoRootDir . $copyTarget;

if ($moduleName === self::TINYMCE_MODULE) {
switch ((int) $mainVersion) {
Expand All @@ -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);
}
}
}
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 43369eb

Please sign in to comment.