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:
Daniël Klabbers 2022-04-30 21:00:27 +02:00 committed by GitHub
parent b14c0780d2
commit 2e89ba3c94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 207 additions and 5 deletions

182
composer.json Normal file
View File

@ -0,0 +1,182 @@
{
"name": "flarum/framework",
"description": "Delightfully simple forum software.",
"keywords": [
"forum",
"discussion"
],
"homepage": "https://flarum.org/",
"license": "MIT",
"authors": [
{
"name": "Flarum",
"email": "info@flarum.org",
"homepage": "https://flarum.org/team"
}
],
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/flarum"
},
{
"type": "github",
"url": "https://github.com/sponsors/flarum"
},
{
"type": "other",
"url": "https://flarum.org/donate"
}
],
"support": {
"issues": "https://github.com/flarum/core/issues",
"source": "https://github.com/flarum/core",
"docs": "https://docs.flarum.org",
"forum": "https://discuss.flarum.org",
"chat": "https://flarum.org/chat"
},
"autoload": {
"psr-4": {
"Flarum\\": "framework/core/src",
"Flarum\\Akismet\\": "extensions/akismet/src",
"Flarum\\Approval\\": "extensions/approval/src",
"Flarum\\Flags\\": "extensions/flags/src",
"Flarum\\Likes\\": "extensions/likes/src",
"Flarum\\Lock\\": "extensions/lock/src",
"Flarum\\Mentions\\": "extensions/mentions/src",
"Flarum\\Nicknames\\": "extensions/nicknames/src",
"Flarum\\PackageManager\\": "extensions/package-manager/src",
"Flarum\\Pusher\\": "extensions/pusher/src",
"Flarum\\Statistics\\": "extensions/statistics/src",
"Flarum\\Sticky\\": "extensions/sticky/src",
"Flarum\\Subscriptions\\": "extensions/subscriptions/src",
"Flarum\\Suspend\\": "extensions/suspend/src",
"Flarum\\Tags\\": "extensions/tags/src",
"Flarum\\PHPStan\\": "php-packages/phpstan/src",
"Flarum\\Testing\\": "php-packages/testing/src"
},
"files": [
"framework/core/src/helpers.php"
]
},
"replace": {
"flarum/core": "self.version",
"flarum/akismet": "self.version",
"flarum/approval": "self.version",
"flarum/bbcode": "self.version",
"flarum/embed": "self.version",
"flarum/emoji": "self.version",
"flarum/flags": "self.version",
"flarum/lang-english": "self.version",
"flarum/likes": "self.version",
"flarum/lock": "self.version",
"flarum/markdown": "self.version",
"flarum/mentions": "self.version",
"flarum/nicknames": "self.version",
"flarum/package-manager": "self.version",
"flarum/pusher": "self.version",
"flarum/statistics": "self.version",
"flarum/sticky": "self.version",
"flarum/subscriptions": "self.version",
"flarum/suspend": "self.version",
"flarum/tags": "self.version",
"flarum/phpstan": "self.version",
"flarum/testing": "self.version"
},
"require": {
"ext-json": "*",
"php": ">=7.3",
"axy/sourcemap": "^0.1.4",
"components/font-awesome": "^5.14.0",
"composer/composer": "^2.0",
"dflydev/fig-cookies": "^3.0.0",
"doctrine/dbal": "^2.7",
"dragonmantank/cron-expression": "^3.1.0",
"franzl/whoops-middleware": "^2.0.0",
"guzzlehttp/guzzle": "^7.4",
"illuminate/bus": "^8.0",
"illuminate/cache": "^8.0",
"illuminate/config": "^8.0",
"illuminate/console": "^8.0",
"illuminate/container": "^8.0",
"illuminate/contracts": "^8.0",
"illuminate/database": "^8.0",
"illuminate/events": "^8.0",
"illuminate/filesystem": "^8.0",
"illuminate/hashing": "^8.0",
"illuminate/mail": "^8.0",
"illuminate/queue": "^8.0",
"illuminate/session": "^8.0",
"illuminate/support": "^8.0",
"illuminate/validation": "^8.0",
"illuminate/view": "^8.0",
"intervention/image": "2.5.* || ^2.6.1",
"laminas/laminas-diactoros": "^2.4.1",
"laminas/laminas-httphandlerrunner": "^1.2.0",
"laminas/laminas-stratigility": "^3.2.2",
"league/flysystem": "^1.0.11",
"matthiasmullie/minify": "^1.3",
"middlewares/base-path": "^2.0.1",
"middlewares/base-path-router": "^2.0.1",
"middlewares/request-handler": "^2.0.1",
"monolog/monolog": "^1.16.0",
"nesbot/carbon": "^2.0",
"nikic/fast-route": "^0.6",
"psr/http-message": "^1.0",
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
"pusher/pusher-php-server": "^2.2",
"s9e/text-formatter": "^2.3.6",
"symfony/config": "^5.2.2",
"symfony/console": "^5.2.2",
"symfony/event-dispatcher": "^5.2.2",
"symfony/mime": "^5.2.0",
"symfony/polyfill-intl-messageformatter": "^1.22.0",
"symfony/translation": "^5.1.5",
"symfony/yaml": "^5.2.2",
"tobscure/json-api": "^0.3.0",
"wikimedia/less.php": "^3.0"
},
"require-dev": {
"mockery/mockery": "^1.4",
"phpunit/phpunit": "^9.0",
"phpstan/phpstan-php-parser": "^1.0",
"phpstan/phpstan": "^1.2"
},
"config": {
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"flarum-subextensions": [
"extensions/akismet",
"extensions/approval",
"extensions/bbcode",
"extensions/embed",
"extensions/emoji",
"extensions/flags",
"extensions/lang-english",
"extensions/likes",
"extensions/lock",
"extensions/markdown",
"extensions/mentions",
"extensions/nicknames",
"extensions/package-manager",
"extensions/pusher",
"extensions/statistics",
"extensions/sticky",
"extensions/subscriptions",
"extensions/suspend",
"extensions/tags"
],
"branch-alias": {
"dev-main": "1.x-dev"
},
"phpstan": {
"includes": [
"extension.neon"
]
}
}
}

View File

@ -89,16 +89,36 @@ class ExtensionManager
// Using keys of an associative array allows us to do these checks in constant time. // Using keys of an associative array allows us to do these checks in constant time.
$installedSet = []; $installedSet = [];
$composerJsonConfs = [];
foreach ($installed as $package) { 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; continue;
} }
$installedSet[Arr::get($package, 'name')] = true; $packagePath = isset($package['install-path'])
$path = isset($package['install-path'])
? $this->paths->vendor.'/composer/'.$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. // Instantiates an Extension object using the package path and composer.json file.
$extension = new Extension($path, $package); $extension = new Extension($path, $package);