Skip to content

Commit

Permalink
[Common] Fix Issue with .editorconfig Publication When Running in PHP…
Browse files Browse the repository at this point in the history
…Genesis Monorepo
  • Loading branch information
onairmarc committed May 20, 2024
1 parent 37612f5 commit c14e560
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/Common/src/Composer/Scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ class Scripts
public static function postAutoloadDump(Event $event): void
{
require_once $event->getComposer()->getConfig()->get('vendor-dir') . '/autoload.php';
$packageName = $event->getComposer()->getPackage()->getName();

IdeHelper::updateEditorConfig();
$isPhpGenesis = false;

if ($packageName = 'phpgenesis/phpgenesis') {
$isPhpGenesis = true;
echo 'Package is PHPGenesis Monorepo. Modifying IdeHelper::updateEditorConfig() behavior' . PHP_EOL;
}

IdeHelper::updateEditorConfig($isPhpGenesis);
}
}
9 changes: 7 additions & 2 deletions src/Common/src/Helpers/IdeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@

class IdeHelper
{
public static function updateEditorConfig(): void
public static function updateEditorConfig(bool $isPhpGenesis): void
{
file_copy(phpgenesis_common_src('Resources/.editorconfig'), phpgenesis_vendor_dir('../.editorconfig'));
if ($isPhpGenesis) {
file_copy(phpgenesis_common_src('Resources/.editorconfig'), phpgenesis_common_src('../../../.editorconfig'));
} else {
file_copy(phpgenesis_common_src('Resources/.editorconfig'), phpgenesis_vendor_dir('../.editorconfig'));
}

}
}

0 comments on commit c14e560

Please sign in to comment.