Skip to content

Commit

Permalink
Merge pull request #1834 from hydephp/experimental-yaml-config-refact…
Browse files Browse the repository at this point in the history
…or-command

Internal: Update internal config converter command
  • Loading branch information
caendesilva authored Jul 12, 2024
2 parents 04ce285 + d2b5002 commit a12f18b
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 a12f18b

Please sign in to comment.