mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 08:45:40 +08:00
Add package management
This commit is contained in:
@@ -12,6 +12,8 @@ use SPC\exception\WrongUsageException;
|
||||
*/
|
||||
class Config
|
||||
{
|
||||
public static ?array $pkg = null;
|
||||
|
||||
public static ?array $source = null;
|
||||
|
||||
public static ?array $lib = null;
|
||||
@@ -31,6 +33,19 @@ class Config
|
||||
return self::$source[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read pkg from pkg.json
|
||||
*
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public static function getPkg(string $name): ?array
|
||||
{
|
||||
if (self::$pkg === null) {
|
||||
self::$pkg = FileSystem::loadConfigArray('pkg');
|
||||
}
|
||||
return self::$pkg[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据不同的操作系统分别选择不同的 lib 库依赖项
|
||||
* 如果 key 为 null,那么直接返回整个 meta。
|
||||
|
||||
Reference in New Issue
Block a user