Skip to content

Commit

Permalink
Merge pull request #386 from Cryptonomic/develop
Browse files Browse the repository at this point in the history
Develop to master
  • Loading branch information
vishakh authored Sep 4, 2018
2 parents 491dd7f + 394a196 commit 941431a
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 11 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions app/utils/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export function createIl8nInstance(locale) {
debug: true,
backend: {
loadPath: () => {
const filename = `../extraResources/locales/{{lng}}.json`;
const filename = `extraResources/locales/{{lng}}.json`;
if (process.env.NODE_ENV === 'production') {
return path.join(remote.app.getAppPath(), filename);
return path.join(remote.app.getAppPath(), 'dist',filename);
}
return path.join(__dirname, filename);
}
Expand Down
4 changes: 2 additions & 2 deletions app/utils/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import path from 'path';
import fs from 'fs';

const fileName = 'walletSettings.json';
let filePath = path.join(__dirname, '../extraResources/', fileName);
let filePath = path.join(__dirname, 'extraResources/', fileName);
if (process.env.NODE_ENV === 'production') {
filePath = path.join(remote.app.getAppPath(), '../extraResources/', fileName);
filePath = path.join(remote.app.getAppPath(), 'dist', 'extraResources/', fileName);
}

export function getWalletSettings() {
Expand Down
4 changes: 2 additions & 2 deletions app/utils/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { TezosWallet } from 'conseiljs';
const { saveWallet, loadWallet } = TezosWallet;

const fileName = 'walletState';
let walletStatePath = path.join(__dirname, '../extraResources/', fileName);
let walletStatePath = path.join(__dirname, 'extraResources/', fileName);
if (process.env.NODE_ENV === 'production') {
walletStatePath = path.join(remote.app.getAppPath(), '../extraResources/', fileName);
walletStatePath = path.join(remote.app.getAppPath(), 'dist', 'extraResources/', fileName);
}

export async function saveUpdatedWallet(identities, walletLocation, walletFileName, password) {
Expand Down
16 changes: 15 additions & 1 deletion internals/scripts/CheckWalletStateExist.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from 'fs';
* Hacky solution to solve permission issues with linux
* */
const fileName = 'walletState';
const walletStatePath = path.join(__dirname, '../../extraResources/', fileName);
const walletStatePath = path.join(__dirname, '../../app/extraResources/', fileName);
if (fs.existsSync(walletStatePath)) {
fs.unlinkSync(walletStatePath);
}
Expand All @@ -15,3 +15,17 @@ fs.writeFileSync(
Buffer.from(JSON.stringify({}), 'binary')
);
fs.chmodSync(walletStatePath, 511);

const walletSettings = 'walletSettings.json';
const walletSettingsPath = path.join(__dirname, '../../app/extraResources/', walletSettings);
let walletSettingsContent = '';
if (fs.existsSync(walletSettingsPath)) {
walletSettingsContent = fs.readFileSync(walletSettingsPath);
fs.unlinkSync(walletSettingsPath);
}

fs.writeFileSync(
walletSettingsPath,
Buffer.from(walletSettingsContent)
);
fs.chmodSync(walletSettingsPath, 511);
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
"build": {
"productName": "Tezori",
"appId": "tech.cryptonomic.Tezori",
"extraResources": [
"./extraResources/**/*"
],
"files": [
"dist/",
"node_modules/",
Expand Down Expand Up @@ -141,6 +138,7 @@
"babel-register": "^6.26.0",
"chalk": "^2.4.1",
"concurrently": "^3.5.1",
"copy-webpack-plugin": "^4.5.2",
"cross-env": "^5.1.6",
"cross-spawn": "^6.0.5",
"css-loader": "^0.28.11",
Expand Down
15 changes: 14 additions & 1 deletion webpack.config.renderer.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import merge from 'webpack-merge';
import UglifyJSPlugin from 'uglifyjs-webpack-plugin';
import baseConfig from './webpack.config.base';
import CheckNodeEnv from './internals/scripts/CheckNodeEnv';
import CopyWebpackPlugin from 'copy-webpack-plugin';

CheckNodeEnv('production');

Expand Down Expand Up @@ -179,6 +180,18 @@ export default merge.smart(baseConfig, {
analyzerMode:
process.env.OPEN_ANALYZER === 'true' ? 'server' : 'disabled',
openAnalyzer: process.env.OPEN_ANALYZER === 'true'
})
}),

new CopyWebpackPlugin(
[
{
from: 'app/extraResources/',
to: 'extraResources',
toType: 'dir'
}
],
{}
)

]
});
30 changes: 30 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2837,6 +2837,19 @@ copy-descriptor@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"

copy-webpack-plugin@^4.5.2:
version "4.5.2"
resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-4.5.2.tgz#d53444a8fea2912d806e78937390ddd7e632ee5c"
dependencies:
cacache "^10.0.4"
find-cache-dir "^1.0.0"
globby "^7.1.1"
is-glob "^4.0.0"
loader-utils "^1.1.0"
minimatch "^3.0.4"
p-limit "^1.0.0"
serialize-javascript "^1.4.0"

core-js@^1.0.0:
version "1.2.7"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636"
Expand Down Expand Up @@ -5127,6 +5140,17 @@ globby@^6.0.0, globby@^6.1.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"

globby@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/globby/-/globby-7.1.1.tgz#fb2ccff9401f8600945dfada97440cca972b8680"
dependencies:
array-union "^1.0.1"
dir-glob "^2.0.0"
glob "^7.1.2"
ignore "^3.3.5"
pify "^3.0.0"
slash "^1.0.0"

globby@^8.0.0, globby@^8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/globby/-/globby-8.0.1.tgz#b5ad48b8aa80b35b814fc1281ecc851f1d2b5b50"
Expand Down Expand Up @@ -8338,6 +8362,12 @@ p-lazy@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/p-lazy/-/p-lazy-1.0.0.tgz#ec53c802f2ee3ac28f166cc82d0b2b02de27a835"

p-limit@^1.0.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8"
dependencies:
p-try "^1.0.0"

p-limit@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c"
Expand Down

0 comments on commit 941431a

Please sign in to comment.