@@ -656,7 +656,29 @@ export default function(options: UpdateSchema): Rule {
656
656
657
657
// Build a map of all dependencies and their packageJson.
658
658
reduce < NpmRepositoryPackageJson , Map < string , NpmRepositoryPackageJson > > (
659
- ( acc , npmPackageJson ) => acc . set ( npmPackageJson . name , npmPackageJson ) ,
659
+ ( acc , npmPackageJson ) => {
660
+ // If the package was not found on the registry. It could be private, so we will just
661
+ // ignore. If the package was part of the list, we will error out, but will simply ignore
662
+ // if it's either not requested (so just part of package.json. silently) or if it's a
663
+ // `--all` situation. There is an edge case here where a public package peer depends on a
664
+ // private one, but it's rare enough.
665
+ if ( ! npmPackageJson . name ) {
666
+ if ( packages . has ( npmPackageJson . requestedName ) ) {
667
+ if ( options . all ) {
668
+ logger . warn ( `Package ${ JSON . stringify ( npmPackageJson . requestedName ) } was not `
669
+ + 'found on the registry. Skipping.' ) ;
670
+ } else {
671
+ throw new SchematicsException (
672
+ `Package ${ JSON . stringify ( npmPackageJson . requestedName ) } was not found on the `
673
+ + 'registry. Cannot continue as this may be an error.' ) ;
674
+ }
675
+ }
676
+ } else {
677
+ acc . set ( npmPackageJson . name , npmPackageJson ) ;
678
+ }
679
+
680
+ return acc ;
681
+ } ,
660
682
new Map < string , NpmRepositoryPackageJson > ( ) ,
661
683
) ,
662
684
0 commit comments