|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | +/** |
| 5 | + * This file is part of MineAdmin. |
| 6 | + * |
| 7 | + * @link https://www.mineadmin.com |
| 8 | + * @document https://doc.mineadmin.com |
| 9 | + * @contact root@imoi.cn |
| 10 | + * @license https://github.com/mineadmin/MineAdmin/blob/master/LICENSE |
| 11 | + */ |
| 12 | + |
| 13 | +namespace Xmo\AppStore\Command; |
| 14 | + |
| 15 | +use Hyperf\Command\Annotation\Command; |
| 16 | +use Hyperf\Command\Command as Base; |
| 17 | +use Nette\Utils\FileSystem; |
| 18 | +use Symfony\Component\Console\Input\InputOption; |
| 19 | + |
| 20 | +#[Command] |
| 21 | +class ExtensionInitialCommand extends Base |
| 22 | +{ |
| 23 | + protected ?string $name = 'mine-extension:initial'; |
| 24 | + |
| 25 | + protected string $description = 'MineAdmin Extended Store Initialization Command Line'; |
| 26 | + |
| 27 | + public function __invoke(): void |
| 28 | + { |
| 29 | + $this->output->info('Start initialization'); |
| 30 | + $this->output->info('Publishing multilingual documents'); |
| 31 | + $publishPath = dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'publish'; |
| 32 | + $languages = BASE_PATH . '/storage/languages'; |
| 33 | + FileSystem::copy($publishPath . '/trans/en.php', $languages . '/en/app-store.php'); |
| 34 | + FileSystem::copy($publishPath . '/trans/zh-CN.php', $languages . '/zh_CN/app-store.php'); |
| 35 | + $this->output->success('Language file published successfully'); |
| 36 | + $this->output->info('Publishing Configuration Files'); |
| 37 | + FileSystem::copy($publishPath . '/mine-extension.php', BASE_PATH . '/config/autoload/mine-extension.php'); |
| 38 | + $this->output->success('Publishing Configuration File Succeeded'); |
| 39 | + $this->output->warning(' |
| 40 | + 接下来选择开发模式, |
| 41 | + 默认是用 ./web 目录作为前端源码所在目录, |
| 42 | + 也可以配置 mine-extension.php 配置文件 |
| 43 | + 手动指定前端源代码开发目录'); |
| 44 | + $this->output->warning(' |
| 45 | + Next, select the development mode. |
| 46 | + The default is to use . /web directory as the front-end source code directory. |
| 47 | + You can also configure the mine-extension.php configuration file |
| 48 | + Manually specify the front-end source code development directory'); |
| 49 | + } |
| 50 | + |
| 51 | + protected function configure() |
| 52 | + { |
| 53 | + $this->addOption('force', 'f', InputOption::VALUE_NONE, 'Whether or not coverage is mandatory'); |
| 54 | + } |
| 55 | +} |
0 commit comments