mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-13 04:30:41 -05:00
This update gives mod versions a supported SPT version field that accepts a semantic version. The latest supported SPT version will be automatically resolved based on the semvar. Next up: I need to update the ModVersion to SptVersion relationship to be a many-to-many and expand the resolution to resolve multiple versions.
53 lines
1.6 KiB
PHP
53 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Facades\File;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class UploadAssetsCommand extends Command
|
|
{
|
|
protected $signature = 'app:upload-assets';
|
|
|
|
protected $description = 'Uploads assets to Cloudflare R2';
|
|
|
|
/**
|
|
* This command uploads the Vite build assets to Cloudflare R2. Typically, this will be run after the assets have
|
|
* been built and the application is ready to deploy from within the production environment build process.
|
|
*/
|
|
public function handle(): void
|
|
{
|
|
$this->publishBuildAssets();
|
|
$this->publishVendorAssets();
|
|
}
|
|
|
|
protected function publishBuildAssets(): void
|
|
{
|
|
$this->info('Publishing build assets...');
|
|
|
|
$assets = File::allFiles(public_path('/build'));
|
|
foreach ($assets as $asset) {
|
|
$buildDir = 'build/'.$asset->getRelativePathname();
|
|
$this->info('Uploading asset to: '.$buildDir);
|
|
Storage::disk('r2')->put($buildDir, $asset->getContents());
|
|
}
|
|
|
|
$this->info('Build assets published successfully');
|
|
}
|
|
|
|
protected function publishVendorAssets(): void
|
|
{
|
|
$this->info('Publishing vendor assets...');
|
|
|
|
$assets = File::allFiles(public_path('/vendor'));
|
|
foreach ($assets as $asset) {
|
|
$buildDir = 'vendor/'.$asset->getRelativePathname();
|
|
$this->info('Uploading asset to: '.$buildDir);
|
|
Storage::disk('r2')->put($buildDir, $asset->getContents());
|
|
}
|
|
|
|
$this->info('Build assets published successfully');
|
|
}
|
|
}
|