@@ -1173,6 +1173,10 @@ module.exports = cls => class Reifier extends cls {
1173
1173
}
1174
1174
1175
1175
let newSpec
1176
+ // True if the dependency is getting installed from a local file path
1177
+ // In this case it is not possible to do the normal version comparisons
1178
+ // as the new version will be a file path
1179
+ const isLocalDep = req . type === 'directory' || req . type === 'file'
1176
1180
if ( req . registry ) {
1177
1181
const version = child . version
1178
1182
const prefixRange = version ? this [ _savePrefix ] + version : '*'
@@ -1204,7 +1208,7 @@ module.exports = cls => class Reifier extends cls {
1204
1208
} else {
1205
1209
newSpec = h . shortcut ( opt )
1206
1210
}
1207
- } else if ( req . type === 'directory' || req . type === 'file' ) {
1211
+ } else if ( isLocalDep ) {
1208
1212
// save the relative path in package.json
1209
1213
// Normally saveSpec is updated with the proper relative
1210
1214
// path already, but it's possible to specify a full absolute
@@ -1233,11 +1237,11 @@ module.exports = cls => class Reifier extends cls {
1233
1237
if ( hasSubKey ( pkg , 'devDependencies' , name ) ) {
1234
1238
pkg . devDependencies [ name ] = newSpec
1235
1239
// don't update peer or optional if we don't have to
1236
- if ( hasSubKey ( pkg , 'peerDependencies' , name ) && ! intersects ( newSpec , pkg . peerDependencies [ name ] ) ) {
1240
+ if ( hasSubKey ( pkg , 'peerDependencies' , name ) && ( isLocalDep || ! intersects ( newSpec , pkg . peerDependencies [ name ] ) ) ) {
1237
1241
pkg . peerDependencies [ name ] = newSpec
1238
1242
}
1239
1243
1240
- if ( hasSubKey ( pkg , 'optionalDependencies' , name ) && ! intersects ( newSpec , pkg . optionalDependencies [ name ] ) ) {
1244
+ if ( hasSubKey ( pkg , 'optionalDependencies' , name ) && ( isLocalDep || ! intersects ( newSpec , pkg . optionalDependencies [ name ] ) ) ) {
1241
1245
pkg . optionalDependencies [ name ] = newSpec
1242
1246
}
1243
1247
} else {
0 commit comments