mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-03 23:05:41 +08:00
Add php and lib-base as special libraries to add dependencies to the root node (#618)
* Remove E_STRICT * Add lib-base and php as special libs * Remove debug code * Fix phpunit with new config structure * Fix phpunit test and fix license dumper bug for new type of lib * Add missing lib type filter for windows builder
This commit is contained in:
@@ -33,7 +33,17 @@ class SortConfigCommand extends BaseCommand
|
||||
case 'lib':
|
||||
$file = json_decode(FileSystem::readFile(ROOT_DIR . '/config/lib.json'), true);
|
||||
ConfigValidator::validateLibs($file);
|
||||
ksort($file);
|
||||
uksort($file, function ($a, $b) use ($file) {
|
||||
$type_a = $file[$a]['type'] ?? 'lib';
|
||||
$type_b = $file[$b]['type'] ?? 'lib';
|
||||
$type_order = ['root', 'target', 'package', 'lib'];
|
||||
// compare type first
|
||||
if ($type_a !== $type_b) {
|
||||
return array_search($type_a, $type_order) <=> array_search($type_b, $type_order);
|
||||
}
|
||||
// compare name
|
||||
return $a <=> $b;
|
||||
});
|
||||
if (!file_put_contents(ROOT_DIR . '/config/lib.json', json_encode($file, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "\n")) {
|
||||
$this->output->writeln('<error>Write file lib.json failed!</error>');
|
||||
return static::FAILURE;
|
||||
|
||||
Reference in New Issue
Block a user