pgsandstrom / package-json-upgrade

MIT License
49 stars 10 forks source link

fails when using ENV variable in `.npmrc` #47

Closed mverkerk-godaddy closed 1 year ago

mverkerk-godaddy commented 1 year ago

In my ~/.npmrc file, I am setting the _auth token for my registry with an environment variable, like so:

registry=https://my-registry/
//my-registry/:_auth=${NPM_TOKEN}
always-auth=true
email=noreply@my-domain.com

It seems that this is not supported as I get messages saying "Dependency not found" but when i replace the variable with the actual auth token, the extension works ... our tokens are regularly rotated, hence the env variable ...

Is there any way you can add support for this?

pgsandstrom commented 1 year ago

Unfortunately i rely on npm-registry-fetch for fetching from npm using npm configuration. Your best bet would be to open an issue on that project: https://github.com/npm/npm-registry-fetch

However, I am currently holding of upgrading to the latest version of npm-registry-fetch since it is esm-only and that causes some problems. So it would only work if they also patched it on their v14.

pgsandstrom commented 1 year ago

Wait, I got confused. There is nothing holding me back from upgrading npm-registry-fetch. So if they could parse your config file, it would also be possible to implement it in this extension.