- Done fixing Container build caching and WIP on Picea's asset
This commit is contained in:
1 parent
4dcc7f407e
commit
4c0cddd617
10 files changed
+208
-79
No files matched your search
+64
-14
@@ -73,19 +73,6 @@ class Lean
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function getPiceaAssets() : array
|
||||
{
|
||||
$list = [];
|
||||
|
||||
foreach(array_reverse($this->applications) as $apps) {
|
||||
if ( $apps->piceaAssets ?? null ) {
|
||||
$list = array_merge_recursive($list, $apps->piceaAssets);
|
||||
}
|
||||
}
|
||||
# dump($list);
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function getRoutable() : array
|
||||
{
|
||||
return array_merge(...array_map(fn($app) => $app->routes ?? [], $this->applications));
|
||||
@@ -120,6 +107,15 @@ class Lean
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function getAssetPaths() : array
|
||||
{
|
||||
$list = array_merge(...array_map(fn($app) => $app->piceaAssets['source'] ?? [], $this->applications));
|
||||
|
||||
uasort($list, fn($i1, $i2) => $i1['order'] <=> $i2['order'] );
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function getI18n(string $reader) : ? array
|
||||
{
|
||||
switch($reader) {
|
||||
@@ -145,7 +141,7 @@ class Lean
|
||||
{
|
||||
$path = dirname(__DIR__) . "/meta/definitions/";
|
||||
|
||||
return array_merge(
|
||||
return array_replace(
|
||||
class_exists(\Mcnd\CLI\CliMiddleware::class) ? require($path . "cli.php") : [],
|
||||
class_exists(\Cronard\CronardMiddleware::class) ? require($path . "cronard.php") : [],
|
||||
require($path . "email.php"),
|
||||
@@ -159,4 +155,58 @@ class Lean
|
||||
class_exists(\Picea\Picea::class) ? require($path . "template.php") : [],
|
||||
);
|
||||
}
|
||||
|
||||
public static function autoloadDefinitionsFromComposerExtra() : array
|
||||
{
|
||||
$list = [];
|
||||
|
||||
foreach(Composer::readComposerLock()['packages'] as $package) {
|
||||
foreach($package['extra']['lean']['autoload']['definitions'] ?? [] as $autoload) {
|
||||
if (is_string($autoload)) {
|
||||
$vendor = getenv('VENDOR_PATH') ? getenv('VENDOR_PATH') : dirname(__DIR__, 3);
|
||||
$file = $vendor . DIRECTORY_SEPARATOR . $package['name'] . DIRECTORY_SEPARATOR . $autoload;
|
||||
|
||||
if ( ! file_exists($file) ) {
|
||||
throw new \InvalidArgumentException(sprintf("Given autoload file `%s` from package `%s` was not found or is unreachable", $autoload, $package['name']));
|
||||
}
|
||||
|
||||
$list = array_replace($list, require($file));
|
||||
}
|
||||
else {
|
||||
$func = implode('::', array_merge([ key($autoload) ], $autoload));
|
||||
|
||||
$list = array_replace($list, call_user_func($func));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
public static function autoloadConfigFromComposerExtra() : array
|
||||
{
|
||||
$list = [];
|
||||
|
||||
foreach(Composer::readComposerLock()['packages'] as $package) {
|
||||
foreach($package['extra']['lean']['autoload']['config'] ?? [] as $autoload) {
|
||||
if (is_string($autoload)) {
|
||||
$vendor = getenv('VENDOR_PATH') ? getenv('VENDOR_PATH') : dirname(__DIR__, 3);
|
||||
$file = $vendor . DIRECTORY_SEPARATOR . $package['name'] . DIRECTORY_SEPARATOR . $autoload;
|
||||
|
||||
if ( ! file_exists($file) ) {
|
||||
throw new \InvalidArgumentException(sprintf("Given autoload file `%s` from package `%s` was not found or is unreachable", $autoload, $package['name']));
|
||||
}
|
||||
|
||||
$list = array_merge_recursive($list, require($file));
|
||||
}
|
||||
else {
|
||||
$func = implode('::', array_merge([ key($autoload) ], $autoload));
|
||||
|
||||
$list = array_merge_recursive($list, call_user_func($func));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user