Skip to content
Snippets Groups Projects

Resolve #3494353 "Olivero symlink"

Merged Adam G-H requested to merge issue/drupal_cms-3494353:3494353-olivero-symlink into 1.x
Files
5
+ 33
0
#!/usr/bin/env php
<?php
// Generates the development-ready `composer.json` file by merging our
// development requirements into the project template. This script must
// be run from the repository root.
$read_json = function (string $file): array {
$data = file_get_contents($file);
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'),
);
// If in a CI environment, make all path repository URLs absolute.
if (getenv('CI')) {
array_walk($data['repositories'], function (array &$repository): void {
if ($repository['type'] === 'path') {
$repository['url'] = getcwd() . '/' . $repository['url'];
}
});
}
// Make packages.drupal.org the lowest-priority repository, which will force the
// components' local path repositories to take precedence.
$repository = $data['repositories']['drupal'];
unset($data['repositories']['drupal']);
$data['repositories']['drupal'] = $repository;
echo json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
Loading