Skip to content
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

Feat: Add Ignore publish config flag #7306

Closed

Conversation

roni-berlin
Copy link
Contributor

Introducing the "Ignore publish config" flag to the npm CLI.

This enhancement provides users with the flexibility to publish packages configured with a specific repository URL in the publishConfig field of their package.json to a different registry. By including the --ignore-publish-config flag with the npm publish command, users can override the default repository specified in the package configuration, facilitating seamless publishing to alternative repositories as needed. This feature empowers developers to manage package distribution more efficiently, accommodating diverse publishing requirements across different environments.

References

Related to #6400

@wraithgar
Copy link
Member

I don't think "yet another flag" is what we really want. The cli flag should be taking precedence here. The fix will probably be something like filtering out any config defined at the cli level from publishConfig before sending it to the flatten function.

@wraithgar wraithgar closed this Mar 21, 2024
@wraithgar
Copy link
Member

Thanks for taking the time to build this PR, still. If we were going to go in this direction it looks ready to land right out of the gate here. Adding new configs is not something we like to do very often, especially if there is a solution that can be reached without it.

In npm, the cli flags are supposed to take the highest priority, even over publishConfig. This is just a straight up bug imho.

@roni-berlin
Copy link
Contributor Author

@wraithgar Thank you for your feedback. I agree with your point about prioritizing CLI flags over additional flags. I've addressed this concern by implementing a solution that filters out any configuration defined at the CLI level from publishConfig before processing it.

You can find the proposed solution in this PR #7321 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants