Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migration to NextJS + materialUI | upgrade wagmi + rainbowkit + viem #7

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VITE_RPC_URL= # Example: https://localhost:8545
VITE_PROJECT_ID= # ProjectId from walletConnect
VITE_ALCHEMY_KEY= # API key from Alchemy
NEXT_PUBLIC_RPC_URL= # Example: https://localhost:8545
NEXT_PUBLIC_PROJECT_ID= # API from WalletConnect
turtlemoji marked this conversation as resolved.
Show resolved Hide resolved
NEXT_PUBLIC_ALCHEMY_KEY= # API key from Alchemy
33 changes: 17 additions & 16 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@ module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended",
'prettier',
'eslint:recommended',
'plugin:react/recommended',
'plugin:jsx-a11y/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:prettier/recommended',
'plugin:@next/next/recommended',
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
settings: {
react: {
version: 'detect',
},
},
};
4 changes: 2 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: "18.7"
node-version: "21.4"
registry-url: "https://registry.npmjs.org"

- name: Get yarn cache directory path
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18.7"
node-version: "21.4"
registry-url: "https://registry.npmjs.org"

- name: Get yarn cache directory path
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ pnpm-debug.log*
lerna-debug.log*

node_modules
.next
next-env.d.ts
dist
dist-ssr
*.local
Expand All @@ -24,4 +26,5 @@ dist-ssr
*.sw?

.eslintcache
.env
.env
tsconfig.tsbuildinfo
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,32 @@
3. Install the project dependencies by running:

```bash
yarn install
pnpm install
```

## Available Scripts

Available scripts that can be run using `yarn`:
Available scripts that can be run using `pnpm`:

| Script | Description |
| -------------- | ------------------------------------------------------------ |
| `dev` | Start the development server using Vite. |
| `dev` | Start the development server using Next. |
| `build` | Build the project for production. |
| `preview` | Preview the production build using Vite. |
| `preview` | Preview the production build using Next. |
| `lint` | Run ESLint on the source code to check for coding standards. |
| `lint:fix` | Run ESLint and automatically fix code formatting issues. |
| `prettier` | Check code formatting using Prettier. |
| `prettier:fix` | Format code using Prettier and automatically fix issues. |
| `format` | Run Prettier and ESLint to format and fix code issues. |
| `format:check` | Check code formatting and linting without making changes. |
| `test` | Run unit tests using Vitest. |
| `test:watch` | Run Vitest in watch mode. |
| `test` | Run tests using Cypress |
| `test:watch` | Run Cypress in watch mode. |

## Technologies Used

This boilerplate leverages the latest technologies, including:

- [Vite](https://vitejs.dev/)
- [Vitest](https://vitest.dev/)
- [NextJS](https://nextjs.org/)
- [Wagmi](https://wagmi.sh/)
- [Viem](https://viem.sh/)
- [Rainbowkit](https://www.rainbowkit.com/)
9 changes: 9 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
5 changes: 5 additions & 0 deletions cypress/e2e/fundamentals.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('template spec', () => {
it('passes', () => {
cy.visit('https://example.cypress.io');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change default examples, maybe

});
});
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change or delete examples

"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
37 changes: 37 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference types="cypress" />
turtlemoji marked this conversation as resolved.
Show resolved Hide resolved
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
20 changes: 20 additions & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
13 changes: 0 additions & 13 deletions index.html

This file was deleted.

4 changes: 4 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;
44 changes: 28 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,75 @@
{
"name": "web3-react-boilerplate-private",
"name": "web3-react-boilerplate",
"private": true,
"version": "0.0.0",
"type": "module",
"license": "MIT",
"author": "Wonderland",
"engines": {
"node": ">=18.17.0"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"dev": "next dev",
"build": "next build",
"start": "next start",
"preview": "next start",
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
"lint:fix": "yarn run lint -- --fix",
"prettier": "prettier src --check",
"prettier:fix": "yarn run prettier -- --write",
"format": "yarn run prettier:fix && yarn run lint:fix",
"format:check": "yarn run prettier && yarn run lint",
"prepare": "husky install && wonderland-crypto-husky-checks install",
"test": "vitest run --dir src/tests/",
"test:watch": "vitest --dir src/tests/"
"test": "yarn cypress run",
turtlemoji marked this conversation as resolved.
Show resolved Hide resolved
"test:watch": "yarn cypress open"
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx}": "eslint --cache --fix",
"src/**/*.{js,jsx,ts,tsx,css,scss,md,html}": "prettier --write --ignore-unknown"
},
"dependencies": {
"@rainbow-me/rainbowkit": "1.0.9",
"@emotion/cache": "11.11.0",
"@emotion/react": "11.11.3",
"@emotion/server": "11.11.0",
"@emotion/styled": "11.11.0",
"@mui/icons-material": "5.15.6",
"@mui/material": "5.15.14",
"@mui/material-nextjs": "5.15.11",
"@next/eslint-plugin-next": "14.1.3",
"@rainbow-me/rainbowkit": "2.0.2",
"@tanstack/react-query": "5.28.0",
"next": "14.1.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-router-dom": "6.15.0",
"viem": "1.19.15",
"wagmi": "1.4.12"
"viem": "2.8.6",
"wagmi": "2.5.7"
},
"devDependencies": {
"@defi-wonderland/crypto-husky-checks": "1.3.0",
"@testing-library/jest-dom": "6.1.2",
"@testing-library/react": "14.0.0",
"@testing-library/react": "14.2.1",
"@testing-library/user-event": "14.4.3",
"@types/lodash.merge": "4.6.7",
"@types/react": "18.2.15",
"@types/react-dom": "18.2.7",
"@typescript-eslint/eslint-plugin": "6.0.0",
"@typescript-eslint/parser": "6.0.0",
"@vitejs/plugin-react": "4.0.3",
"cypress": "13.7.0",
"eslint": "8.45.0",
"eslint-config-prettier": "9.0.0",
"eslint-formatter-codeframe": "7.32.1",
turtlemoji marked this conversation as resolved.
Show resolved Hide resolved
"eslint-plugin-import": "2.28.1",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-prettier": "5.0.0",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.3",
"husky": "8.0.3",
"jsdom": "22.1.0",
"jsdom": "24.0.0",
"lodash.merge": "4.6.2",
"prettier": "3.0.3",
"styled-components": "6.0.7",
"typescript": "5.0.2",
"vite": "4.4.5",
"vite-tsconfig-paths": "4.2.0",
"vitest": "0.34.3"
"typescript": "5.4.2"
}
}
Loading
Loading