Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

`npm unpublish` does not respect publishConfig setting for registry #3032

Closed
jden opened this Issue · 12 comments

8 participants

@jden

Running npm publish in a package's directory will get registry settings by reading the publishConfig section of package.json. However, running npm unpublish does not look in package.json and instead uses the default global registry.

Would you accept a patch to make npm unpublish's registry configuration registration behave like npm publish?

@mfncooper
Collaborator

That would make sense to me.

@matthiasg

@jden did you send a patch ?

@jden

@matthiasg never heard back; didn't write a patch

@jden jden closed this
@Evgenus

Why that was closed?

@othiym23
Owner

@Evgenus this is superseded by supporting a per-project .npmrc file (#5077). You can set registry = or @scope:registry = in there.

@othiym23
Owner

Or, rather, it was handled on #4751.

@cstamas

per-project .npmrc is not the solution for this bug IMO. The use case "I do want to fetch from one registry, but am publishing to another one" is still broken.

A project being set up using publishConfig in package.json, as it was the recommended way by npm doco is still broken, it cannot properly unpublish.

Or is there another way to make npm fetch from one registry but publish to another I am not aware of?

@othiym23
Owner

This is what I get for reading the body of an issue (which had a very important typo before I fixed it) and not looking carefully at its title. While this bug / feature request is not a big, earth-shattering deal, I am generally sympathetic to the idea that operations inside npm should be symmetric. As such, if npm publish reads publishConfig data, then so should npm unpublish. That doesn't mean that I'll have time to get to it anytime soon, though, so if somebody (@jden?) wants to take a whack at putting together a PR, I'd be happy to work with them to land it.

@othiym23 othiym23 reopened this
@dweidenfeld

Is there some update on this?

@jden

I no longer have the multiregistry use case, nor the time to put together this PR, although I am generally in favor of the npm client being multi-registry friendly and being able to control this via package.json.

@watilde

I just tried to create a patch at #8013.

@othiym23
Owner

@watilde's patch was a good one, and so is landed as 18ce0ec. I still think that for most per-project configuration, .npmrc is a better place to put this configuration, but now npm publish and npm unpublish use the exact same logic to set the configuration from package.json's publishConfig stanza.

@othiym23 othiym23 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.