File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -17,19 +17,27 @@ if (packageLock.lockfileVersion !== 2) {
1717  throw  new  Error ( 'package-lock.json must have "lockfileVersion": 2' ) ; 
1818} 
1919
20+ const  disallowedHosts  =  [ 
21+   { 
22+     host : "codeartifact.us-west-2.amazonaws.com" , 
23+     errorMessage :
24+       "package-lock.json file contains a reference to CodeArtifact. Use regular npm to update the packages." , 
25+   } , 
26+ ] ; 
27+ 
2028function  unlock ( packages )  { 
2129  Object . keys ( packages ) . forEach ( ( dependencyName )  =>  { 
2230    const  dependency  =  packages [ dependencyName ] ; 
2331
2432    if  ( dependencyName . includes ( "@cloudscape-design/" ) )  { 
2533      delete  packages [ dependencyName ] ; 
26-     }  else  if  ( 
27-       dependency . resolved   && 
28-       new   URL ( dependency . resolved ) . host . endsWith ( "codeartifact.us-west-2.amazonaws.com" ) 
29-     )  { 
30-       throw  Error ( 
31-         "package-lock.json file contains a reference to CodeArtifact. Use regular npm to update the packages." , 
32-       ) ; 
34+     }  else  if  ( dependency . resolved )   { 
35+       const   host   =   new   URL ( dependency . resolved ) . host ; 
36+       for   ( const   disalloweHost   of   disallowedHosts )   { 
37+          if   ( host   ===   disalloweHost . host   ||   host . endsWith ( `. ${ disalloweHost . host } ` ) )  { 
38+            throw  Error ( disalloweHost . errorMessage ) ; 
39+         } 
40+       } 
3341    } 
3442  } ) ; 
3543
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments