mirror of
https://github.com/flarum/core.git
synced 2025-07-23 09:41:26 +02:00
chore: Allow installing monorepo through composer for dev purposes
This is as close as we're gonna get to a good solution for now.
This commit is contained in:
@@ -89,16 +89,36 @@ class ExtensionManager
|
||||
// Using keys of an associative array allows us to do these checks in constant time.
|
||||
$installedSet = [];
|
||||
|
||||
$composerJsonConfs = [];
|
||||
|
||||
foreach ($installed as $package) {
|
||||
if (Arr::get($package, 'type') != 'flarum-extension' || empty(Arr::get($package, 'name'))) {
|
||||
$name = Arr::get($package, 'name');
|
||||
if (empty($name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$installedSet[Arr::get($package, 'name')] = true;
|
||||
|
||||
$path = isset($package['install-path'])
|
||||
$packagePath = isset($package['install-path'])
|
||||
? $this->paths->vendor.'/composer/'.$package['install-path']
|
||||
: $this->paths->vendor.'/'.Arr::get($package, 'name');
|
||||
: $this->paths->vendor.'/'.$name;
|
||||
|
||||
if (Arr::get($package, 'type') === 'flarum-extension') {
|
||||
$composerJsonConfs[$packagePath] = $package;
|
||||
}
|
||||
|
||||
if ($subextPaths = Arr::get($package, 'extra.flarum-subextensions', [])) {
|
||||
foreach ($subextPaths as $subExtPath) {
|
||||
$subPackagePath = "$packagePath/$subExtPath";
|
||||
$conf = json_decode($this->filesystem->get("$subPackagePath/composer.json"), true);
|
||||
|
||||
if (Arr::get($conf, 'type') === 'flarum-extension') {
|
||||
$composerJsonConfs[$subPackagePath] = $conf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($composerJsonConfs as $path => $package) {
|
||||
$installedSet[Arr::get($package, 'name')] = true;
|
||||
|
||||
// Instantiates an Extension object using the package path and composer.json file.
|
||||
$extension = new Extension($path, $package);
|
||||
|
Reference in New Issue
Block a user