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: mirgation nextJS #5

Merged
merged 27 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
cd0f674
chore: nextJS migration | *removed styles due to near future material…
0xtiti Mar 15, 2024
7be2f67
test: vitest adapted to nextJS environment, simple testing
0xtiti Mar 17, 2024
0423a75
fix: test type assertion | build type assertion fixes
0xtiti Mar 17, 2024
b2c20e5
fix: removed build info file
0xtiti Mar 17, 2024
bc5047e
fix: added tsconfig.tsbuildinfo to gitignore - false possitive on pri…
0xtiti Mar 17, 2024
af6a7d0
fix: removed caret
0xtiti Mar 17, 2024
4ad963e
fix: reinstalled yarn.lock build issues
0xtiti Mar 17, 2024
9395dac
fix: build issue with node version
0xtiti Mar 17, 2024
9835ed7
fix: update nodejs version
0xtiti Mar 17, 2024
eee572a
fix: Ensure using correct Node.js version in GitHub Actions
0xtiti Mar 17, 2024
0cb0315
fix: nodejs version issue
0xtiti Mar 17, 2024
4cc58d6
fix: revert back to nodejs -v 18.7
0xtiti Mar 17, 2024
2345a7e
fix: resolve "x" type + udpate version 21.4
0xtiti Mar 18, 2024
17337eb
fix: remove carets
0xtiti Mar 18, 2024
ac7d671
Merge branch 'chore/migration-nextjs' of github-defi:defi-wonderland/…
0xtiti Mar 18, 2024
af82dd5
fix: remove carets
0xtiti Mar 18, 2024
9b5c51f
fix: footer/header tags | group imports | sort imports
0xtiti Mar 18, 2024
a77794c
fix: next.config default
0xtiti Mar 18, 2024
1b2facf
fix: eslintrc remove typeprops rule + default file
0xtiti Mar 18, 2024
9a9683f
fix: remove unused libs and old tests
0xtiti Mar 18, 2024
0d212dd
fix: remove vite and vitest
0xtiti Mar 18, 2024
cc5360c
fix:lint issue
0xtiti Mar 18, 2024
2b5828f
fix: layout children proptype validation
0xtiti Mar 18, 2024
6e40a96
fix: remove test - cypress migration
0xtiti Mar 18, 2024
c96505d
fix: remove vitest and yarn | add pnpm
0xtiti Mar 19, 2024
995ea88
fix: added cypress and pnpm
0xtiti Mar 19, 2024
58f0ce8
fix: remove caret
0xtiti Mar 19, 2024
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
7 changes: 4 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
VITE_RPC_URL= # Example: https://localhost:8545
VITE_PROJECT_ID= # Example API from WalletConnect: ""
VITE_ALCHEMY_KEY= # API key from Alchemy
NEXT_PUBLIC_RPC_URL= # Example: https://localhost:8545
NEXT_PUBLIC_PROJECT_ID= # Example API from WalletConnect: ""
NEXT_PUBLIC_ALCHEMY_KEY= # API key from Alchemy
NEXT_PUBLIC_BASE_PATH= #"/some-base-path"
41 changes: 26 additions & 15 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,33 @@ 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",
'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',
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh', '@typescript-eslint'],
settings: {
react: {
version: 'detect', // Automatically detect the React version
},
},
rules: {
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
// Additional rules can be added here
},
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'react/prop-types': 'off', // Turn off prop-types rule for TypeScript files
0xArdy marked this conversation as resolved.
Show resolved Hide resolved
},
},
],
};
4 changes: 2 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Test
xname: Build and Test
0xArdy marked this conversation as resolved.
Show resolved Hide resolved

on:
pull_request:
Expand All @@ -14,7 +14,7 @@ jobs:
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: "18.7"
node-version: "18.17"
0xArdy marked this conversation as resolved.
Show resolved Hide resolved
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
13 changes: 0 additions & 13 deletions index.html

This file was deleted.

7 changes: 7 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'export', // Outputs a Single-Page Application (SPA).
distDir: './dist', // Changes the build output directory to `./dist/`.
0xArdy marked this conversation as resolved.
Show resolved Hide resolved
};

export default nextConfig;
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
"type": "module",
"license": "MIT",
"author": "Wonderland",
"engines": {
"node": ">=18.17.0"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"dev": "next",
"build": "tsc && next build",
"preview": "next preview",
"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": "vitest"
},
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx}": "eslint --cache --fix",
Expand All @@ -26,6 +28,7 @@
"dependencies": {
"@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",
Expand All @@ -35,14 +38,14 @@
"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",
0xArdy marked this conversation as resolved.
Show resolved Hide resolved
"@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",
"@vitejs/plugin-react": "^4.2.1",
0xArdy marked this conversation as resolved.
Show resolved Hide resolved
"eslint": "8.45.0",
"eslint-config-prettier": "9.0.0",
"eslint-plugin-import": "2.28.1",
Expand All @@ -52,13 +55,11 @@
"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",
"vitest": "^1.4.0"
0xArdy marked this conversation as resolved.
Show resolved Hide resolved
}
}
30 changes: 0 additions & 30 deletions src/App.tsx

This file was deleted.

58 changes: 0 additions & 58 deletions src/GlobalStyle.tsx

This file was deleted.

8 changes: 4 additions & 4 deletions src/config/env.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Env } from '~/types';

export const getEnv = (): Env => {
const { VITE_RPC_URL, VITE_PROJECT_ID, VITE_ALCHEMY_KEY } = import.meta.env;
const { NEXT_PUBLIC_RPC_URL, NEXT_PUBLIC_PROJECT_ID, NEXT_PUBLIC_ALCHEMY_KEY } = process.env;

return {
RPC_URL: VITE_RPC_URL,
PROJECT_ID: VITE_PROJECT_ID,
ALCHEMY_KEY: VITE_ALCHEMY_KEY,
RPC_URL: NEXT_PUBLIC_RPC_URL || '',
PROJECT_ID: NEXT_PUBLIC_PROJECT_ID || '',
ALCHEMY_KEY: NEXT_PUBLIC_ALCHEMY_KEY || '',
};
};
39 changes: 4 additions & 35 deletions src/containers/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,9 @@
import styled from 'styled-components';

export const Footer = () => {
return (
<FooterContainer>
<>
0xArdy marked this conversation as resolved.
Show resolved Hide resolved
<h1>Footer</h1>
<Subtitle>
<p>Made with 💜 by</p>
<a href='https://defi.sucks'>Wonderland</a>
</Subtitle>
</FooterContainer>
<p>Made with 💜 by</p>
<a href='https://defi.sucks'>Wonderland</a>
</>
);
};

const FooterContainer = styled.div`
display: flex;
height: 8rem;
padding: 0 8rem;
align-items: center;
justify-content: space-between;
background-color: ${({ theme }) => theme.headerBackground};
border-top: ${({ theme }) => theme.border};
width: 100%;
max-width: 100vw;
`;

const Subtitle = styled.div`
display: flex;
align-items: center;
gap: 0.8rem;

p {
display: inline-block;
}

a {
text-decoration: none;
color: inherit;
}
`;
29 changes: 3 additions & 26 deletions src/containers/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { ConnectButton } from '@rainbow-me/rainbowkit';
import styled from 'styled-components';

import { useStateContext } from '~/hooks';
import { THEME_KEY } from '~/utils';

Expand All @@ -18,31 +16,10 @@ export const Header = () => {
};

return (
<HeaderContainer>
<div>
0xArdy marked this conversation as resolved.
Show resolved Hide resolved
<h1>Logo</h1>
<ThemeButton onClick={handleThemeChange}>{theme === 'dark' ? '🌞' : '🌕'}</ThemeButton>
<button onClick={handleThemeChange}>{theme === 'dark' ? '🌞' : '🌕'}</button>
<ConnectButton />
</HeaderContainer>
</div>
);
};

const HeaderContainer = styled.div`
display: flex;
height: 8rem;
padding: 0 8rem;
align-items: center;
justify-content: space-between;
background-color: ${({ theme }) => theme.headerBackground};
border-bottom: ${({ theme }) => theme.border};
width: 100%;
max-width: 100vw;
z-index: 100;
`;

const ThemeButton = styled.button`
background-color: inherit;
border: none;
outline: none;
font-size: 2.2rem;
cursor: pointer;
`;
3 changes: 3 additions & 0 deletions src/containers/Landing/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const Landing = () => {
return <h1 data-testid='boilerplate-title'>Web3 React Boilerplate</h1>;
};
Loading