Skip to content

Commit

Permalink
fix: No longer warn inappropriately when a custom updater is provided…
Browse files Browse the repository at this point in the history
… as an object
  • Loading branch information
TimothyJones committed May 28, 2022
1 parent 1537b67 commit 5eb8886
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions lib/updaters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function getCustomUpdaterFromPath (updater) {
*/
function isValidUpdater (obj) {
return (
obj &&
typeof obj.readVersion === 'function' &&
typeof obj.writeVersion === 'function'
)
Expand All @@ -63,16 +64,19 @@ module.exports.resolveUpdaterObjectFromArgument = function (arg) {
filename: arg
}
}
try {
if (typeof updater.updater === 'string') {
updater.updater = getCustomUpdaterFromPath(updater.updater)
} else if (updater.type) {
updater.updater = getUpdaterByType(updater.type)
} else {
updater.updater = getUpdaterByFilename(updater.filename)

if (!isValidUpdater(updater.updater)) {
try {
if (typeof updater.updater === 'string') {
updater.updater = getCustomUpdaterFromPath(updater.updater)
} else if (updater.type) {
updater.updater = getUpdaterByType(updater.type)
} else {
updater.updater = getUpdaterByFilename(updater.filename)
}
} catch (err) {
if (err.code !== 'ENOENT') console.warn(`Unable to obtain updater for: ${JSON.stringify(arg)}\n - Error: ${err.message}\n - Skipping...`)
}
} catch (err) {
if (err.code !== 'ENOENT') console.warn(`Unable to obtain updater for: ${JSON.stringify(arg)}\n - Error: ${err.message}\n - Skipping...`)
}
/**
* We weren't able to resolve an updater for the argument.
Expand Down

0 comments on commit 5eb8886

Please sign in to comment.