From d2b5002d44599304072f657ddc5316f181277e58 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Fri, 12 Jul 2024 12:35:16 +0200 Subject: [PATCH] Implement the option to skip diffing --- monorepo/DevTools/src/RefactorConfigCommand.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/monorepo/DevTools/src/RefactorConfigCommand.php b/monorepo/DevTools/src/RefactorConfigCommand.php index 927b26d5a26..721bb8cd26e 100644 --- a/monorepo/DevTools/src/RefactorConfigCommand.php +++ b/monorepo/DevTools/src/RefactorConfigCommand.php @@ -34,7 +34,7 @@ class RefactorConfigCommand extends Command protected const SUPPORTED_FORMATS = ['yaml']; /** @var string */ - protected $signature = 'refactor:config {format : The new configuration format}'; + protected $signature = 'refactor:config {format : The new configuration format} {--skip-diff : Skip diffing and dump the entire config}'; /** @var string */ protected $description = 'Migrate the configuration to a different format.'; @@ -59,7 +59,11 @@ protected function migrateToYaml(): int { $this->ensureYamlConfigDoesNotExist(); - $config = $this->getConfigDiff(); + $config = config('hyde'); + + if (! $this->option('skip-diff')) { + $config = $this->getDiffedConfig($config); + } if (empty($config)) { $this->warn("You don't seem to have any configuration to migrate."); @@ -84,9 +88,8 @@ protected function ensureYamlConfigDoesNotExist(): void } } - protected function getConfigDiff(): array + protected function getDiffedConfig($config): array { - $config = config('hyde'); $default = require Hyde::vendorPath('config/hyde.php'); return $this->diffConfig($config, $default);