mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Upgrade Electron to v4 (#3329)
* Bumping electron to 3.0.10 * Updating node version in travis and appveyor * Fixing incorrect require of electron-fetch * Fix zoom to match previous versions Additionally I'm removing a call to disable pinch-zoom, it's disable by default since Electron 2 (https://electronjs.org/releases#2.0.0) * Bumping electron to 4.0.0-beta.8 * Bumping electron to 4.0.0-beta.9 * Work around for Copy accelerator not firing on electron v4 * Fixing header/titlebar in MacOS * Upgrading to electron 4.0.0 and node-pty 0.8.0 * Adding yarn.lock changes for electron 4.0.0 * Adding comments for editor:copy workaround. Scaling issue is only on Linux * Upgrading node-abi to support electron 4.0.0 * popup now takes an object as input
This commit is contained in:
parent
cba4c66a4b
commit
dd68286c5f
12 changed files with 807 additions and 356 deletions
|
|
@ -6,7 +6,7 @@ language: node_js
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: linux
|
- os: linux
|
||||||
node_js: 8
|
node_js: 10.11.0
|
||||||
env: CC=clang CXX=clang++ npm_config_clang=1
|
env: CC=clang CXX=clang++ npm_config_clang=1
|
||||||
compiler: clang
|
compiler: clang
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const fetch = require('electron-fetch');
|
const fetch = require('electron-fetch').default;
|
||||||
const {EventEmitter} = require('events');
|
const {EventEmitter} = require('events');
|
||||||
|
|
||||||
class AutoUpdater extends EventEmitter {
|
class AutoUpdater extends EventEmitter {
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,16 @@ const commands = {
|
||||||
webContents.openDevTools({mode: 'detach'});
|
webContents.openDevTools({mode: 'detach'});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'editor:copy': focusedWindow => {
|
||||||
|
// HACK: Had to add this because the "editor:copy" role is not firing with
|
||||||
|
// ctrl+shift+c after upgrading to electron 4
|
||||||
|
// Electron issue: https://github.com/electron/electron#16088
|
||||||
|
if (!focusedWindow) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const webContents = focusedWindow.webContents;
|
||||||
|
webContents.copy();
|
||||||
|
},
|
||||||
'zoom:reset': focusedWindow => {
|
'zoom:reset': focusedWindow => {
|
||||||
focusedWindow && focusedWindow.rpc.emit('reset fontSize req');
|
focusedWindow && focusedWindow.rpc.emit('reset fontSize req');
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="initial-scale=1.0">
|
<meta name="viewport" content="initial-scale=1.0">
|
||||||
|
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
const ms = require('ms');
|
const ms = require('ms');
|
||||||
const fetch = require('electron-fetch');
|
const fetch = require('electron-fetch').default;
|
||||||
|
|
||||||
const {version} = require('./package');
|
const {version} = require('./package');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,16 +14,16 @@
|
||||||
"color": "2.0.1",
|
"color": "2.0.1",
|
||||||
"convert-css-color-name-to-hex": "0.1.1",
|
"convert-css-color-name-to-hex": "0.1.1",
|
||||||
"default-shell": "1.0.1",
|
"default-shell": "1.0.1",
|
||||||
"electron-config": "1.0.0",
|
"electron-config": "2.0.0",
|
||||||
"electron-fetch": "1.1.0",
|
"electron-fetch": "1.3.0",
|
||||||
"electron-is-dev": "0.3.0",
|
"electron-is-dev": "1.0.1",
|
||||||
"electron-squirrel-startup": "1.0.0",
|
"electron-squirrel-startup": "1.0.0",
|
||||||
"file-uri-to-path": "1.0.0",
|
"file-uri-to-path": "1.0.0",
|
||||||
"git-describe": "4.0.2",
|
"git-describe": "4.0.2",
|
||||||
"lodash": "4.17.5",
|
"lodash": "4.17.5",
|
||||||
"mkdirp": "0.5.1",
|
"mkdirp": "0.5.1",
|
||||||
"ms": "2.1.1",
|
"ms": "2.1.1",
|
||||||
"node-pty": "0.7.4",
|
"node-pty": "0.8.0",
|
||||||
"os-locale": "2.1.0",
|
"os-locale": "2.1.0",
|
||||||
"parse-url": "3.0.2",
|
"parse-url": "3.0.2",
|
||||||
"queue": "4.4.2",
|
"queue": "4.4.2",
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ module.exports = class Window {
|
||||||
minWidth: 370,
|
minWidth: 370,
|
||||||
minHeight: 190,
|
minHeight: 190,
|
||||||
backgroundColor: toElectronBackgroundColor(cfg.backgroundColor || '#000'),
|
backgroundColor: toElectronBackgroundColor(cfg.backgroundColor || '#000'),
|
||||||
titleBarStyle: 'hidden-inset',
|
titleBarStyle: 'hiddenInset',
|
||||||
title: 'Hyper.app',
|
title: 'Hyper.app',
|
||||||
// we want to go frameless on Windows and Linux
|
// we want to go frameless on Windows and Linux
|
||||||
frame: process.platform === 'darwin',
|
frame: process.platform === 'darwin',
|
||||||
|
|
@ -201,7 +201,7 @@ module.exports = class Window {
|
||||||
buildFromTemplate(contextMenuTemplate(createWindow, selection)).popup(window);
|
buildFromTemplate(contextMenuTemplate(createWindow, selection)).popup(window);
|
||||||
});
|
});
|
||||||
rpc.on('open hamburger menu', ({x, y}) => {
|
rpc.on('open hamburger menu', ({x, y}) => {
|
||||||
Menu.getApplicationMenu().popup(Math.ceil(x), Math.ceil(y));
|
Menu.getApplicationMenu().popup({x: Math.ceil(x), y: Math.ceil(y)});
|
||||||
});
|
});
|
||||||
// Same deal as above, grabbing the window titlebar when the window
|
// Same deal as above, grabbing the window titlebar when the window
|
||||||
// is maximized on Windows results in unmaximize, without hitting any
|
// is maximized on Windows results in unmaximize, without hitting any
|
||||||
|
|
|
||||||
|
|
@ -100,21 +100,24 @@ dot-prop@^4.1.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
is-obj "^1.0.0"
|
is-obj "^1.0.0"
|
||||||
|
|
||||||
electron-config@1.0.0:
|
electron-config@2.0.0:
|
||||||
version "1.0.0"
|
version "2.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/electron-config/-/electron-config-1.0.0.tgz#069d044cc794f04784ae72f12916725d3c8c39af"
|
resolved "https://registry.yarnpkg.com/electron-config/-/electron-config-2.0.0.tgz#b00a7d55556d9c1aa59f5eec3bdf446c773425ff"
|
||||||
|
integrity sha512-5mGwRK4lsAo6tiy4KNF/zUInYpUGr7JJzLA8FHOoqBWV3kkKJWSrDXo4Uk2Ffm5aeQ1o73XuorfkYhaWFV2O4g==
|
||||||
dependencies:
|
dependencies:
|
||||||
conf "^1.0.0"
|
conf "^1.0.0"
|
||||||
|
|
||||||
electron-fetch@1.1.0:
|
electron-fetch@1.3.0:
|
||||||
version "1.1.0"
|
version "1.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/electron-fetch/-/electron-fetch-1.1.0.tgz#74b0ea547fe149620d38596a84fb104d34218e31"
|
resolved "https://registry.yarnpkg.com/electron-fetch/-/electron-fetch-1.3.0.tgz#00d9bb1fe7a66ddc3fea538910e01b26fee9abb5"
|
||||||
|
integrity sha512-WzHnWZqKdiCKHqqHu+GphezoWRSUVH6BQ/f13vu16VwYKJRZNt2dUrx40eZJcyZcDGn6RJDTAHS6jVoHoglgNw==
|
||||||
dependencies:
|
dependencies:
|
||||||
encoding "^0.1.12"
|
encoding "^0.1.12"
|
||||||
|
|
||||||
electron-is-dev@0.3.0:
|
electron-is-dev@1.0.1:
|
||||||
version "0.3.0"
|
version "1.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-0.3.0.tgz#14e6fda5c68e9e4ecbeff9ccf037cbd7c05c5afe"
|
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-1.0.1.tgz#6e0a184736fe7aea77d18210b0b0f6a02402c4bc"
|
||||||
|
integrity sha512-iwM3EotA9HTXqMGpQRkR/kT8OZqBbdfHTnlwcxsjSLYqY8svvsq0MuujsWCn3/vtgRmDv/PC/gKUUpoZvi5C1w==
|
||||||
|
|
||||||
electron-squirrel-startup@1.0.0:
|
electron-squirrel-startup@1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
|
|
@ -328,9 +331,10 @@ ms@2.1.1:
|
||||||
version "2.1.1"
|
version "2.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
|
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a"
|
||||||
|
|
||||||
nan@^2.6.2:
|
nan@2.10.0:
|
||||||
version "2.7.0"
|
version "2.10.0"
|
||||||
resolved "https://registry.yarnpkg.com/nan/-/nan-2.7.0.tgz#d95bf721ec877e08db276ed3fc6eb78f9083ad46"
|
resolved "https://registry.yarnpkg.com/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f"
|
||||||
|
integrity sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==
|
||||||
|
|
||||||
node-fetch@^1.0.1:
|
node-fetch@^1.0.1:
|
||||||
version "1.7.3"
|
version "1.7.3"
|
||||||
|
|
@ -339,11 +343,12 @@ node-fetch@^1.0.1:
|
||||||
encoding "^0.1.11"
|
encoding "^0.1.11"
|
||||||
is-stream "^1.0.1"
|
is-stream "^1.0.1"
|
||||||
|
|
||||||
node-pty@0.7.4:
|
node-pty@0.8.0:
|
||||||
version "0.7.4"
|
version "0.8.0"
|
||||||
resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-0.7.4.tgz#07146b2b40b76e432e57ce6750bda40f0da5c99f"
|
resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-0.8.0.tgz#08bccb633f49e2e3f7245eb56ea6b40f37ccd64f"
|
||||||
|
integrity sha512-g5ggk3gN4gLrDmAllee5ScFyX3YzpOC/U8VJafha4pE7do0TIE1voiIxEbHSRUOPD1xYqmY+uHhOKAd3avbxGQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
nan "^2.6.2"
|
nan "2.10.0"
|
||||||
|
|
||||||
normalize-url@^1.9.1:
|
normalize-url@^1.9.1:
|
||||||
version "1.9.1"
|
version "1.9.1"
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ init:
|
||||||
- yarn config set msvs_version 2015 # we need this to build `pty.js`
|
- yarn config set msvs_version 2015 # we need this to build `pty.js`
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- ps: Install-Product node 8 x64
|
- ps: Install-Product node 10.11.0 x64
|
||||||
- set CI=true
|
- set CI=true
|
||||||
- yarn
|
- yarn
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,11 @@ import {loadConfig, reloadConfig} from './actions/config';
|
||||||
import HyperContainer from './containers/hyper';
|
import HyperContainer from './containers/hyper';
|
||||||
import configureStore from './store/configure-store';
|
import configureStore from './store/configure-store';
|
||||||
|
|
||||||
// Disable pinch zoom
|
// On Linux, the default zoom was somehow changed with Electron 3 (or maybe 2).
|
||||||
webFrame.setZoomLevelLimits(1, 1);
|
// Setting zoom factor to 1.2 brings back the normal default size
|
||||||
|
if (process.platform === 'linux') {
|
||||||
|
webFrame.setZoomFactor(1.2);
|
||||||
|
}
|
||||||
|
|
||||||
const store_ = configureStore();
|
const store_ = configureStore();
|
||||||
|
|
||||||
|
|
|
||||||
10
package.json
10
package.json
|
|
@ -218,11 +218,11 @@
|
||||||
"babel-preset-react": "6.24.1",
|
"babel-preset-react": "6.24.1",
|
||||||
"copy-webpack-plugin": "4.3.1",
|
"copy-webpack-plugin": "4.3.1",
|
||||||
"cross-env": "5.1.4",
|
"cross-env": "5.1.4",
|
||||||
"electron": "1.8.8",
|
"electron": "4.0.0",
|
||||||
"electron-builder": "20.5.1",
|
"electron-builder": "20.38.2",
|
||||||
"electron-builder-squirrel-windows": "20.5.0",
|
"electron-builder-squirrel-windows": "20.38.2",
|
||||||
"electron-devtools-installer": "2.2.3",
|
"electron-devtools-installer": "2.2.4",
|
||||||
"electron-rebuild": "1.7.3",
|
"electron-rebuild": "1.8.2",
|
||||||
"eslint": "4.7.2",
|
"eslint": "4.7.2",
|
||||||
"eslint-config-prettier": "2.6.0",
|
"eslint-config-prettier": "2.6.0",
|
||||||
"eslint-plugin-prettier": "2.3.1",
|
"eslint-plugin-prettier": "2.3.1",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue