The npm community forum has been discontinued.
To discuss usage of npm, visit the GitHub Support Community.
git's "includeIf" for npmrc
The current npmrc lookup hierarchy (project, user, global, built-in) doesn’t fit the need for easy config of personal vs. work (etc.). Git’s “includeIf” allows for this set-and-forget scenario:
work/.gitconfig/ git projects…
personal/.gitconfig/ github projects…
personal/.npmrc/ github projcets…
Interesting. Is there a more specific use-case? I had this problem before we started using .npmrc files for work projects. Would having separate .npmrc files inside of each project solve your issue? Then you wouldn’t need to set project-specific config variables on your local machine.
Having an .npmrc per project would work – the point of the conditional include is to avoid just that! Say I have 10 github projects in /personal. Rather than have 10 .npmrc in each, I’d like to have ONE in /personal/.npmrc that applies to all sub folders.
Oh I see. I wouldn’t necessarily prefer that I’m able to change the specific configs for multiple projects in one file. I can see myself easily forgetting how many repos/projects it would affect. But of course you may prefer it so I understand now. I’m curious to see how many people would prefer this behavior though.
Thanks for the remark mark. Only thing I’d practically put in the “root” npmrc would be
email= fields to identify work vs. personal projects. Cheers.