mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 08:15:39 +08:00
Refactor lock component to a single class (#773)
This commit is contained in:
@@ -33,10 +33,11 @@ class PackageManager
|
||||
// Download package
|
||||
Downloader::downloadPackage($pkg_name, $config, $force);
|
||||
// After download, read lock file name
|
||||
$lock = json_decode(FileSystem::readFile(DOWNLOAD_PATH . '/.lock.json'), true);
|
||||
$source_type = $lock[$pkg_name]['source_type'];
|
||||
$filename = DOWNLOAD_PATH . '/' . ($lock[$pkg_name]['filename'] ?? $lock[$pkg_name]['dirname']);
|
||||
$extract = $lock[$pkg_name]['move_path'] === null ? (PKG_ROOT_PATH . '/' . $pkg_name) : $lock[$pkg_name]['move_path'];
|
||||
$lock = LockFile::get($pkg_name);
|
||||
$source_type = $lock['source_type'];
|
||||
$filename = LockFile::getLockFullPath($lock);
|
||||
$extract = LockFile::getExtractPath($pkg_name, PKG_ROOT_PATH . '/' . $pkg_name);
|
||||
|
||||
FileSystem::extractPackage($pkg_name, $source_type, $filename, $extract);
|
||||
|
||||
// if contains extract-files, we just move this file to destination, and remove extract dir
|
||||
|
||||
Reference in New Issue
Block a user