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

Commita0120d2

Browse files
committed
fix: log the path of existing.npmrc files
1 parent6189ee7 commita0120d2

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

‎lib/set-npmrc-auth.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ module.exports = async (
1717
{registry:'https://registry.npmjs.org/'},
1818
{config:NPM_CONFIG_USERCONFIG||path.resolve(cwd,'.npmrc')}
1919
);
20+
21+
if(configs){
22+
logger.log('Reading npm config from %s',configs.join(', '));
23+
}
24+
2025
constcurrentConfig=configs ?(awaitPromise.all(configs.map(config=>readFile(config)))).join('\n') :'';
2126

2227
if(getAuthToken(registry,{npmrc:rcConfig})){

‎test/set-npmrc-auth.test.js‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ test.serial('Preserve home ".npmrc"', async t => {
6060
awaitrequire('../lib/set-npmrc-auth')(npmrc,'http://custom.registry.com',{cwd, env,logger:t.context.logger});
6161

6262
t.is((awaitreadFile(npmrc)).toString(),`home_config = test\n//custom.registry.com/:_authToken = \${NPM_TOKEN}`);
63-
t.deepEqual(t.context.log.args[1],[`Wrote NPM_TOKEN to${npmrc}`]);
63+
t.deepEqual(t.context.log.args[1],[
64+
'Reading npm config from %s',
65+
[path.resolve(process.env.HOME,'.npmrc')].join(', '),
66+
]);
67+
t.deepEqual(t.context.log.args[2],[`Wrote NPM_TOKEN to${npmrc}`]);
6468
});
6569

6670
test.serial('Preserve home and local ".npmrc"',asynct=>{
@@ -79,7 +83,11 @@ test.serial('Preserve home and local ".npmrc"', async t => {
7983
(awaitreadFile(npmrc)).toString(),
8084
`home_config = test\ncwd_config = test\n//custom.registry.com/:_authToken = \${NPM_TOKEN}`
8185
);
82-
t.deepEqual(t.context.log.args[1],[`Wrote NPM_TOKEN to${npmrc}`]);
86+
t.deepEqual(t.context.log.args[1],[
87+
'Reading npm config from %s',
88+
[path.resolve(process.env.HOME,'.npmrc'),path.resolve(cwd,'.npmrc')].join(', '),
89+
]);
90+
t.deepEqual(t.context.log.args[2],[`Wrote NPM_TOKEN to${npmrc}`]);
8391
});
8492

8593
test.serial('Preserve all ".npmrc" if auth is already configured',asynct=>{
@@ -94,7 +102,10 @@ test.serial('Preserve all ".npmrc" if auth is already configured', async t => {
94102
awaitrequire('../lib/set-npmrc-auth')(npmrc,'http://custom.registry.com',{cwd,env:{},logger:t.context.logger});
95103

96104
t.is((awaitreadFile(npmrc)).toString(),`home_config = test\n//custom.registry.com/:_authToken = \${NPM_TOKEN}`);
97-
t.is(t.context.log.callCount,1);
105+
t.deepEqual(t.context.log.args[1],[
106+
'Reading npm config from %s',
107+
[path.resolve(process.env.HOME,'.npmrc'),path.resolve(cwd,'.npmrc')].join(', '),
108+
]);
98109
});
99110

100111
test.serial('Preserve ".npmrc" if auth is already configured for a scoped package',asynct=>{
@@ -115,7 +126,10 @@ test.serial('Preserve ".npmrc" if auth is already configured for a scoped packag
115126
(awaitreadFile(npmrc)).toString(),
116127
`home_config = test\n@scope:registry=http://custom.registry.com\n//custom.registry.com/:_authToken = \${NPM_TOKEN}`
117128
);
118-
t.is(t.context.log.callCount,1);
129+
t.deepEqual(t.context.log.args[1],[
130+
'Reading npm config from %s',
131+
[path.resolve(process.env.HOME,'.npmrc'),path.resolve(cwd,'.npmrc')].join(', '),
132+
]);
119133
});
120134

121135
test.serial('Throw error if "NPM_TOKEN" is missing',asynct=>{
@@ -148,7 +162,7 @@ test.serial('Emulate npm config resolution if "NPM_CONFIG_USERCONFIG" is set', a
148162
});
149163

150164
t.is((awaitreadFile(npmrc)).toString(),`//custom.registry.com/:_authToken = \${NPM_TOKEN}`);
151-
t.is(t.context.log.callCount,1);
165+
t.deepEqual(t.context.log.args[1],['Reading npm config from %s',[path.resolve(cwd,'.custom-npmrc')].join(', ')]);
152166
});
153167

154168
test.serial('Throw error if "NPM_USERNAME" is missing',asynct=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp