diff --git a/src/Console/Commands/InstallSsg.php b/src/Console/Commands/InstallSsg.php new file mode 100644 index 0000000000..57478851f4 --- /dev/null +++ b/src/Console/Commands/InstallSsg.php @@ -0,0 +1,65 @@ +error('The Static Site Generator package is already installed.'); + } + + $this->info('Installing the statamic/ssg package...'); + Composer::withoutQueue()->throwOnFailure()->require('statamic/ssg'); + $this->checkLine('Installed statamic/ssg package'); + + if ($this->confirm('Would you like to publish the config file?')) { + Process::run([ + (new PhpExecutableFinder())->find(false) ?: 'php', + defined('ARTISAN_BINARY') ? ARTISAN_BINARY : 'artisan', + 'vendor:publish', + '--provider', + 'Statamic\\StaticSite\\ServiceProvider', + ]); + + $this->checkLine('Config file published. You can find it at config/statamic/ssg.php'); + } + + if ( + ! Composer::isInstalled('spatie/fork') + && $this->confirm('Would you like to install spatie/fork? It allows for running multiple workers at once.') + ) { + Composer::withoutQueue()->throwOnFailure()->require('spatie/fork'); + $this->checkLine('Installed spatie/fork package'); + } + } +} diff --git a/src/Providers/ConsoleServiceProvider.php b/src/Providers/ConsoleServiceProvider.php index 7f78a5c6eb..dad1ba6ed4 100644 --- a/src/Providers/ConsoleServiceProvider.php +++ b/src/Providers/ConsoleServiceProvider.php @@ -15,6 +15,7 @@ class ConsoleServiceProvider extends ServiceProvider Commands\AssetsMeta::class, Commands\GlideClear::class, Commands\Install::class, + Commands\InstallSsg::class, Commands\FlatCamp::class, Commands\LicenseSet::class, Commands\MakeAction::class,