Extraction of the majority of the utilities from the config singleton#816
Merged
jdmarshall merged 8 commits intonode-config:masterfrom May 29, 2025
Merged
Extraction of the majority of the utilities from the config singleton#816jdmarshall merged 8 commits intonode-config:masterfrom
jdmarshall merged 8 commits intonode-config:masterfrom
Conversation
This will simplify some work to split up lib/config.js
This is to make space for unravelling the mess that is the singleton into some functional components that may be useful individually. This also deprecates some functions that probably should never have been exposed. This refactor is as commit-history-preserving as I could manage. Subsequent commits will involve rearranging more of the code to extricate things from config.js
This will preserve edit history on both original files.
Also contains workaround for node-config#815 - which pops up due to running extendDeep in strict mode.
Collaborator
Author
|
In retrospect we should have perhaps called 4.0.0 3.5.0 as this change is more of a 4.x change than the deprecations we removed. |
Collaborator
Author
|
config.js can shrink by around 400 lines once we start removing Config.util methods that are marked deprecated and have trampolines to lib/util.js. The duplicate jsdoc entries are about 40% of the moved code and are retained for documentation purposes. |
jdmarshall
commented
May 18, 2025
This was referenced May 18, 2025
markstos
approved these changes
May 29, 2025
Collaborator
markstos
left a comment
There was a problem hiding this comment.
Makes sense to me.
QA Log
- Noted that the PR seems to pass existing tests, while adding more test coverage.
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.
This PR contains a good deal of code to maintain feature and bug parity with the existing Config.util behavior while also extracting code that can be run either statically or as part of a separate workflow.
This is designed with elements of #569 in mind in addition to a number of other issues
Providing workarounds for some and fixing a few outright.
This PR also includes code from #808 which this PR leverages.
These changes also include:
getOption()require('config')call - which substantially complicated the plumbing and necessitated the LoadInfo vs Env split.To the best of my knowledge this contains no breaking changes, But it contains a number of TODOs that would be good candidates for a 4.1
Note that these commits also include
git mvtrickery to maintain commit history on both sides of the split files, to support forensics on future bug-vs-feature triage.