This repository has been archived by the owner on Nov 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbe2d54
commit 8957b30
Showing
7 changed files
with
75 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace Acquia\Lightning\Composer; | ||
|
||
use Composer\Json\JsonFile; | ||
use Composer\Script\Event; | ||
|
||
/** | ||
* Configures an instance of drupal/legacy-project to install Lightning. | ||
*/ | ||
final class ConfigureLegacyProject { | ||
|
||
/** | ||
* Executes the script. | ||
* | ||
* @param \Composer\Script\Event $event | ||
* The script event. | ||
*/ | ||
public static function execute(Event $event) { | ||
$arguments = $event->getArguments(); | ||
|
||
$target = new JsonFile($arguments[0] . '/composer.json'); | ||
$project = $target->read(); | ||
|
||
$required = $event->getComposer()->getPackage()->getRequires(); | ||
$components = [ | ||
'api', | ||
'core', | ||
'media', | ||
'layout', | ||
'workflow', | ||
]; | ||
foreach ($components as $component) { | ||
$project['require']["drupal/lightning_$component"] = $required["drupal/lightning_$component"]->getPrettyConstraint(); | ||
} | ||
$project['repositories'][] = [ | ||
'type' => 'composer', | ||
'url' => 'https://asset-packagist.org', | ||
]; | ||
$project['extra']['installer-paths']['libraries/{$name}'] = [ | ||
'type:drupal-library', | ||
'type:bower-asset', | ||
'type:npm-asset', | ||
]; | ||
$project['extra']['installer-types'] = ['bower-asset', 'npm-asset']; | ||
$project['extra']['patchLevel']['drupal/core'] = '-p2'; | ||
|
||
$target->write($project); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.