File tree 1 file changed +13
-9
lines changed
1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ function getCustomUpdaterFromPath (updater) {
44
44
*/
45
45
function isValidUpdater ( obj ) {
46
46
return (
47
+ obj &&
47
48
typeof obj . readVersion === 'function' &&
48
49
typeof obj . writeVersion === 'function'
49
50
)
@@ -63,16 +64,19 @@ module.exports.resolveUpdaterObjectFromArgument = function (arg) {
63
64
filename : arg
64
65
}
65
66
}
66
- try {
67
- if ( typeof updater . updater === 'string' ) {
68
- updater . updater = getCustomUpdaterFromPath ( updater . updater )
69
- } else if ( updater . type ) {
70
- updater . updater = getUpdaterByType ( updater . type )
71
- } else {
72
- updater . updater = getUpdaterByFilename ( updater . filename )
67
+
68
+ if ( ! isValidUpdater ( updater . updater ) ) {
69
+ try {
70
+ if ( typeof updater . updater === 'string' ) {
71
+ updater . updater = getCustomUpdaterFromPath ( updater . updater )
72
+ } else if ( updater . type ) {
73
+ updater . updater = getUpdaterByType ( updater . type )
74
+ } else {
75
+ updater . updater = getUpdaterByFilename ( updater . filename )
76
+ }
77
+ } catch ( err ) {
78
+ if ( err . code !== 'ENOENT' ) console . warn ( `Unable to obtain updater for: ${ JSON . stringify ( arg ) } \n - Error: ${ err . message } \n - Skipping...` )
73
79
}
74
- } catch ( err ) {
75
- if ( err . code !== 'ENOENT' ) console . warn ( `Unable to obtain updater for: ${ JSON . stringify ( arg ) } \n - Error: ${ err . message } \n - Skipping...` )
76
80
}
77
81
/**
78
82
* We weren't able to resolve an updater for the argument.
You can’t perform that action at this time.
0 commit comments