From 63ff351d02d716d1a9c26c3157a839f9d9393486 Mon Sep 17 00:00:00 2001 From: augushong Date: Fri, 18 Nov 2022 16:09:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BC=96=E8=AF=91=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/command/build/Dist.php | 35 ++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/app/common/command/build/Dist.php b/app/common/command/build/Dist.php index 4147af1..105c51c 100644 --- a/app/common/command/build/Dist.php +++ b/app/common/command/build/Dist.php @@ -51,6 +51,16 @@ class Dist extends Command public $constDirList = []; + /** + * @var FileSystem + */ + protected $appFilesystem; + + /** + * @var FileSystem + */ + protected $distFilesystem; + protected function configure() { // 指令配置 @@ -76,10 +86,14 @@ class Dist extends Command $app_filesystem = new Filesystem($app_adapter); + $this->appFilesystem = $app_filesystem; + $dist_adapter = new Local($dist_path); $dist_filesystem = new Filesystem($dist_adapter); + $this->distFilesystem = $dist_filesystem; + $list_dist = $dist_filesystem->listContents(); foreach ($list_dist as $file_info) { @@ -158,7 +172,7 @@ class Dist extends Command new Arg(new String_($const_key)), new Arg(new Concat( new Dir(), - new String_('/../'.$const_value) + new String_('/../' . $const_value) )), ] )); @@ -175,9 +189,28 @@ class Dist extends Command $lib_php_file, ]); + $this->buildAllAppDir(); + $output->info('打包完成'); } + public function buildAllAppDir() + { + $list = $this->appFilesystem->listContents(''); + + foreach ($list as $item) { + if ($item['type'] != 'dir') { + continue; + } + + if ($this->distFilesystem->has($item['path'])) { + continue; + } + + $this->distFilesystem->createDir($item['path']); + } + } + public function buildIncludeIndexFile($files) { $file_stmts = [];