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

Setup the React Components project #60

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4ab931f
feat: add wallet set overview components
krzysu Nov 21, 2024
e6ef760
feat: setup remix as a base for demo webapp
avkos Nov 26, 2024
8a48a5e
feat: migrate the components
krzysu Nov 28, 2024
b73b455
setup storybook
krzysu Nov 28, 2024
88e61bc
setup eslint
krzysu Nov 28, 2024
1582c9a
remove vite single page app
krzysu Nov 28, 2024
279d87f
remove vite single page app
krzysu Nov 28, 2024
74448cf
new wallet dialog
krzysu Nov 28, 2024
cc01d85
wallet sets page
krzysu Dec 3, 2024
10dcd7b
initialize `web3-circle-react-components`
Muhammad-Altabba Dec 9, 2024
ceea956
Merge remote-tracking branch 'origin/main' into 54-react-components-p…
Muhammad-Altabba Dec 10, 2024
dd8fbf7
Merge remote-tracking branch 'origin/main' into 54-react-components-p…
Muhammad-Altabba Dec 10, 2024
3369d60
rename to circle-react-components
Muhammad-Altabba Dec 10, 2024
5815fce
few edits
Muhammad-Altabba Dec 10, 2024
e2d188d
tiny fix and comment added
Muhammad-Altabba Dec 11, 2024
11e32df
Merge remote-tracking branch 'origin/main' into 54-react-components-p…
Muhammad-Altabba Dec 11, 2024
319630a
re align with main branch
Muhammad-Altabba Dec 11, 2024
4fae02f
delete unneeded file
Muhammad-Altabba Dec 11, 2024
b3d4f1f
tiny dependency update
Muhammad-Altabba Dec 11, 2024
c46f7e7
Update packages/circle-react-components/README.md
Muhammad-Altabba Dec 11, 2024
7eb74cb
few edits to config files
Muhammad-Altabba Dec 11, 2024
22b189c
Merge branch 'main' into 54-react-components-project-setup
Muhammad-Altabba Dec 20, 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ node_modules
.idea
.vscode
tmp
.history
.yarn/install-state.gz
packages/circle-demo-webapp/storybook-static
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint && npx lint-staged
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20
934 changes: 934 additions & 0 deletions .yarn/releases/yarn-4.5.3.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.5.3.cjs
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"lint": "yarn workspace web3-circle-sdk lint",
"build": "yarn workspace web3-circle-sdk build",
"build:docs": "yarn workspace web3-circle-sdk build:docs",
"test": "yarn workspace web3-circle-sdk test"
"test": "yarn workspace web3-circle-sdk test",
"prepare": "husky install"
},
"packageManager": "yarn@1.22.22"
"packageManager": "yarn@4.5.3"
}
6 changes: 3 additions & 3 deletions packages/circle-demo-webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
"@types/node": "^22.9.0",
"@types/react": "^18.2.20",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"@typescript-eslint/eslint-plugin": "8.17.0",
"@typescript-eslint/parser": "^8.17.0",
"@vitejs/plugin-react": "^4.3.3",
"autoprefixer": "^10.4.19",
"eslint": "^8.38.0",
"eslint": "8.57.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
Expand Down
20 changes: 20 additions & 0 deletions packages/circle-react-components/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ['plugin:react/recommended', 'standard-with-typescript', 'prettier', 'plugin:storybook/recommended'],
overrides: [],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['react'],
rules: {
'react/jsx-key': 'off',
'react/react-in-jsx-scope': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'no-console': 'warn',
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
on:
push:
branches:
- main

permissions:
contents: write
packages: write
pull-requests: write

name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Release
id: release
if: ${{ github.ref_name == 'main' }}
uses: google-github-actions/release-please-action@v3
with:
release-type: node
default-branch: main
token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v3
if: ${{ steps.release.outputs.releases_created }}

- name: Install pnpm
uses: pnpm/action-setup@v2
if: ${{ steps.release.outputs.releases_created }}
with:
version: 8

# Setup .npmrc file to publish to npm
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://npm.pkg.github.com'
cache: 'pnpm'
if: ${{ steps.release.outputs.releases_created }}

- name: CI
run: pnpm install --frozen-lockfile
if: ${{ steps.release.outputs.releases_created }}

- name: Build
run: pnpm build:lib
if: ${{ steps.release.outputs.releases_created }}

- name: Prepublish
run: pnpm ci-prepublish
if: ${{ steps.release.outputs.releases_created }}

- name: Publish
run: pnpm publish
if: ${{ steps.release.outputs.releases_created }}
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Release
id: release
if: ${{ github.ref_name == 'main' }}
uses: google-github-actions/release-please-action@v3
with:
release-type: node
default-branch: main
token: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v3
if: ${{ steps.release.outputs.releases_created }}

- name: Install pnpm
uses: pnpm/action-setup@v2
if: ${{ steps.release.outputs.releases_created }}
with:
version: 8

# Setup .npmrc file to publish to npm
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
if: ${{ steps.release.outputs.releases_created }}

- name: CI
run: pnpm install --frozen-lockfile
if: ${{ steps.release.outputs.releases_created }}

- name: Build
run: pnpm build:lib
if: ${{ steps.release.outputs.releases_created }}

- name: Prepublish
run: pnpm ci-prepublish
if: ${{ steps.release.outputs.releases_created }}

- name: Publish
run: pnpm publish
if: ${{ steps.release.outputs.releases_created }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
30 changes: 30 additions & 0 deletions packages/circle-react-components/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# Storybook
storybook-static

# Testing
coverage
7 changes: 7 additions & 0 deletions packages/circle-react-components/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": false,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 120,
"endOfLine": "auto"
}
22 changes: 22 additions & 0 deletions packages/circle-react-components/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { StorybookConfig } from '@storybook/react-vite'
const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-styling-webpack',
],
framework: {
name: '@storybook/react-vite',
options: {
builder: {
viteConfigPath: '.storybook/vite.config.ts',
},
},
},
docs: {
autodocs: 'tag',
},
}
export default config
16 changes: 16 additions & 0 deletions packages/circle-react-components/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Preview } from '@storybook/react'
import '../src/lib/tailwind/theme.css'

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
}

export default preview
17 changes: 17 additions & 0 deletions packages/circle-react-components/.storybook/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import react from '@vitejs/plugin-react'
import { defineConfig } from 'vitest/config'
import tailwindcss from 'tailwindcss'
import { UserConfigExport } from 'vite'

const app = async (): Promise<UserConfigExport> => {
return defineConfig({
plugins: [react()],
css: {
postcss: {
plugins: [tailwindcss],
},
},
})
}
// https://vitejs.dev/config/
export default app
1 change: 1 addition & 0 deletions packages/circle-react-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
22 changes: 22 additions & 0 deletions packages/circle-react-components/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) [2024] [ChainSafe]
Copyright (c) [2023] [Ignacio Andrés Miranda Figueroa] (https://github.com/IgnacioNMiranda/vite-component-library-template)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
41 changes: 41 additions & 0 deletions packages/circle-react-components/MAINTAINERS_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Notes for maintainers

Built and tested with node v20.

## Features

- ⚛️ [React 18](https://reactjs.org/)
- 📚 [Storybook 7](https://storybook.js.org/) - Components preview
- 🖌️ [Tailwind CSS 3](https://tailwindcss.com/)
- ⏩ [Vite](https://vitejs.dev/) - Run and build the project blazingly fast!
- ⚡ [Vitest](https://vitest.dev/) - Components Unit Testing
- 📐 [ESLint](https://eslint.org/) & [Prettier](https://prettier.io/) - Formatting and Linting
- 🌟 [Typescript](https://www.typescriptlang.org/)
- 🐶 [Husky](https://typicode.github.io/husky) & [Lint Staged](https://www.npmjs.com/package/lint-staged) - Pre-commit Hooks
- ⏰ [Release Please](https://github.com/googleapis/release-please) — Generate the changelog with the release-please workflow
- 👷 [Github Actions](https://github.com/features/actions) — Releasing versions to NPM
- Initial components setup using [Atomic Design](https://bradfrost.com/blog/post/atomic-web-design/)

## Getting Started

1. Clone your repo
2. Install dependencies with `yarn`
3. Run `yarn prepare` command to setup [Husky](https://typicode.github.io/husky) pre-commit hooks.
4. Run `yarn build` to build.
5. Check the scripts at [this-folder]/package.json like `yarn dev` to run the `storybook`.

## Main Scripts

Always prepending `yarn`:

- `dev`: Bootstrap the Storybook preview with Hot Reload.
- `build:storybook`: Builds the static storybook project.
- `build`: Builds the component library into the **dist** folder.
- `lint:fix`: Applies linting based on the rules defined in **.eslintrc.js**.
- `format:prettier`: Formats files using the prettier rules defined in **.prettierrc**.
- `test`: Runs testing using watch mode.
- `test:cov`: Runs testing displaying a coverage report.

## Used template

This template was created based on: [here](https://igna.hashnode.dev/vite-react-typescript-component-library-template-setup-explanation).
7 changes: 7 additions & 0 deletions packages/circle-react-components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ⚛️⚡ Web3 Circle React Components

A project containing the Web3 Circle React Components.

---

Note: You are welcome to contribute. And if you want to create a Pull Request check the file ./MAINTAINERS_NOTES.md.
Loading
Loading