feat: Aggiunta generazione del file `pnpm-workspace.yaml`

This commit is contained in:
Maicol Battistini 2023-06-12 18:34:36 +02:00
parent 4905aaea68
commit e5e97ac13c
No known key found for this signature in database
3 changed files with 46 additions and 8044 deletions

2
.gitignore vendored
View File

@ -19,6 +19,8 @@ _ide_helper_models.php
.idea/watcherTasks.xml
.idea/webServers.xml
storage/dotenv-editor/backups
pnpm-workspace.yaml
pnpm-lock.yaml
# Created by https://www.toptal.com/developers/gitignore/api/laravel,composer,phpstorm,phpstorm+iml
# Edit at https://www.toptal.com/developers/gitignore?templates=laravel,composer,phpstorm,phpstorm+iml

View File

@ -0,0 +1,44 @@
<?php
namespace App\Console\Commands;
use App\Http\Controllers\Controller;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Symfony\Component\Yaml\Yaml;
class WritePnpmWorkspacesFile extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'osm:write-pnpm-workspaces';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Write PNPM workspaces file for additional modules dependencies installation';
/**
* Execute the console command.
*/
public function handle(): void
{
$modules = app(Controller::class)->getModules();
$workspaces_file = base_path('pnpm-workspace.yaml');
$workspaces = Yaml::parseFile($workspaces_file);
$workspaces['packages'] = [];
foreach ($modules as $module) {
$workspaces['packages'][] = relative_path(base_path(), $module['modulePath']);
}
File::put($workspaces_file, Yaml::dump($workspaces));
$this->info('Done');
}
}

File diff suppressed because it is too large Load Diff