Allow multiple config files for e.g. environment-specific dependencies#74
Open
sixmonkey wants to merge 2 commits into
Open
Allow multiple config files for e.g. environment-specific dependencies#74sixmonkey wants to merge 2 commits into
sixmonkey wants to merge 2 commits into
Conversation
Owner
|
You can also use a config array instead of a json file. See wiki for more information. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hey! Thanks for the great work on this package — it fills a real gap in the WordPress ecosystem.
I came across it while working on folivoro/sloth, a WordPress framework, and immediately saw the need for environment-specific plugin dependencies. I came up with the following idea:
Problem
Currently
WP_Dependency_Installerreads from a single hardcoded filenamewp-dependencies.json. There is no way to have a base config and extend it e.g. per environment without duplicating the entire file.Solution
Make the config file list a
public staticproperty — defaulting to the existingwp-dependencies.jsonso there is no breaking change. Callers can override it before callingrun()to load multiple files in order, with later files merged on top of earlier ones.Usage
Base + environment-specific overrides:
Example files:
Missing env-specific files are silently ignored — no errors if
wp-dependencies.local.jsondoesn't exist in production.Backwards compatibility
Fully backwards compatible. The default value of
$config_filesis['wp-dependencies.json']— identical behaviour to the current implementation if the property is not overridden.