From 3086bcdf6d11f1deda7ff55e89c5d5641c29530d Mon Sep 17 00:00:00 2001 From: sunxyw Date: Sun, 1 Jan 2023 00:18:27 +0800 Subject: [PATCH] simplify file filtering --- src/ZM/Command/BuildCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ZM/Command/BuildCommand.php b/src/ZM/Command/BuildCommand.php index fa5456a5..4483f381 100644 --- a/src/ZM/Command/BuildCommand.php +++ b/src/ZM/Command/BuildCommand.php @@ -85,13 +85,13 @@ class BuildCommand extends Command private function build(string $target, string $entry): void { - $phar = new \Phar($target, 0, $target); + $phar = new \Phar($target, 0); $phar->startBuffering(); $files = FileSystem::scanDirFiles(SOURCE_ROOT_DIR, true, true); - // 只打包 bin / config / resources / src / vendor + // 只打包 bin / config / resources / src / vendor 目录以及 composer.json / composer.lock / entry.php $files = array_filter($files, function ($file) { - return preg_match('#^(bin|config|resources|src|vendor)/#', $file); + return preg_match('/(^(bin|config|resources|src|vendor)\\/|^(composer\\.json|README\\.md)$)/', $file); }); sort($files);