Skip to content

Commit

Permalink
Implement the option to skip diffing
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jul 12, 2024
1 parent abaa764 commit 109eccb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions monorepo/DevTools/src/RefactorConfigCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
Expand All @@ -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.");
Expand All @@ -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);
Expand Down

0 comments on commit 109eccb

Please sign in to comment.