From 6face07759cd3a65e79a2d35641dff606b430729 Mon Sep 17 00:00:00 2001 From: Robbie Antenesse Date: Wed, 2 Dec 2020 09:51:57 -0700 Subject: [PATCH] Bump version; Add semver to compare versions better --- package.json | 3 ++- src/App.js | 4 +++- yarn.lock | 7 +++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d5f912a..8375073 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "google-photos-export-organizer", "description": "A tool for merging and organizing exported Google Photos backups.", - "version": "1.0.1", + "version": "1.1.0", "private": true, "main": "public/electron.js", "author": { @@ -45,6 +45,7 @@ "react": "^17.0.1", "react-dom": "^17.0.1", "react-scripts": "4.0.1", + "semver": "^7.3.4", "unzipper": "^0.10.11", "utimes": "^4.0.2", "web-vitals": "^1.0.1" diff --git a/src/App.js b/src/App.js index 97bdd82..9855be5 100644 --- a/src/App.js +++ b/src/App.js @@ -1,4 +1,5 @@ import React from 'react'; +import semverLt from 'semver/functions/lt'; import packageDetails from '../package.json'; import { APP_URL, NAV_ITEMS } from './constants'; @@ -32,7 +33,8 @@ class App extends React.Component { }), }).then((response) => response.json()) .then((release) => { - if (typeof release.tag_name !== 'undefined' && release.tag_name > packageDetails.version) { + // If current version is less than latest release version, notify + if (typeof release.tag_name !== 'undefined' && semverLt(packageDetails.version, release.tag_name)) { this.setState({ newVersion: true }); } }) diff --git a/yarn.lock b/yarn.lock index 8eee881..2c61744 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10745,6 +10745,13 @@ semver@^6.0.0, semver@^6.2.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^7.3.4: + version "7.3.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.4.tgz#27aaa7d2e4ca76452f98d3add093a72c943edc97" + integrity sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw== + dependencies: + lru-cache "^6.0.0" + send@0.17.1: version "0.17.1" resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8"