diff --git a/packaging/linux/build_binaries.sh b/packaging/linux/build_binaries.sh index 9842c5dd33c0..32ca2d2af79d 100755 --- a/packaging/linux/build_binaries.sh +++ b/packaging/linux/build_binaries.sh @@ -138,7 +138,7 @@ build_one_architecture() { echo "Building Electron client for $electron_arch..." ( cd "$this_repo/shared" - yarn run package -- --platform linux --arch "$electron_arch" --appVersion "$version" --network-concurrency 8 + yarn run package -- --platform=linux --arch="$electron_arch" --appVersion="$version" --network-concurrency=8 rsync -a "desktop/release/linux-${electron_arch}/Keybase-linux-${electron_arch}/" \ "$layout_dir/opt/keybase" chmod 755 "$layout_dir/opt/keybase" diff --git a/packaging/windows/buildui.cmd b/packaging/windows/buildui.cmd index 93a23f0cd69b..fa54b167283d 100644 --- a/packaging/windows/buildui.cmd +++ b/packaging/windows/buildui.cmd @@ -13,7 +13,7 @@ IF %ERRORLEVEL% NEQ 0 ( EXIT /B 1 ) -cmd /C yarn run package --arch x64 --platform win32 --appVersion %KEYBASE_VERSION% --icon %GOPATH%\src\github.com\keybase\client\media\icons\Keybase.ico +cmd /C yarn run package --arch=x64 --platform=win32 --appVersion=%KEYBASE_VERSION% --icon=%GOPATH%\src\github.com\keybase\client\media\icons\Keybase.ico IF %ERRORLEVEL% NEQ 0 ( EXIT /B 1 ) diff --git a/shared/desktop/app/main-window.desktop.tsx b/shared/desktop/app/main-window.desktop.tsx index 32998e68f77a..5bbde2c7fe95 100644 --- a/shared/desktop/app/main-window.desktop.tsx +++ b/shared/desktop/app/main-window.desktop.tsx @@ -87,6 +87,7 @@ const setupWindowEvents = (win: Electron.BrowserWindow) => { const changeDock = (show: boolean) => { const dock = Electron.app.dock + if (!dock) return if (show) { dock .show() diff --git a/shared/desktop/app/menu-bar.desktop.tsx b/shared/desktop/app/menu-bar.desktop.tsx index c03dd819c947..82dc53a0ec00 100644 --- a/shared/desktop/app/menu-bar.desktop.tsx +++ b/shared/desktop/app/menu-bar.desktop.tsx @@ -112,7 +112,7 @@ const MenuBar = () => { badges = action.payload.desktopAppBadgeCount updateIcon() const dock = Electron.app.dock - if (dock.isVisible()) { + if (dock?.isVisible()) { Electron.app.badgeCount = action.payload.desktopAppBadgeCount } diff --git a/shared/desktop/app/node2.desktop.tsx b/shared/desktop/app/node2.desktop.tsx index d4dfb45fd1da..b6380bfae216 100644 --- a/shared/desktop/app/node2.desktop.tsx +++ b/shared/desktop/app/node2.desktop.tsx @@ -215,7 +215,7 @@ const handleActivate = () => { mainWindow?.show() const dock = Electron.app.dock dock - .show() + ?.show() .then(() => {}) .catch(() => {}) } diff --git a/shared/desktop/package.desktop.tsx b/shared/desktop/package.desktop.tsx index 728804436fba..6916c749140f 100644 --- a/shared/desktop/package.desktop.tsx +++ b/shared/desktop/package.desktop.tsx @@ -85,10 +85,11 @@ const platform = argv.platform || os.platform() const appVersion = argv.appVersion || '0.0.0' const comment = argv.comment const outDir = argv.outDir -const icon = argv.icon const saltpackIcon = argv.saltpackIcon -const appCopyright = 'Copyright (c) 2022, Keybase' +const appCopyright = 'Copyright (c) 2024, Keybase' const companyName = 'Keybase, Inc.' +const electronVersion = require('../package.json').devDependencies.electron +console.log('Found electron version:', electronVersion) const packagerOpts: Options = { appBundleId: 'keybase.Electron', @@ -99,7 +100,7 @@ const packagerOpts: Options = { darwinDarkModeSupport: true, dir: desktopPath('./build'), download: {checksums: electronChecksums}, - electronVersion: undefined, + electronVersion, // macOS file association to saltpack files extendInfo: { CFBundleDocumentTypes: [ @@ -126,17 +127,24 @@ const packagerOpts: Options = { ], }, // Any paths placed here will be moved to the final bundle - extraResource: [] as Array, + extraResource: saltpackIcon ? [saltpackIcon] : undefined, helperBundleId: 'keybase.ElectronHelper', - icon: undefined, + icon: argv.icon, ignore: [/\.map/, /\/test($|\/)/, /\/tools($|\/)/, /\/release($|\/)/, /\/node_modules($|\/)/], name: appName, protocols: [ { name: 'Keybase', - schemes: ['keybase', 'web+stellar'], + schemes: ['keybase'], }, ], + prune: true, +} + +if (!packagerOpts.extraResource?.[0]) { + console.warn( + `Missing 'saltpack.icns' from yarn package arguments. Need an icon to associate ".saltpack" files with Electron on macOS, Windows, and Linux.` + ) } async function main() { @@ -166,28 +174,6 @@ async function main() { version: appVersion, }) - if (icon) { - packagerOpts.icon = icon - } - - if (saltpackIcon) { - packagerOpts.extraResource = [saltpackIcon] - } else { - console.warn( - `Missing 'saltpack.icns' from yarn package arguments. Need an icon to associate ".saltpack" files with Electron on macOS, Windows, and Linux.` - ) - } - - // use the same version as the currently-installed electron - console.log('Finding electron version') - try { - packagerOpts.electronVersion = require('../package.json').devDependencies.electron - console.log('Found electron version:', packagerOpts.electronVersion) - } catch (err) { - console.log("Couldn't parse yarn list to find electron:", err) - process.exit(1) - } - try { await startPack() } catch (err) { @@ -256,7 +242,6 @@ async function pack(plat: string, arch: string) { arch, out: packageOutDir, platform: plat, - prune: true, ...(plat === 'win32' ? { 'version-string': { @@ -268,6 +253,7 @@ async function pack(plat: string, arch: string) { } : null), } + console.log('Building using options', opts) const ret = await packager(opts) // sometimes returns bools, unclear why diff --git a/shared/patches/electron+27.1.2.patch b/shared/patches/electron+27.1.2.patch new file mode 100644 index 000000000000..7dd3726e4816 --- /dev/null +++ b/shared/patches/electron+27.1.2.patch @@ -0,0 +1,13 @@ +diff --git a/node_modules/electron/electron.d.ts b/node_modules/electron/electron.d.ts +index eedb19d..fe8e946 100644 +--- a/node_modules/electron/electron.d.ts ++++ b/node_modules/electron/electron.d.ts +@@ -1539,7 +1539,7 @@ declare namespace Electron { + * + * @platform darwin + */ +- readonly dock: Dock; ++ readonly dock: Dock | undefined; + /** + * A `boolean` property that returns `true` if the app is packaged, `false` + * otherwise. For many apps, this property can be used to distinguish development