diff --git a/README.md b/README.md index a35f97af9af26cf1b15b201f9ca9d4b8422fd78d..689333bf17a1cdec694968a1d657aba10193be03 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Fether Wallet +## Get the latest binary + +https://github.com/parity-js/fether/releases + ## Getting started ```bash diff --git a/packages/fether-electron/package.json b/packages/fether-electron/package.json index f45e526eeaf959867cebd68d27678b9dcb00bb29..e7c238db6c9b95baa8c8898f1d44ec9dc2638e32 100644 --- a/packages/fether-electron/package.json +++ b/packages/fether-electron/package.json @@ -32,7 +32,9 @@ "build": "electron-webpack", "electron": "electron dist/main/main.js --light", "lint": "semistandard 'src/**/*.js' --parser babel-eslint", + "prepackage": "./scripts/revertElectronBug.sh", "package": "electron-builder", + "prerelease": "./scripts/revertElectronBug.sh", "release": "electron-builder", "start": "cross-env ELECTRON_START_URL=http://localhost:3000 electron-webpack dev --light --ws-origins all", "test": "echo Skipped." diff --git a/packages/fether-electron/scripts/revertElectronBug.sh b/packages/fether-electron/scripts/revertElectronBug.sh new file mode 100755 index 0000000000000000000000000000000000000000..dad995d8826aba3c815347d1a205475d50047e38 --- /dev/null +++ b/packages/fether-electron/scripts/revertElectronBug.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# This is the revert patch from ./fixElectronBug.sh +FIND='"${path.join(configurator.projectDir, "static").replace(\/\\\\\/g, "\\\\\\\\")}"' +REPLACE='process.resourcesPath + "\/static"' +FILE='./node_modules/electron-webpack/out/targets/MainTarget.js' +case "$OSTYPE" in + darwin*) sed -i '.bak' "s/$FIND/$REPLACE/g" $FILE ;; + *) sed -i "s/$FIND/$REPLACE/g" $FILE ;; +esac diff --git a/packages/fether-electron/src/main/index.js b/packages/fether-electron/src/main/index.js index 24624ee08ef4447d30d3c03a14188a6aaa679057..f9214df4ea952f2467599a3e6f0c389b80a43316 100644 --- a/packages/fether-electron/src/main/index.js +++ b/packages/fether-electron/src/main/index.js @@ -3,8 +3,6 @@ // // SPDX-License-Identifier: BSD-3-Clause -/* global __static */ - import electron from 'electron'; import path from 'path'; import url from 'url'; @@ -17,6 +15,7 @@ import messages from './messages'; import { productName } from '../../electron-builder.json'; import Pino from './utils/pino'; import { runParity, killParity } from './operations/runParity'; +import staticPath from './utils/staticPath'; const { app, BrowserWindow, ipcMain, session } = electron; let mainWindow; @@ -39,7 +38,7 @@ function createWindow () { mainWindow.loadURL( process.env.ELECTRON_START_URL || url.format({ - pathname: path.join(__static, 'build', 'index.html'), + pathname: path.join(staticPath, 'build', 'index.html'), protocol: 'file:', slashes: true }) diff --git a/packages/fether-electron/src/main/utils/staticPath.js b/packages/fether-electron/src/main/utils/staticPath.js new file mode 100644 index 0000000000000000000000000000000000000000..677d7bc90beb5706d2d227d361280d4fdc8dc199 --- /dev/null +++ b/packages/fether-electron/src/main/utils/staticPath.js @@ -0,0 +1,19 @@ +// Copyright 2015-2018 Parity Technologies (UK) Ltd. +// This file is part of Parity. +// +// SPDX-License-Identifier: BSD-3-Clause + +/* global __static */ + +const isDevelopment = process.env.NODE_ENV === 'development'; + +/** + * Get the path to the `static` folder. + * + * @see https://github.com/electron-userland/electron-webpack/issues/52 + */ +const staticPath = isDevelopment + ? __static + : __dirname.replace(/app\.asar$/, 'static'); + +export default staticPath;