yiisoft / config

Configuration management
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
31 stars 11 forks source link

Improve config diff logic #44

Closed viktorprogger closed 3 years ago

viktorprogger commented 3 years ago

In my opinion we can fully remove dist directories/files from a project instead of #42. Not just remove, but replace with another functionality.

I see 6 use-cases to activate this package as a composer plugin:

  1. composer install when composer.lock exists
  2. composer install when composer.lock does not exist
  3. composer update
  4. composer require an existing package, but in another version
  5. composer require a new package
  6. composer require yiisoft/config

Let's talk about the logic when the plugin sees some differences

When there are some differences, the plugin should ask a user what to do. All available variants are:

When a composer command is executed in a non-interactive mode, then the config package should automatically choose the default variant.

samdark commented 3 years ago

Seems to be entirely possible with PRE_PACKAGE_INSTALL and PRE_PACKAGE_UPDATE that are executed before new files are fetched into vendor. This way we can get config we're updating from and, indeed, we don't need dist in this case.

samdark commented 3 years ago

Interactive IO is possible as well with:

/** @var IOInterface $io */
$io->ask('bla-bla');
samdark commented 3 years ago

As an additional option config asks we can have an option to skip copying default config (or all default configs). That will be useful for having totally custom configs that aren't related to what's in the packages.