-
Notifications
You must be signed in to change notification settings - Fork 240
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
RFC for context
config parameter
#336
Conversation
|
heads up: the name "where" might be a little confusing in some situations and problematic in some other ones
(spoiler alert: I have all that info on top of my mind since I was thinking about turning this repeating Given all that context, may I suggest picking a different name to err on the safe side? |
fair enough, how about |
maybe it's the other way round and we might want to migrate the current usage of |
i like that better, i'll use your head start and see if i can figure out what other modules in our ecosystem care about the |
where
config parameterwhere
config parameter
i didn't do the work ahead of time to audit the dependencies, but did make a note under implementation that work must be done before implementation here |
due to the ambiguity of our implementation will differ, however, as instead of referring to keys within one config file like we chose this over something more specific like |
I'm bias but think this is the right approach/nomenclature & helps standardize/centralize our understanding of these existing/known contexts |
@@ -0,0 +1,116 @@ | |||
# {{TITLE: Add a `context` parameter for `npm config` and `npm exec` commands}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nlf I think we can remove the {{TITLE: ... }}
wrapping syntax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets try to remove/update some of bikeshedding/unresolved questions
|
||
## Unresolved Questions and Bikeshedding | ||
|
||
~Is `where` the best name for this config? What if there are too many conflicts in dependencies?~ EDIT: Document updated to use `context` instead of `where`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove this question since we've updated the name & consider that to be better/more concise then where
was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I missed this discussion - I do not find "context" to be clear at all. It's a word with tons of conflated meanings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you didn't miss it, we did some bike shedding trying to come up with something else outside of the rfc calls. we also discussed having separate flags for each purpose like --config-location
/--bin-location
but there was some concern that "location" implies the value can be a path, which is not something we want to support. most alternatives i came up with had the same problem, such as --config-source
. something like --config-type
/--bin-type
could work maybe?
we went with context
because it is somewhat vague, but is language that can be reasoned about. if you've got better suggestions, though, i'm all ears. it's time to pick a color for our bike shed so we can get to painting it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a location tho - location doesn’t necessarily imply path, and since it’s an enum, it’d immediately error if an invalid value was passed, so any confusion would be rapidly dispelled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about just --location
? npm config set foo=bar --location=user
isn't terrible, nor is npx --location=remote tap
, -L
is open as a short form too (-l
is --long
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems fine with me.
|
||
~Is `where` the best name for this config? What if there are too many conflicts in dependencies?~ EDIT: Document updated to use `context` instead of `where`. | ||
|
||
What would the shortcut be? `-c` is currently the short form of `--call`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-c
is --call
& -C
is --prefix
(a bit confusing there on that second one for sure....) so I feel like we could use -x
|
||
### `npm config` | ||
|
||
Should we prevent a user from setting protected fields like `_auth` or `_token` to a local config? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's stay consistent with whatever is supported by npm config
by default &/or when run in the global
context. If we support different behaviour in the user
or global
contexts today I'd wonder why; The whole point of unlocking local
/project-level context is to eliminate the need to manually manage an .npmrc
file. Limiting the fields you can set
would also reduce the usability of defining the local
context
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a fair point 👍
|
||
### `npm exec` | ||
|
||
Should we prompt when multiple matches are found? If we would prompt but are unable to, what should we do? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this means? I feel like this is already answered by the note, further up, outlining that we will follow the existing binary resolution pattern in npm exec
(ref. https://github.com/npm/rfcs/pull/336/files#diff-e69970007bc5185a814912b41199ac9648ecfc70be343865a55d558f4c417028R56-R57)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc there was some concern about which bin was linked being non-deterministic, but after a quick read through of bin-links it seems like that should only be possible if the user passed --force
(or somehow we ended up reifying something deeper in the dep tree before something shallower, which shouldn't be possible since arborist sorts deps so shallowest are first) so maybe it's not something to worry about
08b45ae
to
0a63ed2
Compare
@nlf should the title of this PR be updated? |
This is a suggestion to allow for users to leverage the npm CLI to modify their project-level
.npmrc
files, as well as to remove ambiguity and inconsistency in the behavior ofnpm exec