Skip to content

Commit

Permalink
Merge pull request #10 from vechainfoundation/add-hardhat-to-app
Browse files Browse the repository at this point in the history
Add hardhat to app
  • Loading branch information
darrenvechain authored Oct 25, 2023
2 parents 59272d5 + ba1697f commit cc4986d
Show file tree
Hide file tree
Showing 9 changed files with 3,983 additions and 149 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/lint-build-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Lint, Build & Test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

concurrency:
group: ${{ github.head_ref || github.ref_name }}-build-test-scan
cancel-in-progress: true

jobs:
build-and-test:
runs-on: ubuntu-latest
name: Lint, Build & Test

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Install
run: pnpm install:all

- name: Lint
run: pnpm run lint

- name: Build
run: pnpm run build
1 change: 1 addition & 0 deletions apps/sample-react-app/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
extends: ["custom/react"],
ignorePatterns: ["src/hardhat/**/*"],
};
12 changes: 12 additions & 0 deletions apps/sample-react-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
node_modules
.env
coverage
coverage.json
typechain
typechain-types

# Hardhat files
cache
artifacts
src/hardhat

22 changes: 22 additions & 0 deletions apps/sample-react-app/contracts/Counter.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Counter {
uint256 public count;

event CounterUpdated(uint256 newValue);

constructor() {
count = 0;
}

function increment() public {
count += 1;
emit CounterUpdated(count);
}

function incrementBy(uint256 value) public {
count += value;
emit CounterUpdated(count);
}
}
11 changes: 11 additions & 0 deletions apps/sample-react-app/hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";

const config: HardhatUserConfig = {
solidity: "0.8.19",
typechain: {
outDir: "src/hardhat",
},
};

export default config;
14 changes: 11 additions & 3 deletions apps/sample-react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,28 @@
"homepage": ".",
"main": "src/index.js",
"scripts": {
"postinstall": "pnpm compile",
"start": "HTTPS=true react-app-rewired start",
"dev": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"build": "pnpm compile && react-app-rewired build",
"test": "echo 'Not yet testing'",
"eject": "react-app-rewired eject",
"compile": "hardhat compile",
"lint": "eslint src --ext .js,.jsx,.ts,.tsx",
"clean": "rm -rf build node_modules .turbo"
"clean": "rm -rf build node_modules .turbo cache artifacts src/hardhat"
},
"dependencies": {
"@chakra-ui/react": "^2.8.1",
"@emotion/react": "^11.11.1",
"@heroicons/react": "^2.0.18",
"@vechain/connex": "2.1.0",
"@vechain/hardhat-vechain": "^0.1.4",
"@vechain/hardhat-web3": "^0.1.4",
"@vechain/picasso": "^2.1.1",
"@vechain/web3-providers-connex": "^1.1.2",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"ethers": "^6.8.0",
"https-browserify": "^1.0.0",
"os-browserify": "^0.3.0",
"process": "^0.11.10",
Expand All @@ -36,6 +42,7 @@
"web-vitals": "^2.1.2"
},
"devDependencies": {
"@nomicfoundation/hardhat-toolbox": "^3.0.0",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
Expand All @@ -48,6 +55,7 @@
"customize-cra": "^1.0.0",
"eslint-config-custom": "workspace:*",
"filemanager-webpack-plugin": "^8.0.0",
"hardhat": "^2.18.2",
"mini-css-extract-plugin": "^2.7.6",
"react-app-rewired": "^2.2.1",
"ts-import-plugin": "^3.0.0",
Expand Down
9 changes: 0 additions & 9 deletions apps/sample-react-app/src/App.test.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion packages/tsconfig/react-app.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"incremental": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"module": "commonjs",
"noEmit": true,
"resolveJsonModule": true,
"target": "ES6"
Expand Down
Loading

0 comments on commit cc4986d

Please sign in to comment.