Skip to content

Commit

Permalink
Merge pull request #98 from Watson1978/electron-6
Browse files Browse the repository at this point in the history
Update Electron to v6.0
  • Loading branch information
h13i32maru committed Aug 25, 2019
2 parents b5be9a8 + 9549115 commit 8826f71
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 23 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@
"react-dom": "16.4.2",
"request": "2.88.0",
"semver": "5.5.1",
"sqlite3": "^4.0.4",
"sqlite3": "^4.1.0",
"uuid": "3.3.2"
},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-plugin-transform-es2015-modules-commonjs": "6.26.2",
"babel-preset-react": "6.24.1",
"babel-register": "6.26.0",
"electron": "4.0.4",
"electron-packager": "13.0.1",
"electron": "6.0.3",
"electron-packager": "14.0.4",
"esdoc": "latest",
"esdoc-jsx-plugin": "latest",
"esdoc-standard-plugin": "latest"
Expand Down
6 changes: 3 additions & 3 deletions script/linux/build-sqlite3.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
cd ./node_modules/sqlite3
npm i nan@2.10.0
npm i nan@2.14.0
npm i node-pre-gyp@0.10.1
npm i -g node-gyp@3.8.0
node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/electron-v4.0-linux-x64
node-gyp rebuild --target=4.0.4 --arch=x64 --target_platform=linux --dist-url=https://atom.io/download/electron --module_name=node_sqlite3 --module_path=../lib/binding/electron-v4.0-linux-x64
node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/electron-v6.0-linux-x64
node-gyp rebuild --target=6.0.3 --arch=x64 --target_platform=linux --dist-url=https://atom.io/download/electron --module_name=node_sqlite3 --module_path=../lib/binding/electron-v6.0-linux-x64
2 changes: 1 addition & 1 deletion script/linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rm -rf ./out/build
./script/build-js.sh

# electron requires electron-vX.Y-linux-x64 of sqlite3
cp -a ./node_modules/sqlite3/lib/binding/electron-v4.0-linux-x64 ./out/js/node_modules/sqlite3/lib/binding/
cp -a ./node_modules/sqlite3/lib/binding/electron-v6.0-linux-x64 ./out/js/node_modules/sqlite3/lib/binding/

# build app with electron-packager
VERSION=$(grep version package.json | head -n 1 | cut -f 2 -d : | \sed 's/[",]//g')
Expand Down
6 changes: 3 additions & 3 deletions script/mac/build-sqlite3.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
cd ./node_modules/sqlite3
npm i nan@2.10.0
npm i nan@2.14.0
npm i node-pre-gyp@0.10.1
npm i -g node-gyp@3.8.0
node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/electron-v4.0-darwin-x64
node-gyp rebuild --target=4.0.4 --arch=x64 --target_platform=darwin --dist-url=https://atom.io/download/electron --module_name=node_sqlite3 --module_path=../lib/binding/electron-v4.0-darwin-x64
node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/electron-v6.0-darwin-x64
node-gyp rebuild --target=6.0.3 --arch=x64 --target_platform=darwin --dist-url=https://atom.io/download/electron --module_name=node_sqlite3 --module_path=../lib/binding/electron-v6.0-darwin-x64
2 changes: 1 addition & 1 deletion script/mac/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ iconutil -c icns ./misc/logo/jasper.iconset --output ./misc/logo/jasper.icns
./script/build-js.sh

# electron requires electron-vX.Y-darwin-x64 of sqlite3
cp -a ./node_modules/sqlite3/lib/binding/electron-v4.0-darwin-x64 ./out/js/node_modules/sqlite3/lib/binding/
cp -a ./node_modules/sqlite3/lib/binding/electron-v6.0-darwin-x64 ./out/js/node_modules/sqlite3/lib/binding/

# build app with electron-packager
VERSION=$(grep version package.json | head -n 1 | cut -f 2 -d : | \sed 's/[",]//g')
Expand Down
6 changes: 3 additions & 3 deletions script/win/build-sqlite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# Windowsマークを右クリック -> システム -> システムの詳細設定 -> 環境変数 -> C:\Python27

cd ./node_modules/sqlite3
npm i nan@2.10.0
npm i nan@2.14.0
npm i node-pre-gyp@0.10.1
npm i -g node-gyp@3.8.0
node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/electron-v4.0-win32-x64
node-gyp rebuild --msvs_version=2015 --target=4.0.4 --arch=x64 --target_platform=win32 --dist-url=https://atom.io/download/electron --module_name=node_sqlite3 --module_path=../lib/binding/electron-v4.0-win32-x64
node-gyp configure --module_name=node_sqlite3 --module_path=../lib/binding/electron-v6.0-win32-x64
node-gyp rebuild --msvs_version=2015 --target=6.0.3 --arch=x64 --target_platform=win32 --dist-url=https://atom.io/download/electron --module_name=node_sqlite3 --module_path=../lib/binding/electron-v6.0-win32-x64
2 changes: 1 addition & 1 deletion script/win/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rm -rf ./out/build
./script/build-js.sh

# electron requires electron-vX.Y-win32-x64 of sqlite3
cp -a ./node_modules/sqlite3/lib/binding/electron-v4.0-win32-x64 ./out/js/node_modules/sqlite3/lib/binding/
cp -a ./node_modules/sqlite3/lib/binding/electron-v6.0-win32-x64 ./out/js/node_modules/sqlite3/lib/binding/

# build app with electron-packager
VERSION=$(grep version package.json | head -n 1 | cut -f 2 -d : | \sed 's/[",]//g')
Expand Down
14 changes: 10 additions & 4 deletions src/BrowserViewProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ export default class BrowserViewProxy {
global.mainWindow.webContents.focus();
}

static titleBarHeight() {
return global.mainWindow.getSize()[1] - global.mainWindow.getContentSize()[1]
}

static executeJavaScript(js) {
return this._webContents.executeJavaScript(js);
}
Expand All @@ -92,19 +96,21 @@ export default class BrowserViewProxy {
if (Platform.isWin()) height -= 35; // menu bar height?
if (Platform.isLinux()) height += 22; // menu bar height?

const titleBar = this.titleBarHeight();

if (this._layout === layout) {
this.setBounds({x: 521, y: 43, width: width - 521, height: height - 43 - 40});
this.setBounds({x: 521, y: 43 + titleBar, width: width - 521, height: height - 43 - 40});
this._layout = null;
} else {
switch (layout) {
case 'single':
this.setBounds({x: 1, y: 43, width: width - 1, height: height - 43 - 40});
this.setBounds({x: 1, y: 43 + titleBar, width: width - 1, height: height - 43 - 40});
break;
case 'two':
this.setBounds({x: 301, y: 43, width: width - 301, height: height - 43 - 40});
this.setBounds({x: 301, y: 43 + titleBar, width: width - 301, height: height - 43 - 40});
break;
case 'three':
this.setBounds({x: 521, y: 43, width: width - 521, height: height - 43 - 40});
this.setBounds({x: 521, y: 43 + titleBar, width: width - 521, height: height - 43 - 40});
break;
}
this._layout = layout;
Expand Down
24 changes: 20 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ electron.app.on('will-finish-launching', () => {
});

electron.app.on('ready', function() {
const config = {width: 1280, height: 900, title: 'Jasper'};
const config = {
width: 1280,
height: 900,
title: 'Jasper',
webPreferences: {
nodeIntegration: true
}
};
if (Platform.isLinux()) config.icon = `${__dirname}/Electron/image/icon.png`;
global.mainWindow = mainWindow = new electron.BrowserWindow(config);

Expand Down Expand Up @@ -480,7 +487,10 @@ function showPreferences() {
fullscreenable: false,
resizable: false,
show: false,
parent: mainWindow
parent: mainWindow,
webPreferences: {
nodeIntegration: true
}
});
prefWindow.loadURL(`file://${__dirname}/Electron/html/preferences/preferences.html`);
ipcMain.once('fonts-ready', ()=>{
Expand Down Expand Up @@ -649,7 +659,10 @@ function showLogs() {
maximizable: false,
fullscreenable: false,
backgroundColor: "#e7e7e7",
parent: mainWindow
parent: mainWindow,
webPreferences: {
nodeIntegration: true
}
});
logsWindow.loadURL(`file://${__dirname}/Electron/html/logs/logs.html`);
logsWindow.on('closed', ()=>{
Expand All @@ -675,7 +688,10 @@ function showAbout() {
fullscreenable: false,
resizable: false,
show: false,
parent: mainWindow
parent: mainWindow,
webPreferences: {
nodeIntegration: true
}
});

const version = electron.app.getVersion();
Expand Down

0 comments on commit 8826f71

Please sign in to comment.