Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit932ea5e

Browse files
ryaninventspvdlg
authored andcommitted
fix: Honor NPM_CONFIG_USERCONFIG setting
This bug cost me weeks 😅`npm` honors the `NPM_CONFIG_USERCONFIG` setting, which our CI relies on to inject shared credentials at runtime. `npm publish` succeeds if we're not using Semantic Release. However, `@semantic-release/npm` has reimplemented a credentials check in a manner not compatible with the way `npm` handles the user config environment variable. This PR checks the location specified in `NPM_CONFIG_USERCONFIG` before using `rc` to crawl up the file hierarchy.It should be noted that `rc` does not fully implement the `.npmrc` resolution algorithm, skipping the ability to specify config files from an env var. That's why we're facing this problem.I've tested this locally, and this small fix would allow us to use Semantic Release 🎉
1 parentbf603e5 commit932ea5e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎lib/set-npmrc-auth.js‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ const nerfDart = require('nerf-dart');
66
constAggregateError=require('aggregate-error');
77
constgetError=require('./get-error');
88

9-
module.exports=async(registry,{cwd,env:{NPM_TOKEN,NPM_USERNAME,NPM_PASSWORD,NPM_EMAIL}, logger})=>{
9+
module.exports=async(
10+
registry,
11+
{cwd,env:{NPM_TOKEN,NPM_CONFIG_USERCONFIG,NPM_USERNAME,NPM_PASSWORD,NPM_EMAIL}, logger}
12+
)=>{
1013
logger.log('Verify authentication for registry %s',registry);
11-
constconfig=path.resolve(cwd,'.npmrc');
14+
constconfig=NPM_CONFIG_USERCONFIG||path.resolve(cwd,'.npmrc');
1215
if(getAuthToken(registry,{npmrc:rc('npm',{registry:'https://registry.npmjs.org/'},{config})})){
1316
return;
1417
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp