diff --git a/electron-builder.yml b/electron-builder.yml index ef2409b..45c839a 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -1,14 +1,19 @@ appId: "io.nicco.app.unpixel" -# productName: "UnPixel" files: - assets - dist directories: output: "./out" mac: - target: "dmg" + target: + - dmg + - zip identity: null win: - target: "nsis" + target: nsis linux: - category: "Utility" \ No newline at end of file + category: "Utility" + target: + - AppImage + - deb + - snap \ No newline at end of file diff --git a/package.json b/package.json index f534b5b..f3d1b83 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "repository": { "url": "https://github.com/cupcakearmy/unpixel" }, - "version": "1.0.2", + "version": "1.0.3", "main": "./dist/back/index.js", "scripts": { "start": "electron .", @@ -56,6 +56,7 @@ "@types/auto-launch": "^5.0.1", "@types/react": "^17.0.3", "@types/react-dom": "^17.0.3", + "@types/semver": "^7.3.4", "electron": "^12.0.0", "electron-builder": "^22.10.5", "npm-run-all": "^4.1.5", diff --git a/src/back/tray.ts b/src/back/tray.ts index 7ef28b8..12ab554 100644 --- a/src/back/tray.ts +++ b/src/back/tray.ts @@ -30,7 +30,7 @@ export default class TrayUtility { static setStatus(status: string) { this.menu[0].label = status - this.tray.setContextMenu(this.build()) + this.tray?.setContextMenu(this.build()) } private static build() { diff --git a/src/back/updater.ts b/src/back/updater.ts index e5d93cf..81a496a 100644 --- a/src/back/updater.ts +++ b/src/back/updater.ts @@ -20,8 +20,9 @@ export default class Updater { url, }) // parse tags and reverse sort them to get the highest - const tags = data.map((d) => semver.coerce(d.name)).sort(semver.rcompare) + const tags = data.map((d: any) => semver.coerce(d.name)).sort(semver.rcompare) const latest = tags[0] + if (!current) throw new Error('Could not determine current version') if (semver.lt(current, latest)) { logger.info('New version available') dialog diff --git a/src/front/banner/index.tsx b/src/front/banner/index.tsx index 4ff92f9..15a06d8 100644 --- a/src/front/banner/index.tsx +++ b/src/front/banner/index.tsx @@ -7,15 +7,17 @@ import { render } from 'react-dom' // @ts-ignore import chime from 'url:../assets/chime.mp3' -const useKeyPress = (handler) => { - const handlerRef = useRef<(e: KeyboardEvent) => void>() +const useKeyPress = (handler: (e: KeyboardEvent) => void) => { + const handlerRef = useRef() useEffect(() => { handlerRef.current = handler }, [handler]) useEffect(() => { - const fn = (event) => handlerRef.current(event) + const fn = (event: KeyboardEvent) => { + if (handlerRef.current) handlerRef.current(event) + } window.addEventListener('keydown', fn) return () => { window.removeEventListener('keydown', fn) diff --git a/src/front/base.css b/src/front/base.css index 8ad7f0f..7ea6f3c 100644 --- a/src/front/base.css +++ b/src/front/base.css @@ -1,4 +1,3 @@ -/* @import 'hiq/dist/hiq.css'; */ @import 'spectre.css/dist/spectre.min.css'; @import 'tachyons/css/tachyons.min.css'; diff --git a/src/front/settings/About.tsx b/src/front/settings/About.tsx index fb35228..a527203 100644 --- a/src/front/settings/About.tsx +++ b/src/front/settings/About.tsx @@ -1,4 +1,4 @@ -import React, { useCallback } from 'react' +import React from 'react' import Link from './ExternalLink' diff --git a/tsconfig.json b/tsconfig.json index d713675..6fa88f1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,7 @@ // "lib": [], /* Specify library files to be included in the compilation. */ // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + "jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */, // "declaration": true, /* Generates corresponding '.d.ts' file. */ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ diff --git a/yarn.lock b/yarn.lock index 8b0a892..2b2ccf7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1665,6 +1665,11 @@ resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.1.tgz#18845205e86ff0038517aab7a18a62a6b9f71275" integrity sha512-EaCxbanVeyxDRTQBkdLb3Bvl/HK7PBK6UJjsSixB0iHKoWxE5uu2Q/DgtpOhPIojN0Zl1whvOd7PoHs2P0s5eA== +"@types/semver@^7.3.4": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.4.tgz#43d7168fec6fa0988bb1a513a697b29296721afb" + integrity sha512-+nVsLKlcUCeMzD2ufHEYuJ9a2ovstb6Dp52A5VsoKxDXgvE051XgHI/33I1EymwkRGQkwnA0LkhnUzituGs4EQ== + "@types/verror@^1.10.3": version "1.10.4" resolved "https://registry.yarnpkg.com/@types/verror/-/verror-1.10.4.tgz#805c0612b3a0c124cf99f517364142946b74ba3b"