Bagisto Publish Added

This commit is contained in:
Devansh 2022-04-05 14:01:22 +05:30
parent 13b961ee5f
commit 80c7ad45b3
4 changed files with 50 additions and 13 deletions

View File

@ -66,7 +66,7 @@ jobs:
run: set -e && php artisan db:seed --env=testing
- name: Vendor Publish
run: set -e && php artisan vendor:publish --all --force --env=testing
run: set -e && php artisan bagisto:publish --force --env=testing
- name: Execute Unit Tests
run: set -e && vendor/bin/codecept run unit

View File

@ -20,6 +20,22 @@ class BagistoPublish extends Command
*/
protected $description = 'Publish the available assets';
/**
* List of Bagisto's providers.
*
* @var array
*/
protected $providers = [
'Admin' => "Webkul\Admin\Providers\AdminServiceProvider",
'Booking Product' => "Webkul\BookingProduct\Providers\BookingProductServiceProvider",
'Core' => "Webkul\Core\Providers\CoreServiceProvider",
'Product' => "Webkul\Product\Providers\ProductServiceProvider",
'Shop' => "Webkul\Shop\Providers\ShopServiceProvider",
'Social' => "Webkul\SocialLogin\Providers\SocialLoginServiceProvider",
'UI' => "Webkul\Ui\Providers\UiServiceProvider",
'Velocity' => "Webkul\Velocity\Providers\VelocityServiceProvider",
];
/**
* Execute the console command.
*
@ -27,16 +43,37 @@ class BagistoPublish extends Command
*/
public function handle()
{
$this->callSilent('vendor:publish', [
'--tag' => 'canvas-config',
$this->publishAllPackages();
}
/**
* Publish all packages.
*
* @return void
*/
public function publishAllPackages(): void
{
collect($this->providers)->each(function ($provider, $name) {
$this->publishPackage($provider, $name);
});
}
/**
* Publish package.
*
* @param string $provider
* @return void
*/
public function publishPackage(string $provider, string $name): void
{
$this->line('');
$this->line('-----------------------------------------');
$this->info('Publishing ' . $name);
$this->line('-----------------------------------------');
$this->call('vendor:publish', [
'--provider' => $provider,
'--force' => $this->option('force'),
]);
$this->callSilent('vendor:publish', [
'--tag' => 'canvas-assets',
'--force' => true,
]);
$this->info('Publishing complete.');
}
}

View File

@ -53,9 +53,9 @@ class Install extends Command
$result = $this->call('db:seed');
$this->info($result);
// running `php artisan vendor:publish --all`
// running `php artisan bagisto:publish --force`
$this->warn('Step: Publishing assets and configurations...');
$result = $this->call('vendor:publish', ['--all' => true, '--force' => true]);
$result = $this->call('bagisto:publish', ['--force' => true]);
$this->info($result);
// running `php artisan storage:link`

View File

@ -14,7 +14,7 @@ $commands = [
],
'publish' => [
'key' => 'publish_results',
'command' => 'cd ../.. && '. $phpbin .' artisan vendor:publish --all --force 2>&1'
'command' => 'cd ../.. && '. $phpbin .' artisan bagisto:publish --force 2>&1'
],
'storage_link' => [
'key' => 'storage_link_results',