Commit e4313af5 authored by antoor's avatar antoor

The optimized version comparison algorithm

优化版本对比算法
parent df7ad286
...@@ -29,14 +29,17 @@ class Update { ...@@ -29,14 +29,17 @@ class Update {
let newVersion = lastInfo['tag_name']; let newVersion = lastInfo['tag_name'];
let curVersion = config['package'].version; let curVersion = config['package'].version;
// 比对版本 // 比对版本
if (curVersion !== newVersion) { if (
parseInt(newVersion.replace(/\./g, '')) >
parseInt(curVersion.replace(/\./g, ''))
) {
this.logger.info('Found a new version', newVersion); this.logger.info('Found a new version', newVersion);
event.sender.send('notification-update', { event.sender.send('notification-update', {
ver: newVersion, ver: newVersion,
url: lastInfo['html_url'] url: lastInfo['html_url']
}); });
} else { } else {
this.logger.warn('No new version.'); this.logger.warn('No new version.', newVersion, curVersion);
} }
} catch(e) { } catch(e) {
this.logger.fatal('ERR', e); this.logger.fatal('ERR', e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment