Przeglądaj źródła

Merge branch 'v5.0.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.0.0dev

From-wh 2 lat temu
rodzic
commit
efca509152

+ 12 - 4
crmeb/crmeb/command/Npm.php

@@ -39,7 +39,6 @@ class Npm extends Command
         $this->setName('npm')
         $this->setName('npm')
             ->addOption('path', 'dp', Option::VALUE_OPTIONAL, '默认路径')
             ->addOption('path', 'dp', Option::VALUE_OPTIONAL, '默认路径')
             ->addOption('build', 'bu', Option::VALUE_OPTIONAL, '打包存放路径')
             ->addOption('build', 'bu', Option::VALUE_OPTIONAL, '打包存放路径')
-            ->addOption('zip', 'z', Option::VALUE_NONE, '打包成zip')
             ->setDescription('NPM打包工具');
             ->setDescription('NPM打包工具');
     }
     }
 
 
@@ -52,7 +51,6 @@ class Npm extends Command
     {
     {
         $path = $this->input->getOption('path');
         $path = $this->input->getOption('path');
         $build = $this->input->getOption('build');
         $build = $this->input->getOption('build');
-        $zip = $this->input->getOption('zip');
         if (!$build) {
         if (!$build) {
             $build = public_path() . 'admin';
             $build = public_path() . 'admin';
         }
         }
@@ -60,14 +58,24 @@ class Npm extends Command
         $terminal = new Terminal();
         $terminal = new Terminal();
         $terminal->setOutput($this->output);
         $terminal->setOutput($this->output);
 
 
-        $adminPath = $terminal->adminTemplatePath();
+        $adminPath = $path ?: $terminal->adminTemplatePath();
 
 
         $adminPath = dirname($adminPath);
         $adminPath = dirname($adminPath);
+
+        if (is_dir($adminPath . DS . 'dist')) {
+            $question = $this->output->confirm($this->input, '检测到已经生成打包文件是否重新打包?', false);
+            if (!$question) {
+                $this->output->info('已退出打包程序');
+                return;
+            }
+        }
+
         $dir = $adminPath . DS . 'node_modules';
         $dir = $adminPath . DS . 'node_modules';
         if (!is_dir($dir)) {
         if (!is_dir($dir)) {
             $terminal->run('npm-install');
             $terminal->run('npm-install');
         }
         }
 
 
+
         $terminal->run('npm-build');
         $terminal->run('npm-build');
 
 
         if (!is_dir($adminPath . DS . 'dist')) {
         if (!is_dir($adminPath . DS . 'dist')) {
@@ -75,7 +83,7 @@ class Npm extends Command
             return;
             return;
         }
         }
 
 
-        FileService::copyDir($adminPath . 'dist', $build);
+        $this->app->make(FileService::class)->copyDir($adminPath . DS . 'dist', $build);
 
 
         $this->output->info('执行成功');
         $this->output->info('执行成功');
     }
     }

+ 1 - 1
crmeb/crmeb/services/crud/ViewApi.php

@@ -134,7 +134,7 @@ class ViewApi extends Make
             'create' => $servicePath . 'crudUpdateApi.stub',
             'create' => $servicePath . 'crudUpdateApi.stub',
             'save' => $servicePath . 'crudSaveApi.stub',
             'save' => $servicePath . 'crudSaveApi.stub',
             'edit' => $servicePath . 'getCrudEditApi.stub',
             'edit' => $servicePath . 'getCrudEditApi.stub',
-            'update' => $servicePath . 'CrudUpdateApi.stub',
+            'update' => $servicePath . 'crudUpdateApi.stub',
             'api' => $servicePath . 'crud.stub',
             'api' => $servicePath . 'crud.stub',
         ];
         ];