File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed
Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " solvenius" ,
3- "version" : " 4.0.1 " ,
3+ "version" : " 4.0.2 " ,
44 "description" : " Logic game in modern Elm" ,
55 "private" : true ,
66 "scripts" : {
2424 "url" : " https://github.com/giancosta86/solvenius/issues"
2525 },
2626 "devDependencies" : {
27+ "@types/semver" : " ^7.3.8" ,
2728 "clean-webpack-plugin" : " ^4.0.0-alpha.0" ,
2829 "copy-webpack-plugin" : " ^9.0.1" ,
2930 "css-loader" : " ^6.1.0" ,
4647 "webpack-dev-server" : " ^3.11.2" ,
4748 "webpack-merge" : " ^5.8.0" ,
4849 "workbox-webpack-plugin" : " ^6.1.5"
50+ },
51+ "dependencies" : {
52+ "semver" : " ^7.3.5"
4953 }
5054}
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { ElmApp } from "./ElmInterop";
22import { LocalStorageVar } from "./LocalStorageVar" ;
33import { Elm } from "../elm/Main.elm" ;
44import { ConditionalPlayer } from "./ConditionalPlayer" ;
5+ import SemVer from "semver/classes/semver" ;
56
67import pkg from "../../package.json" ;
78
@@ -17,6 +18,23 @@ type Flags = {
1718 version : string ;
1819} ;
1920
21+ function checkAppVersion ( ) {
22+ const previousVersionStorage = new LocalStorageVar < string > ( "previousVersion" ) ;
23+
24+ const previousVersion = new SemVer (
25+ previousVersionStorage . value ?? pkg . version
26+ ) ;
27+ const currentVersion = new SemVer ( pkg . version ) ;
28+
29+ if ( currentVersion . compare ( previousVersion ) == 1 ) {
30+ alert (
31+ `Solvenius just got an automatic update and is ready to run! ^__^\n\nYour new version: ${ currentVersion } `
32+ ) ;
33+ }
34+
35+ previousVersionStorage . value = currentVersion . format ( ) ;
36+ }
37+
2038function runApp ( ) : void {
2139 const topScoreStorage = new LocalStorageVar < Score > ( "topScore" ) ;
2240 const settingsStorage = new LocalStorageVar < Settings > ( "settings" ) ;
@@ -77,5 +95,6 @@ function registerServiceWorker(): void {
7795 }
7896}
7997
98+ checkAppVersion ( ) ;
8099registerServiceWorker ( ) ;
81100runApp ( ) ;
Original file line number Diff line number Diff line change 13421342 dependencies :
13431343 " @types/node" " *"
13441344
1345+ " @types/semver@^7.3.8 " :
1346+ version "7.3.8"
1347+ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.8.tgz#508a27995498d7586dcecd77c25e289bfaf90c59"
1348+ integrity sha512-D/2EJvAlCEtYFEYmmlGwbGXuK886HzyCc3nZX/tkFTQdEU8jZDAgiv08P162yB17y4ZXZoq7yFAnW4GDBb9Now==
1349+
13451350" @webassemblyjs/ast@1.11.1 " :
13461351 version "1.11.1"
13471352 resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7"
You can’t perform that action at this time.
0 commit comments