Skip to content

Commit 5eb8886

Browse files
committed
fix: No longer warn inappropriately when a custom updater is provided as an object
1 parent 1537b67 commit 5eb8886

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

lib/updaters/index.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ function getCustomUpdaterFromPath (updater) {
4444
*/
4545
function isValidUpdater (obj) {
4646
return (
47+
obj &&
4748
typeof obj.readVersion === 'function' &&
4849
typeof obj.writeVersion === 'function'
4950
)
@@ -63,16 +64,19 @@ module.exports.resolveUpdaterObjectFromArgument = function (arg) {
6364
filename: arg
6465
}
6566
}
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...`)
7379
}
74-
} catch (err) {
75-
if (err.code !== 'ENOENT') console.warn(`Unable to obtain updater for: ${JSON.stringify(arg)}\n - Error: ${err.message}\n - Skipping...`)
7680
}
7781
/**
7882
* We weren't able to resolve an updater for the argument.

0 commit comments

Comments
 (0)