Skip to content

Commit

Permalink
Tweak to pre-install script
Browse files Browse the repository at this point in the history
  • Loading branch information
bd-viget committed Jan 15, 2025
1 parent ea3c96f commit ecbd142
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bin/composer-scripts/ProjectEvents/PreScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class PreScripts extends ComposerScript {
* @var array
*/
private static array $repoPlugins = [
'viget-blocks-toolkit',
'viget-form-blocks',
'viget-parts-kit',
'viget/viget-blocks-toolkit' => 'viget-blocks-toolkit',
'viget/viget-form-blocks' => 'viget-form-blocks',
'viget/viget-parts-kit' => 'viget-parts-kit',
];

/**
Expand Down Expand Up @@ -66,16 +66,16 @@ public static function preUpdate( Event $event ): void {
* @return void
*/
private static function checkRepoPlugins(): void {
foreach ( self::$repoPlugins as $pluginName ) {
$pluginGitDir = self::translatePath( 'wp-content/plugins/' . $pluginName . '/.git' );
foreach ( self::$repoPlugins as $packageName => $pluginDir ) {
$pluginGitDir = self::translatePath( 'wp-content/plugins/' . $pluginDir . '/.git' );
if ( is_dir( $pluginGitDir ) ) {
self::writeInfo( sprintf( 'Skipping installation of %s: directory containing repository exists.', $pluginName ) );
self::writeInfo( sprintf( 'Skipping installation of %s: directory containing repository exists.', $packageName ) );

// Ensure the package is marked as "installed".
self::$event->getComposer()->getPackage()->setReplaces( array_merge(
self::$event->getComposer()->getPackage()->getReplaces(),
[
$pluginName => '*',
$packageName => '*',
]
) );
}
Expand Down

0 comments on commit ecbd142

Please sign in to comment.