cli icon indicating copy to clipboard operation
cli copied to clipboard

Better support for determining the effective repository

Open InputNeuron opened this issue 6 years ago • 8 comments

(note: tried to submit this as a feature request but the form is broken and "Start Discussion" never goes green)

I'm having tons of problems working with .npmrc and repository settings because it's difficult to determine which repository is actually being used.

Here are a list of things that could be improved and problems I'm having:

  • when using npm ping and readonly tokens, it uses tries to 'write' thus can't actually test the readonly status of the token

  • for each node operation, have an option to show which repo is being used. Either just show it for all actions by default or show it with --verbose

  • instead of npm config set registry maybe a dedicated npm set-registry command to include the registry URL, tokens, or perform auth, and then test, all in one pass.

  • when .npmrc is being used, there's no way to trace WHICH .npmrc is being used or which files are being read.

Basically, there's no reliable way to determine and set the registry each time and I have insufficient tools to actually debug the problem.

InputNeuron avatar Nov 15 '20 23:11 InputNeuron

If I try to ping with a read-only token I get the following error:

npm notice PING https://polar-app.bytesafe.dev/r/default
npm ERR! code E401
npm ERR! 401 Unauthorized - GET https://polar-app.bytesafe.dev/r/default/-/ping?write=true - Access Denied

... I assume this is a bug.

InputNeuron avatar Nov 15 '20 23:11 InputNeuron

another issue... if I"m using a .npmrc with an auth token, there's no way to tell if it's being used and if the syntax is right.

my .npmrc is:

//polar-app.bytesafe.dev/r/default:_authToken=xxxxxx

... but I don't know if it's parsing the authToken properly.

InputNeuron avatar Nov 15 '20 23:11 InputNeuron

Another idea..npm whoami should show the registry that is actively being used.

InputNeuron avatar Nov 15 '20 23:11 InputNeuron

... and this is just a flat out bug:

When you to npm token list

it prints a suffix of the token but shows the ellipsis on the END not the beginning.

│ 409100 │ KH9X7K… │ 2020-11-15 │ yes │ │

... there are a LOT of bugs here :-/

InputNeuron avatar Nov 15 '20 23:11 InputNeuron

Additionally:

https://docs.npmjs.com/cli/v6/configuring-npm/npmrc

doesn't really clarify the order of the files.

I would assume the priority would be

  • per project .npmrc
  • per user .npmrc
  • global .npmrc

but it's actually

  • per user
  • per project
  • then global I guess

... and since there isn't any way to debug this there's no way to determine the order.

At least update the documentation.

... here be a LOT of dragons.

InputNeuron avatar Nov 15 '20 23:11 InputNeuron

Hey @burtonator! Appreciate the feedback & I apologize that the discussion/links were broken when you tried to file this just now (I've updated that so hopefully it points in the right direction going forward).

For general feedback/we've opened up a public repo here: https://github.com/npm/feedback &/or you can propose something more formally in our RFC repo here: https://github.com/npm/rfcs

If you'd like to file a bug, or bugs*, please use one of our issue templates found here: https://github.com/npm/cli/issues/new/choose & provide as much detail as you can so we can reproduce & hopefully fix the issue quickly.

darcyclarke avatar Nov 16 '20 00:11 darcyclarke

@darcyclarke ... as a project maintainer I have to say that this is VERY valuable feedback I provided and you just closed the bug. These types of bugs shouldn't just be closed just because they were pushed to the wrong place.

InputNeuron avatar Nov 16 '20 01:11 InputNeuron

@burtonator

as a project maintainer I have to say that this is VERY valuable feedback I provided and you just closed the bug

Apologize for the miscommuniction. Closing this issue had nothing to do with the merit of some of your comments (I think we can definitely improve the CLI in various ways & I think there are some great ideas here); Moreso, it reflects that this thread does not use/follow our bug template (which we ask the community to use so we can properly reproduce/triage issues).

These types of bugs shouldn't just be closed just because they were pushed to the wrong place.

"Better support for determining the effective repository", objectively, isn't a bug. Bug reports are the only type of issue we expect created in this repo at the moment. With that in mind, I find it totally reasonable to close this & try to encourage you to break up & file your feedback in a way that our team can engage & support you properly (ie. the reference/links shared above).

I hope you'll consider creating individual bug reports for the items you think are indeed broken today (as mentioned above) & can start discussions here for the other feedback/ideas/suggestions/improvements you have.

darcyclarke avatar Nov 16 '20 01:11 darcyclarke