Skip to content

Use CLI --@scope:registry flag to override scoped registry defined in .npmrc #219

@maryiam

Description

@maryiam

I'm using semantic-release-npm to publish a package on my Nexus registry. My package is scoped.

I have the following config my .npmrc that defines a rule for installing my scoped package (get it from Nexus proxy repository):

@myscope:registry=https://my-nexus-proxy-npm-group-url

If I use npm cli to publish my package, I am able to override the .npmrc :

  • with the --@scope:registry arg (and like mentioned here):
npm publish --@scope:registry=my-nexus-registry-URL
  • or with adding this config to my package.json
"publishConfig": {
    "@myscope:registry": "my-nexus-registry-URL"
  }

I am not able to achieve the same result with semantic-release-npm. The command that it uses to publish doesn't support the arg --@scope:registry, only the --registry arg is supported:

npm publish --userconfig /path/to/.npmrc --registry URL

Is there any way that I can configure semantic-release to use a scoped registry instead? Even when I try to configure the publishConfig attribute in my package.json like this

"publishConfig": {
    "@myscope:registry": "my-nexus-registry-URL"
  }

it's not working because the get-registry.js is taking into account only the registry attribute without supporting the scoped registry config.

Thanks.

Activity

pvdlg

pvdlg commented on Nov 13, 2019

@pvdlg
Member

The config @myscope:registry allow to set a registry that will be used only package in @scope.
As you can see in this test we do read the @myscope:registry property from .npmrc and that's the value that is passed to --registry.

So if you have @myscope:registry=https://my-nexus-proxy-npm-group-url in your .npmrc and your package is in the scope @myscope then the registry https://my-nexus-proxy-npm-group-url will be used for the publish step.

Please provide:

  • A description of the actual issue you are encountering (error message? package published on the wrong registry?)
  • The exact content of your ~/.npmrc and ./.npmrc
  • The exact version of @semantic-release/npm you are using
  • The semantic-release logs
pvdlg

pvdlg commented on Nov 28, 2019

@pvdlg
Member

Closing as no response provided. Feel free to re-open if you still experience an issue and provide the info requested above.

brncsk

brncsk commented on Sep 29, 2020

@brncsk

I think this should be reopened. The scoped registry should be picked up from package.json's publishConfig as well as from .npmrc.

I've just run into this, and this issue is clearly stated in the original report as well.

jameshartig

jameshartig commented on Mar 5, 2021

@jameshartig
Contributor

We're running into this issue. Setting NPM_CONFIG_REGISTRY does not correctly set --@scope:registry= and just uses --registry instead.

NNNaix

NNNaix commented on Jun 25, 2021

@NNNaix

Hello, @jameshartig .

Just uses --registry is not enough beacuse if setting @scope:registry in .npmrc it will always have a higher priority.

But the scope registry in .npmrc is setting for installing. For example i develop a boilerplate and i don't want npm publish using registry from .npmrc, and --registry will not work.

added a commit that references this issue on Jul 30, 2024
975b999
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @jameshartig@brncsk@pvdlg@maryiam@NNNaix

      Issue actions

        Use CLI --@scope:registry flag to override scoped registry defined in .npmrc · Issue #219 · semantic-release/npm