@@ -61,12 +61,12 @@ export function checkPeerDependencies(packageManager: string, installMissingPeer
61
61
} ) ;
62
62
63
63
64
- if ( nosolution . length ) {
64
+ if ( nosolution . length > 0 ) {
65
65
console . error ( ) ;
66
66
}
67
67
68
68
const commandLines = getCommandLines ( packageManager , installs , upgrades ) ;
69
- if ( installMissingPeerDependencies ) {
69
+ if ( installMissingPeerDependencies && commandLines . length > 0 ) {
70
70
console . log ( 'Installing peerDependencies...' ) ;
71
71
console . log ( ) ;
72
72
commandLines . forEach ( command => {
@@ -75,7 +75,14 @@ export function checkPeerDependencies(packageManager: string, installMissingPeer
75
75
console . log ( ) ;
76
76
} ) ;
77
77
78
- const newUnsatisfiedDeps = getAllNestedPeerDependencies ( ) . filter ( dep => ! dep . semverSatisfies ) ;
78
+ const newUnsatisfiedDeps = getAllNestedPeerDependencies ( )
79
+ . filter ( dep => ! dep . semverSatisfies )
80
+ . filter ( dep => ! nosolution . some ( x => isSameDep ( x . problem , dep ) ) ) ;
81
+
82
+ if ( nosolution . length === 0 && newUnsatisfiedDeps . length === 0 ) {
83
+ console . log ( 'All peer dependencies are met' ) ;
84
+ }
85
+
79
86
if ( newUnsatisfiedDeps . length > 0 ) {
80
87
console . log ( `Found ${ newUnsatisfiedDeps . length } new unmet peerDependencies...` ) ;
81
88
if ( ++ recursiveCount < 5 ) {
@@ -84,15 +91,28 @@ export function checkPeerDependencies(packageManager: string, installMissingPeer
84
91
console . error ( 'Recursion limit reached (5)' ) ;
85
92
process . exit ( 5 )
86
93
}
87
- } else {
88
- console . log ( 'All peer dependencies are met' ) ;
89
94
}
90
95
91
- } else {
96
+ } else if ( commandLines . length > 0 ) {
92
97
console . log ( `Install peerDependencies using ${ commandLines . length > 1 ? 'these commands:' : 'this command' } :` ) ;
93
98
console . log ( ) ;
94
99
commandLines . forEach ( command => console . log ( command ) ) ;
95
100
console . log ( ) ;
96
101
}
97
102
}
98
103
104
+
105
+ function isSameDep ( a : Dependency , b : Dependency ) {
106
+ const keys : Array < keyof Dependency > = [
107
+ "name",
108
+ "version",
109
+ "depender",
110
+ "dependerPath",
111
+ "dependerVersion",
112
+ "installedVersion",
113
+ "semverSatisfies",
114
+ "isYalc"
115
+ ];
116
+
117
+ return keys.every(key => a [ key ] === b [ key ] ) ;
118
+ }
0 commit comments