Skip to content
Snippets Groups Projects

Issue #3497781: Add an XB recipe that is part of the project template

Merged Issue #3497781: Add an XB recipe that is part of the project template
2 unresolved threads
Merged Adam G-H requested to merge issue/drupal_cms-3497781:xb-recipe into 1.x
2 unresolved threads
Files
10
@@ -10,10 +10,27 @@ $read_json = function (string $file): array {
return json_decode($data, TRUE, flags: JSON_THROW_ON_ERROR);
};
$data = array_merge_recursive(
$read_json('project_template/composer.json'),
$read_json('dev.composer.json'),
);
// From \Drupal\Component\Utility\NestedArray::mergeDeep().
$merge_deep = function (array ...$arrays) use (&$merge_deep): array {
$result = [];
foreach ($arrays as $array) {
foreach ($array as $key => $value) {
// Recurse when both values are arrays.
if (isset($result[$key]) && is_array($result[$key]) && is_array($value)) {
$result[$key] = $merge_deep($result[$key], $value);
}
// Otherwise, use the latter value, overriding any previous value.
else {
$result[$key] = $value;
}
}
}
return $result;
};
$base = $read_json('project_template/composer.json');
$dev = $read_json('dev.composer.json');
$data = $merge_deep($base, $dev);
// If in a CI environment, make all path repository URLs absolute.
if (getenv('CI') || getenv('TUGBOAT_PREVIEW')) {
Loading