Skip to content

Commit bb49374

Browse files
authored
Merge pull request #57 from samuelmarshall/update
Update react and dependencies
2 parents ae34f0d + b3edc72 commit bb49374

File tree

21 files changed

+23856
-5608
lines changed

21 files changed

+23856
-5608
lines changed

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn tsc

.husky/pre-push

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn test

package.json

Lines changed: 50 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -15,64 +15,61 @@
1515
"bundle": "parcel build src/app/index.html -d dist/app --no-source-maps",
1616
"test": "jest",
1717
"test:ci": "jest --runInBand",
18-
"prepublish": "yarn build"
19-
},
20-
"husky": {
21-
"hooks": {
22-
"pre-commit": "yarn tsc",
23-
"pre-push": "yarn test"
24-
}
18+
"prepublish": "yarn build",
19+
"prepare": "husky install"
2520
},
2621
"dependencies": {
27-
"chalk": "^4.0.0",
28-
"chokidar": "^3.4.0",
22+
"chalk": "^4.1.2",
23+
"chokidar": "^3.5.3",
2924
"clear": "^0.1.0",
30-
"commander": "^5.1.0",
31-
"express": "^4.17.1",
32-
"figlet": "^1.4.0",
33-
"parcel-bundler": "^1.12.4",
34-
"query-string": "^6.12.1",
35-
"ws": "^7.3.0"
25+
"commander": "^9.4.0",
26+
"debug": "^4.3.4",
27+
"express": "^4.18.1",
28+
"figlet": "^1.5.2",
29+
"parcel-bundler": "1.12.3",
30+
"query-string": "^7.1.1",
31+
"ws": "^8.8.1"
3632
},
3733
"devDependencies": {
38-
"@studydefi/money-legos": "^2.1.3",
39-
"@testing-library/react": "^10.0.4",
40-
"@testing-library/react-hooks": "^3.2.1",
41-
"@types/clear": "^0.1.0",
42-
"@types/express": "^4.17.6",
43-
"@types/figlet": "^1.2.0",
44-
"@types/jest": "^25.2.3",
45-
"@types/node": "^14.0.1",
46-
"@types/parcel-bundler": "^1.12.1",
47-
"@types/puppeteer": "^3.0.0",
48-
"@types/react": "^16.9.35",
49-
"@types/react-dom": "^16.9.8",
50-
"@types/react-modal": "^3.10.5",
51-
"@types/styled-components": "^5.1.0",
52-
"@types/ws": "^7.2.4",
53-
"abi-decoder": "^2.3.0",
54-
"ethers": "^4.0.47",
55-
"ganache-cli": "^6.9.1",
56-
"get-port": "^5.1.1",
57-
"husky": "^4.2.5",
58-
"jest": "^26.0.1",
59-
"jest-puppeteer": "^4.4.0",
60-
"nodemon": "^2.0.4",
61-
"parcel-plugin-bundle-visualiser": "^1.2.0",
62-
"puppeteer": "^3.1.0",
63-
"random-words": "^1.1.1",
64-
"react": "^16.13.1",
65-
"react-dom": "^16.13.1",
66-
"react-modal": "^3.11.2",
67-
"react-test-renderer": "^16.13.1",
68-
"react-use": "^15.1.0",
69-
"react95": "^3.0.0-beta.24",
70-
"styled-components": "^5.1.0",
71-
"tcp-port-used": "^1.0.1",
72-
"truffle": "^5.1.27",
73-
"ts-jest": "^26.0.0",
74-
"ts-node": "^8.10.1",
75-
"typescript": "^3.9.2",
34+
"@testing-library/react": "^13.3.0",
35+
"@testing-library/react-hooks": "^8.0.1",
36+
"@types/clear": "^0.1.2",
37+
"@types/express": "^4.17.13",
38+
"@types/figlet": "^1.5.5",
39+
"@types/jest": "^28.1.8",
40+
"@types/node": "^18.7.13",
41+
"@types/parcel-bundler": "^1.12.3",
42+
"@types/puppeteer": "^5.4.6",
43+
"@types/react": "^18.0.17",
44+
"@types/react-dom": "^18.0.6",
45+
"@types/react-modal": "^3.13.1",
46+
"@types/styled-components": "^5.1.26",
47+
"@types/tcp-port-used": "^1.0.1",
48+
"@types/ws": "^8.5.3",
49+
"abi-decoder": "^2.4.0",
50+
"ethers": "^5.7.0",
51+
"get-port": "5.1.1",
52+
"husky": "^8.0.0",
53+
"jest": "^29.0.1",
54+
"jest-environment-jsdom": "^29.0.1",
55+
"jest-puppeteer": "^6.1.1",
56+
"jest-styled-components": "^7.1.0",
57+
"nodemon": "^2.0.19",
58+
"puppeteer": "^16.2.0",
59+
"random-words": "^1.2.0",
60+
"react": "^18.2.0",
61+
"react-dom": "^18.2.0",
62+
"react-modal": "^3.15.1",
63+
"react-test-renderer": "^18.2.0",
64+
"react95": "3.0.0",
65+
"styled-components": "^5.3.5",
66+
"tcp-port-used": "^1.0.2",
67+
"ts-jest": "29.0.0-next.0",
68+
"ts-node": "^10.9.1",
69+
"typescript": "^4.8.2",
7670
"unstated-next": "^1.1.0"
71+
},
72+
"engines": {
73+
"node": "16"
7774
}
7875
}

src/app/containers/Connection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createContainer } from "unstated-next";
22
import { useState, useEffect } from "react";
33
import { ethers } from "ethers";
4-
import { JsonRpcProvider, Web3Provider } from "ethers/providers";
4+
import { JsonRpcProvider, Web3Provider } from "@ethersproject/providers";
55

66
export enum Method {
77
Localhost = "Localhost",

src/app/containers/Contracts.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @jest-environment jsdom
3+
*/
14
import { act, renderHook } from "@testing-library/react-hooks";
25
import { useContracts } from "./Contracts";
36

src/app/containers/Network.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createContainer } from "unstated-next";
22
import { useState, useEffect } from "react";
33
import Connection from "./Connection";
4-
import { Network } from "ethers/utils";
4+
import { Network } from "@ethersproject/networks";
55

66
export function useNetwork() {
77
const { provider } = Connection.useContainer();

src/app/features/common/Layout.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from "react";
22
import styled, { ThemeProvider } from "styled-components";
3-
import { themes, Window, WindowHeader, WindowContent } from "react95";
3+
import { Window, WindowHeader, WindowContent } from "react95";
4+
import original from "react95/dist/themes/original"
45

56
const AppContainer = styled.div`
67
width: 100%;
@@ -20,13 +21,9 @@ const Content = styled(WindowContent)`
2021
overflow: auto;
2122
`;
2223

23-
const appTheme = {
24-
...themes.default,
25-
};
26-
2724
const Layout = ({ children }) => (
2825
<>
29-
<ThemeProvider theme={appTheme}>
26+
<ThemeProvider theme={original}>
3027
<AppContainer>
3128
<Container shadow={false}>
3229
<WindowHeader>Eth95.exe</WindowHeader>

src/app/features/function-call/useCallFunction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const useCallFunction = (args, types, fn, opts) => {
1919
decoded.forEach((evt) => {
2020
const values = evt.events.map((x) => {
2121
if (x.type === "bytes32") {
22-
return ethers.utils.parseBytes32String(x.value);
22+
ethers.BigNumber.from(x.value).toString();
2323
}
2424
return x.value;
2525
});
@@ -31,7 +31,7 @@ const useCallFunction = (args, types, fn, opts) => {
3131
// handle array and int types
3232
const processedArgs = args.map((arg, idx) => {
3333
const type = types[idx];
34-
if (type.substring(0, 4) === "uint") return ethers.utils.bigNumberify(arg);
34+
if (type.substring(0, 4) === "uint") return ethers.BigNumber.from(arg);
3535
if (type.slice(-2) === "[]") return JSON.parse(arg);
3636
return arg;
3737
});

src/app/features/function-info/FunctionInfo.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, { useState, useEffect } from "react";
22
import styled from "styled-components";
3-
import { useEvent } from "react-use";
43

54
import FunctionDetails from "./FunctionDetails";
65
import FunctionList from "./FunctionList";
@@ -31,7 +30,7 @@ const FunctionInfo = ({ contract }) => {
3130
}
3231

3332
// keyboard press behaviour (should really be somewhere else)
34-
useEvent("keydown", (e) => {
33+
const keyHandler = e => {
3534
if (e.key === "ArrowUp") {
3635
e.preventDefault();
3736
if (selectedIdx !== null) {
@@ -50,7 +49,15 @@ const FunctionInfo = ({ contract }) => {
5049
shiftDown();
5150
}
5251
}
53-
});
52+
}
53+
54+
// add event listener on initial render, and remove on cleanup
55+
useEffect(() => {
56+
window.addEventListener('keydown', keyHandler)
57+
return () => {
58+
window.removeEventListener('keydown', keyHandler)
59+
}
60+
}, [])
5461

5562
// unselect functions if the contract changes
5663
useEffect(() => {

src/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import path from "path";
44
import chalk from "chalk";
55
import clear from "clear";
66
import figlet from "figlet";
7-
import program from "commander";
7+
import { program } from "commander";
88

99
import log from "./logger";
1010
import startServer from "./server";
@@ -31,15 +31,16 @@ program
3131
.parse(process.argv);
3232

3333
program.outputHelp();
34+
const options = program.opts();
3435
console.log("");
3536

3637
// determine what path (if any) to try
3738
let targetPath;
3839
if (program.args[0]) {
3940
targetPath = program.args[0];
40-
} else if (program.truffle) {
41+
} else if (options.truffle) {
4142
targetPath = "./build/contracts";
42-
} else if (program.buidler) {
43+
} else if (options.buidler) {
4344
targetPath = "./artifacts";
4445
}
4546

@@ -55,11 +56,11 @@ if (targetPath) {
5556

5657
log.info(`Artifact directory: ${chalk.yellow(artifactPath)}`);
5758
startServer({
58-
port: program.port || 3000,
59+
port: options.port || 3000,
5960
artifactPath,
6061
});
6162
} else {
6263
startServer({
63-
port: program.port || 3000,
64+
port: options.port || 3000,
6465
});
6566
}

0 commit comments

Comments
 (0)