修改报错

This commit is contained in:
liaofei 2023-04-13 17:49:15 +08:00
parent fed1e9cb08
commit 18b8fb5381
2 changed files with 13 additions and 5 deletions

View File

@ -39,7 +39,6 @@ class Npm extends Command
$this->setName('npm')
->addOption('path', 'dp', Option::VALUE_OPTIONAL, '默认路径')
->addOption('build', 'bu', Option::VALUE_OPTIONAL, '打包存放路径')
->addOption('zip', 'z', Option::VALUE_NONE, '打包成zip')
->setDescription('NPM打包工具');
}
@ -52,7 +51,6 @@ class Npm extends Command
{
$path = $this->input->getOption('path');
$build = $this->input->getOption('build');
$zip = $this->input->getOption('zip');
if (!$build) {
$build = public_path() . 'admin';
}
@ -60,14 +58,24 @@ class Npm extends Command
$terminal = new Terminal();
$terminal->setOutput($this->output);
$adminPath = $terminal->adminTemplatePath();
$adminPath = $path ?: $terminal->adminTemplatePath();
$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';
if (!is_dir($dir)) {
$terminal->run('npm-install');
}
$terminal->run('npm-build');
if (!is_dir($adminPath . DS . 'dist')) {
@ -75,7 +83,7 @@ class Npm extends Command
return;
}
FileService::copyDir($adminPath . 'dist', $build);
$this->app->make(FileService::class)->copyDir($adminPath . DS . 'dist', $build);
$this->output->info('执行成功');
}

View File

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