Commit e4313af5 authored by antoor's avatar antoor

The optimized version comparison algorithm

优化版本对比算法
parent df7ad286
......@@ -29,14 +29,17 @@ class Update {
let newVersion = lastInfo['tag_name'];
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);
event.sender.send('notification-update', {
ver: newVersion,
url: lastInfo['html_url']
});
} else {
this.logger.warn('No new version.');
this.logger.warn('No new version.', newVersion, curVersion);
}
} catch(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