Update electron scripts

This commit is contained in:
Mati Dastugue 2020-05-29 15:30:38 -03:00
parent 7b0eb4cf7d
commit 1382c8e7a2
4 changed files with 47 additions and 7 deletions

View File

@ -23,7 +23,7 @@
"build-mainnet": "cross-env REACT_APP_NETWORK=mainnet yarn build",
"build": "REACT_APP_APP_VERSION=$npm_package_version react-app-rewired --max-old-space-size=8192 build",
"eject": "react-app-rewired eject",
"electron-build": "electron-builder --mac --windows --linux",
"electron-build": "electron-builder --mac --linux --windows",
"electron-dev": "concurrently \"BROWSER=none yarn start\" \"wait-on http://localhost:3000 && electron .\"",
"format:staged": "lint-staged",
"lint:check": "eslint './src/**/*.{js,jsx,ts,tsx}'",
@ -53,6 +53,7 @@
"build": {
"appId": "io.gnosis.safe.macos",
"afterSign": "scripts/notarize.js",
"extends": null,
"productName": "Safe Multisig",
"asar": true,
"publish": [

View File

@ -1,14 +1,12 @@
const electron = require("electron");
const express = require('express');
const express = require('express');
const open = require('open');
const log = require('electron-log');
const fs = require('fs');
const dialog = electron.dialog;
const Menu = electron.Menu;
const https = require('https');
const autoUpdater = require('./auto-updater');
const url = require('url');
const app = electron.app;
const session = electron.session;
const BrowserWindow = electron.BrowserWindow;
@ -164,4 +162,4 @@ app.on("activate", () => {
if (mainWindow === null) {
createWindow();
}
});
});

41
scripts/notarize.js Normal file
View File

@ -0,0 +1,41 @@
const fs = require("fs");
const path = require("path");
const { notarize } = require("electron-notarize");
const envConfig = require('dotenv').config({path:path.join(__dirname, '../.env')});
Object.entries(envConfig.parsed || {}).forEach(([key, value]) => {
process.env[key] = value;
});
module.exports = async function (params) {
// Only notarize the app on Mac OS only.
if (process.platform !== "darwin") {
return;
}
// Same appId in electron-builder.
let appId = "io.gnosis.safe.macos";
let appPath = path.join(
params.appOutDir,
`${params.packager.appInfo.productFilename}.app`
);
if (!fs.existsSync(appPath)) {
throw new Error(`Cannot find application at: ${appPath}`);
}
console.log(`Notarizing ${appId} found at ${appPath}`);
try {
await notarize({
appBundleId: appId,
appPath: appPath,
appleId: process.env.APPLEID,
appleIdPassword: process.env.APPLEIDPASS,
});
} catch (error) {
console.error(error);
}
console.log(`Done notarizing ${appId}`);
};

View File

@ -16981,9 +16981,9 @@ web3-provider-engine@^15.0.4:
xhr "^2.2.0"
xtend "^4.0.1"
"web3-provider-engine@git+https://github.com/trufflesuite/provider-engine.git#web3-one":
"web3-provider-engine@https://github.com/trufflesuite/provider-engine#web3-one":
version "14.0.6"
resolved "git+https://github.com/trufflesuite/provider-engine.git#3538c60bc4836b73ccae1ac3f64c8fed8ef19c1a"
resolved "https://github.com/trufflesuite/provider-engine#3538c60bc4836b73ccae1ac3f64c8fed8ef19c1a"
dependencies:
async "^2.5.0"
backoff "^2.5.0"