-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[BUG] publishConfig.registry
in package.json
should take higher priority than project level .npmrc
#7043
Comments
Also, @alauda/dp-cli:registry = "https://registry.npmjs.org/" This does not work to me neither. |
The project level |
So no way to publish with correct registry without |
@wraithgar I still don't understand this statement, other package manager like |
It's a bit worse than that, Click to OpenAssuming a package called Scopeless// package.json
{
"publishConfig": {
"registry": "https://pkg.fake.io"
}
} # .npmrc
registry=https://rc.fake.io # Command
npm publish $(pwd) --registry "https://cli.fake.io"
# Attempts to publish to
# https://cli.fake.io Partially Scoped// package.json
{
"publishConfig": {
"registry": "https://pkg.fake.io"
}
} # .npmrc
@demo:registry=https://rc.fake.io # Command
npm publish $(pwd) --registry "https://cli.fake.io"
# Attempts to publish to
# https://rc.fake.io All Scoped// package.json
{
"publishConfig": {
"@demo:registry": "https://pkg.fake.io"
}
} # .npmrc
@demo:registry=https://rc.fake.io # Command
npm publish $(pwd) --registry "https://cli.fake.io"
# Attempts to publish to
# https://pkg.fake.io Note that @wraithgar Could you please re-open this ticket and consider canonizing this behavior? This priority is actually critically important for anyone using Gitlab's NPM package registry, since you need to be able to use |
This stops a niche issue when using Gitlab registries, where setting the `.npmrc` to pull packages from the instance-wide registry while also setting the `package.json:publishConfig` to push to the project-local registry for a given `@scope` would pass the incorrect `--registry` flag to `npm publish` as well as associate the `NPM_TOKEN` with the wrong URL in the generated userconfig file. This DOES NOT resolve semantic-release#219. So `--registry` is still technically ignored for scoped packages. See [npm/cli#7043](npm/cli#7043) for more details on that. I made sure not to affect the priority of other resolutions to avoid any breaking changes. An additional test has been added for this specific case.
Any news on this ? I need to publish my package in a Gitlab private registry at a project level.
but this package use other packages at a group level (same private registry, sibling project).
This does not work. |
@thierrymichel You should be able to get this to work with a small adjustment! The "publishConfig": {
"@private:registry": "https://registry-at-project-level"
}, However, this won't work with automated release tools like Semantic Release, which don't respect scoped registries. What I ended up doing was setting up a CI component that defines release-related jobs that all override the committed npm config set -L project @private:registry ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm |
@Kenneth-Sills Thanks a lot !!! |
@Kenneth-Sills I got another issue with |
Yeah!
|
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
For example, If I have
publishConfig.registry = registryA
in@scope/foo
'spackage.json
, and$cwd/.npmrc
with@scope:registry=registryB
, when I runnpm publish
on@scope/foo
, I'd expect to publish it to registryA instead of registryB.However, the current behavior is unexpected to publish on registryB.
Expected Behavior
As title
Steps To Reproduce
As described above
Environment
The text was updated successfully, but these errors were encountered: