Problem/Motivation
In a very big projects you get situation when config export will generate huge amount of files. And usually they settle down to a directory found in your settings.php file - usually called "../config/default".
If you have +1k config yaml files, there can be not practical to work with them in IDE. Also pull/merge requests are not organised.
Steps to reproduce
Here you can imagine creating manu bundles with many different type of fields.
And there are many crazy ways to blow configs.
Proposed resolution
In this case "drush config:export" has no hook or event to interrupt to config file path name. So my temporary solution was a small patch with "@hook post-command config:export" drush hook where I run config file renaming. Simply I rename config files by taking first word till first DOT. So config file "core.extension.yml" would become "core/core.extension.yml" and so on.
So after some debugging, I found places where it reads config files and then content from them.
Sorry for messing up in my patch, but as I got into situation when I cannot work anymore - that worked for me well:
two patch files contain the fixes that were needed for making core to work with subfoldering.
you install module that works as a yml file distributor after drush config:export (alias:cex) and config import will take the same way.
Remaining tasks
- Lets answer if it is useful for drupal at all to make as a feature. If yes - lets proceed with this feature. Many projects are meeting this issue when they grow.
- can it be made by setting to choose if I want them to be distributed. Could be implemented in settings.php same as chaning config directory
- regex or some ways how they can be distributed. But in this case it is very natural distribution taking first word.
User interface changes
There could be system setting - should yml files be organizes into subdirectories or not. Or even it could become core solution as there is no point to have all of them in one directory.