-
Notifications
You must be signed in to change notification settings - Fork 4k
fix: per-command config #8776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: latest
Are you sure you want to change the base?
fix: per-command config #8776
Conversation
…me existing commands missing docs
|
Now just running |
|
yay! (seems more like a feat than a chore tho :-p) so does this mean i'll be able to set a top-level config value, but then override it for a specific command? |
I put it as a |
|
It has to be at least a |
No it means we can define a config that only is for a specific command. Obviously these couldn't go into config files (yet?). This will allow commands to have overlapping names in config that have wholly separate configs (i.e. |
|
ah ok, gotcha. i'm not sure how meaning, merely adding a command line config whose acceptable values differ across commands would make that config name poisoned (in npmrc or env vars) until the capability exists for users to override a config value more granularly down to a specific command |
|
@ljharb this PR adds command-level configs just for flags (no |
|
right - but as soon as you add that example without npmrc/env var support, the string "name" in npmrc becomes broken. Meaning, it's not just about new commands, it's that adding any new config key becomes a breaking change, because someone could have it in their env or npmrc. |
Command-Specific Flags Implementation Checklist
This PR enables commands to define their own distinct flags separate from global configuration, eliminating the need for verbose prefixed flags like
--init-nameand allowing cleaner command-specific options.Key Features
flagsconfiguration source - Adds a dedicated layer in the config hierarchy for command-specific flags without modifying existing sourcesloadCommand()method to merge command-specific definitions with global definitions--name) instead of verbose prefixed versions (e.g.,--init-name)Implementation Tasks
flagsto config source hierarchy (betweenenvandcli)loadCommand(definitions)method for dynamic definition merging#warningsarray) to delay logging until after command loadremoveWarnings(types)to clear superseded warnings#deduplicateWarnings()to prevent duplicate warningslogWarnings()method to flush captured warningsexclusiveflag validation across merged definitionscheckUnknown()to recognize bothcliandflagssources