sindresorhus/npm-name

Allow overriding the registry URL

itaisteinherz opened this issue ยท 5 comments

In some cases (e.g. in np - see sindresorhus/np#350 and sindresorhus/np#317) you want to resolve a package name for a given registry that wasn't configured to be the user's default registry. I think that npm-name should still use the registry URL returned by registry-url as the default one, but also accept an optional registry URL as the second argument, i.e. npmName(name, [registryUrl]) and npmName.many(names, [registryUrl]).

// cc @weekens @jdziat

Not a big fan of this idea. I would prefer it to be fully automatic or if that's not possible, for np just to skip the name checking.

Also note that npm-name supports private registries now: c4e850b

Also note that npm-name supports private registries now

It does, but it won't be able to correctly check the name of a private package in case the package is a private package which is published to a custom private registry, while the currently configured npm registry is a different one (probably https://registry.npmjs.org in the issues I've mentioned above).

Since I accepted sindresorhus/package-json@53c40f2, I guess I should accept this too, but it too should come with a big warning about when and when not to use it.

I'll work on a PR to add this ๐Ÿ‘Œ๐Ÿป