Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 6dbf54c

Browse files
authored
Update electron, ganache, and filecoin (#5629)
1 parent e913d3c commit 6dbf54c

File tree

15 files changed

+80673
-52661
lines changed

15 files changed

+80673
-52661
lines changed

package-lock.json

Lines changed: 45890 additions & 33126 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"test-mocha": "cross-env GANACHE_DEV_MODE=true ELECTRON_APP_PATH=./ mocha --require @babel/register --check-leaks 'test/mocha/**/*.test.js'",
3939
"storybook": "start-storybook -p 6006",
4040
"build-storybook": "build-storybook",
41-
"postinstall": "cd static/node && npm ci --only=prod"
41+
"postinstall": "patch-package && cd static/node && npm ci --only=prod"
4242
},
4343
"dependencies": {
4444
"14": "^3.1.6",
@@ -55,7 +55,7 @@
5555
"fix-path": "^2.1.0",
5656
"follow-redirects": "1.9.0",
5757
"fs-extra": "9.0.0",
58-
"ganache": "7.7.3",
58+
"ganache": "7.9.1",
5959
"ganache-core": "2.13.1",
6060
"get-port": "^5.0.0",
6161
"history": "4.10.1",
@@ -64,8 +64,8 @@
6464
"lodash.isequal": "^4.5.0",
6565
"lodash.merge": "^4.6.2",
6666
"lodash.omit": "^4.5.0",
67-
"moment": "^2.24.0",
68-
"moment-timezone": "^0.5.26",
67+
"moment": "^2.29.4",
68+
"moment-timezone": "^0.5.43",
6969
"moniker": "^0.1.2",
7070
"node-fetch": "2.6.0",
7171
"node-localstorage": "^2.1.6",
@@ -79,7 +79,7 @@
7979
"react-graph-vis": "1.0.5",
8080
"react-hot-loader": "4.3.12",
8181
"react-md-spinner": "^1.0.0",
82-
"react-moment": "^0.2.2",
82+
"react-moment": "^1.1.3",
8383
"react-redux": "6.0.1",
8484
"react-render-html": "^0.6.0",
8585
"react-router": "5.1.2",
@@ -109,15 +109,17 @@
109109
"@babel/preset-env": "^7.6.2",
110110
"@babel/preset-react": "^7.0.0",
111111
"@babel/register": "^7.0.0",
112+
"@electron/remote": "^2.0.10",
112113
"@filecoin-shipyard/lotus-client-provider-browser": "0.0.14",
113114
"@filecoin-shipyard/lotus-client-rpc": "0.2.0",
114-
"@ganache/filecoin": "0.6.0",
115-
"@ganache/filecoin-options": "0.1.3",
115+
"@ganache/filecoin": "0.9.2",
116+
"@ganache/filecoin-options": "0.9.2",
116117
"babel-eslint": "10.0.3",
118+
"babel-loader": "^8.3.0",
117119
"cache-loader": "4.1.0",
118120
"chokidar": "3.3.1",
119121
"cross-env": "^6.0.0",
120-
"electron": "^12.0.2",
122+
"electron": "^26.1.0",
121123
"electron-builder": "23.6.0",
122124
"electron-fetch": "1.7.3",
123125
"electron-notarize": "1.0.0",
@@ -135,9 +137,11 @@
135137
"jest": "^24.9.0",
136138
"js-scrypt": "^0.2.0",
137139
"lint-staged": "^9.2.5",
138-
"sass": "1.57.1",
140+
"node-pre-gyp": "^0.17.0",
141+
"patch-package": "8.0.0",
139142
"prettier": "^1.18.2",
140143
"react-svg-loader": "^3.0.3",
144+
"sass": "1.57.1",
141145
"sass-loader": "10.1.1",
142146
"temp": "0.9.1",
143147
"webpack": "^4.46.0"
@@ -262,6 +266,6 @@
262266
}
263267
},
264268
"engines": {
265-
"node": "14.21.1"
269+
"node": "18.16.1"
266270
}
267271
}

patches/webpack+4.46.0.patch

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
diff --git a/node_modules/webpack/lib/Compilation.js b/node_modules/webpack/lib/Compilation.js
2+
index 6329174..591c698 100644
3+
--- a/node_modules/webpack/lib/Compilation.js
4+
+++ b/node_modules/webpack/lib/Compilation.js
5+
@@ -1036,13 +1036,13 @@ class Compilation extends Tapable {
6+
7+
const errorAndCallback = this.bail
8+
? err => {
9+
- callback(err);
10+
- }
11+
+ callback(err);
12+
+ }
13+
: err => {
14+
- err.dependencies = [dependency];
15+
- this.errors.push(err);
16+
- callback();
17+
- };
18+
+ err.dependencies = [dependency];
19+
+ this.errors.push(err);
20+
+ callback();
21+
+ };
22+
23+
if (
24+
typeof dependency !== "object" ||
25+
@@ -1314,7 +1314,7 @@ class Compilation extends Tapable {
26+
}
27+
buildChunkGraph(
28+
this,
29+
- /** @type {Entrypoint[]} */ (this.chunkGroups.slice())
30+
+ /** @type {Entrypoint[]} */(this.chunkGroups.slice())
31+
);
32+
this.sortModules(this.modules);
33+
this.hooks.afterChunks.call(this.chunks);
34+
@@ -2158,7 +2158,7 @@ class Compilation extends Tapable {
35+
} else {
36+
throw new Error(
37+
`Conflict: Multiple chunks emit assets to the same filename ${file}` +
38+
- ` (chunks ${alreadyWritten.chunk.id} and ${chunk.id})`
39+
+ ` (chunks ${alreadyWritten.chunk.id} and ${chunk.id})`
40+
);
41+
}
42+
}
43+
@@ -2198,6 +2198,7 @@ class Compilation extends Tapable {
44+
});
45+
}
46+
} catch (err) {
47+
+ throw err;
48+
this.errors.push(
49+
new ChunkRenderError(chunk, file || filenameTemplate, err)
50+
);
51+
@@ -2288,7 +2289,7 @@ Compilation.prototype.applyPlugins = util.deprecate(
52+
* @returns {void}
53+
* @this {Compilation}
54+
*/
55+
- function(name, ...args) {
56+
+ function (name, ...args) {
57+
this.hooks[
58+
name.replace(/[- ]([a-z])/g, match => match[1].toUpperCase())
59+
].call(...args);
60+
@@ -2305,7 +2306,7 @@ Object.defineProperty(Compilation.prototype, "moduleTemplate", {
61+
* @this {Compilation}
62+
* @returns {TODO} module template
63+
*/
64+
- function() {
65+
+ function () {
66+
return this.moduleTemplates.javascript;
67+
},
68+
"Compilation.moduleTemplate: Use Compilation.moduleTemplates.javascript instead"
69+
@@ -2317,7 +2318,7 @@ Object.defineProperty(Compilation.prototype, "moduleTemplate", {
70+
* @this {Compilation}
71+
* @returns {void}
72+
*/
73+
- function(value) {
74+
+ function (value) {
75+
this.moduleTemplates.javascript = value;
76+
},
77+
"Compilation.moduleTemplate: Use Compilation.moduleTemplates.javascript instead."
78+
diff --git a/node_modules/webpack/lib/ModuleFilenameHelpers.js b/node_modules/webpack/lib/ModuleFilenameHelpers.js
79+
index bd0742b..de1d5d8 100644
80+
--- a/node_modules/webpack/lib/ModuleFilenameHelpers.js
81+
+++ b/node_modules/webpack/lib/ModuleFilenameHelpers.js
82+
@@ -42,7 +42,7 @@ const getBefore = (str, token) => {
83+
};
84+
85+
const getHash = str => {
86+
- const hash = createHash("md4");
87+
+ const hash = createHash("sha256");
88+
hash.update(str);
89+
const digest = /** @type {string} */ (hash.digest("hex"));
90+
return digest.substr(0, 4);
91+
@@ -64,8 +64,8 @@ ModuleFilenameHelpers.createFilename = (module, options, requestShortener) => {
92+
typeof options === "object"
93+
? options
94+
: {
95+
- moduleFilenameTemplate: options
96+
- }
97+
+ moduleFilenameTemplate: options
98+
+ }
99+
);
100+
101+
let absoluteResourcePath;
102+
diff --git a/node_modules/webpack/lib/NamedModulesPlugin.js b/node_modules/webpack/lib/NamedModulesPlugin.js
103+
index 2d84aaf..fe35290 100644
104+
--- a/node_modules/webpack/lib/NamedModulesPlugin.js
105+
+++ b/node_modules/webpack/lib/NamedModulesPlugin.js
106+
@@ -8,7 +8,7 @@ const createHash = require("./util/createHash");
107+
const RequestShortener = require("./RequestShortener");
108+
109+
const getHash = str => {
110+
- const hash = createHash("md4");
111+
+ const hash = createHash("sha256");
112+
hash.update(str);
113+
const digest = /** @type {string} */ (hash.digest("hex"));
114+
return digest.substr(0, 4);

src/integrations/ethereum/renderer/screens/config/ConfigScreens/WorkspaceScreen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from "react";
2-
import { remote } from "electron";
2+
const remote = require("@electron/remote");
33
import path from "path";
44
import ModalDetails from "../../../../../../renderer/components/modal/ModalDetails";
55
import SyntaxHighlighter from "react-syntax-highlighter";

src/integrations/ethereum/renderer/screens/contracts/ContractDetails.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { shell } from "electron";
2-
const { app } = require("electron").remote;
2+
const { app } = require("@electron/remote");
33

44
import jsonTheme from "../../../../../common/utils/jsonTheme";
55
import ReactJson from "@ganache/react-json-view";
@@ -32,7 +32,7 @@ class ContractDetails extends Component {
3232
const contract = filteredContracts[0];
3333

3434
this.state = { project, contract };
35-
35+
3636
const contractCache = this.props.workspaces.current.contractCache;
3737
const cache = contractCache[this.state.contract.address];
3838
const transactions = cache.transactions.slice(
@@ -73,8 +73,7 @@ class ContractDetails extends Component {
7373

7474
reportDecodingError() {
7575
const title = encodeURIComponent(
76-
`Decoding Error when running Ganache ${app.getVersion()} on ${
77-
process.platform
76+
`Decoding Error when running Ganache ${app.getVersion()} on ${process.platform
7877
}`,
7978
);
8079

src/integrations/filecoin/renderer/screens/files/MiniFileCard.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { PureComponent } from "react";
2-
import { remote } from "electron";
2+
const remote = require("@electron/remote");
33
import DownloadIcon from "../../../../../renderer/icons/download.svg";
44
import connect from "../../../../../renderer/screens/helpers/connect";
55
import * as Files from "../../../common/redux/files/actions";
@@ -51,7 +51,7 @@ export class MiniFileCard extends PureComponent {
5151
<div className="RowItem">
5252
<div className="Download">
5353
<OnlyIf test={!downloadInProgress}>
54-
<button onClick={() => this.saveFile(file.cid, file.name) }>
54+
<button onClick={() => this.saveFile(file.cid, file.name)}>
5555
<span>DOWNLOAD</span>
5656
<DownloadIcon />
5757
</button>
@@ -63,7 +63,7 @@ export class MiniFileCard extends PureComponent {
6363
<ProgressBar percent={Math.floor((file.download.progress || 0) * 100)} />
6464
</OnlyIf>
6565
<OnlyIf test={downloadInProgress && !file.download.complete && file.download.error}>
66-
<button className="Error"disabled={true}>
66+
<button className="Error" disabled={true}>
6767
<span>ERROR</span>
6868
</button>
6969
</OnlyIf>

src/main/index.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,16 @@ if (process.platform === "win32") {
9393
// context.
9494
// eslint-disable-next-line no-console
9595
let userDataPromise = spawn("cmd.exe", ["/c", "mkdir", USERDATA_PATH])
96-
.then(()=> {
96+
.then(() => {
9797
return spawn("cmd.exe", ["/c", "mkdir", path.join(USERDATA_PATH, "extras")])
9898
})
99-
.then(()=> {
99+
.then(() => {
100100
return spawn("cmd.exe", ["/c", "mkdir", path.join(USERDATA_PATH, "workspaces")])
101101
})
102-
.then(()=> {
102+
.then(() => {
103103
return spawn("cmd.exe", ["/c", "mkdir", path.join(USERDATA_PATH, "default")])
104104
})
105-
.then(()=> {
105+
.then(() => {
106106
return spawn("cmd.exe", ["/c", "mkdir", path.join(USERDATA_PATH, "global")])
107107
})
108108
.catch(e => { console.error(e) });
@@ -162,15 +162,15 @@ app.on('ready', async () => {
162162
const integrations = new IntegrationManager(USERDATA_PATH, ipcMain, isDevMode);
163163
// allow integrations to communicate with the mainWindow by emitting a
164164
// `"send"` event
165-
integrations.on("send", function(){
165+
integrations.on("send", function () {
166166
if (mainWindow) {
167167
const webContents = mainWindow.webContents;
168168
if (webContents) {
169169
webContents.send.apply(webContents, arguments);
170170
}
171171
}
172172
});
173-
integrations.on("progress", function(message, minDuration = null) {
173+
integrations.on("progress", function (message, minDuration = null) {
174174
mainWindow.webContents.send(SET_PROGRESS, message, minDuration);
175175
addLogLines(message + "\n");
176176
});
@@ -209,7 +209,11 @@ app.on('ready', async () => {
209209
callback(true);
210210
});
211211

212+
require('@electron/remote/main').initialize();
213+
214+
212215
mainWindow = new BrowserWindow({
216+
enableRemoteModule: true,
213217
show: false,
214218
minWidth: 950,
215219
minHeight: 670,
@@ -223,6 +227,7 @@ app.on('ready', async () => {
223227
enableRemoteModule: true
224228
}
225229
});
230+
require("@electron/remote/main").enable(mainWindow.webContents)
226231

227232
if (isDevelopment) {
228233
mainWindow.loadURL(`http://localhost:${process.env.ELECTRON_WEBPACK_WDS_PORT}`);
@@ -244,7 +249,7 @@ app.on('ready', async () => {
244249

245250
// if a user clicks a link to an external webpage, open it in the user's browser, not our app
246251
mainWindow.webContents.on("new-window", ensureExternalLinksAreOpenedInBrowser);
247-
mainWindow.webContents.on("will-navigate",ensureExternalLinksAreOpenedInBrowser);
252+
mainWindow.webContents.on("will-navigate", ensureExternalLinksAreOpenedInBrowser);
248253

249254
// handle right click:
250255
mainWindow.webContents.on("context-menu", (_e, props) => {
@@ -504,7 +509,7 @@ app.on('ready', async () => {
504509
);
505510

506511
startupMode = STARTUP_MODE.NORMAL;
507-
if (await integrations.startServer()){
512+
if (await integrations.startServer()) {
508513
// this sends the network interfaces to the renderer process for
509514
// enumering in the config screen. it sends repeatedly
510515
continuouslySendNetworkInterfaces();
@@ -639,7 +644,7 @@ app.on('ready', async () => {
639644

640645
startupMode = STARTUP_MODE.NORMAL;
641646

642-
if (await integrations.startServer()){
647+
if (await integrations.startServer()) {
643648
// send the interfaces again once on restart
644649
sendNetworkInterfaces();
645650
}

src/main/types/settings/Settings.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import merge from "lodash.merge";
22
import assign from "lodash.assign";
33
import JsonStorage from "../json/JsonStorage";
4-
import UUID from "uuid";
4+
const UUID = require("uuid");
55

66
class Settings {
77
constructor(directory, initialSettings) {
@@ -88,7 +88,7 @@ class Settings {
8888
}
8989
}
9090

91-
const removeNullSettings = function(options) {
91+
const removeNullSettings = function (options) {
9292
// get rid of nulls first, because apparently typeof null === object :-(
9393
if (typeof options === "undefined" || options === null) {
9494
return undefined;
@@ -116,7 +116,7 @@ const removeNullSettings = function(options) {
116116
}
117117
};
118118

119-
const _removeNullSettingsFromObject = function(obj) {
119+
const _removeNullSettingsFromObject = function (obj) {
120120
let result = {};
121121
for (let key of Object.keys(obj)) {
122122
let value = removeNullSettings(obj[key]);
@@ -127,7 +127,7 @@ const _removeNullSettingsFromObject = function(obj) {
127127
return result;
128128
};
129129

130-
const _removeNullSettingsFromArray = function(arr) {
130+
const _removeNullSettingsFromArray = function (arr) {
131131
let result = [];
132132

133133
for (let initialValue of arr) {

0 commit comments

Comments
 (0)