File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,16 @@ export const username = async ({externalRegistry}) => {
4343 }
4444} ;
4545
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+ } ;
4756
4857export const collaborators = async package_ => {
4958 const packageName = package_ . name ;
Original file line number Diff line number Diff line change @@ -7,4 +7,6 @@ test('main', t => {
77 t . false ( npm . isExternalRegistry ( { name : 'foo' } ) ) ;
88 t . false ( npm . isExternalRegistry ( { publishConfig : { registry : true } } ) ) ;
99 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/' } } ) ) ;
1012} ) ;
You can’t perform that action at this time.
0 commit comments