Commit 6c5eee3 1 parent a9e8fc7 commit 6c5eee3 Copy full SHA for 6c5eee3
File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,16 @@ export const username = async ({externalRegistry}) => {
43
43
}
44
44
} ;
45
45
46
- export const isExternalRegistry = package_ => typeof package_ . publishConfig ?. registry === 'string' ;
46
+ const NPM_DEFAULT_REGISTRIES = new Set ( [
47
+ // https://docs.npmjs.com/cli/v10/using-npm/registry
48
+ 'https://registry.npmjs.org' ,
49
+ // https://docs.npmjs.com/cli/v10/commands/npm-profile#registry
50
+ 'https://registry.npmjs.org/' ,
51
+ ] ) ;
52
+ export const isExternalRegistry = package_ => {
53
+ const registry = package_ . publishConfig ?. registry ;
54
+ return typeof registry === 'string' && ! NPM_DEFAULT_REGISTRIES . has ( registry ) ;
55
+ } ;
47
56
48
57
export const collaborators = async package_ => {
49
58
const packageName = package_ . name ;
Original file line number Diff line number Diff line change @@ -7,4 +7,6 @@ test('main', t => {
7
7
t . false ( npm . isExternalRegistry ( { name : 'foo' } ) ) ;
8
8
t . false ( npm . isExternalRegistry ( { publishConfig : { registry : true } } ) ) ;
9
9
t . false ( npm . isExternalRegistry ( { publishConfig : 'not an object' } ) ) ;
10
+ t . false ( npm . isExternalRegistry ( { publishConfig : { registry : 'https://registry.npmjs.org' } } ) ) ;
11
+ t . false ( npm . isExternalRegistry ( { publishConfig : { registry : 'https://registry.npmjs.org/' } } ) ) ;
10
12
} ) ;
You can’t perform that action at this time.
0 commit comments