Skip to content

Commit

Permalink
chore: Add github action (#20)
Browse files Browse the repository at this point in the history
* feat: Add test example

* feat: Update examples

* feat: Add disclaimer & download url

* docs: Update example

* docs: Update docs

* docs: Update docs

* docs: Update gitignore

* docs: Update docs

* feat: Add zIndices theme config

* feat: Update examples

* feat: Refactor switch network modal

* refactor: Clean code

* feat: Update examples

* refactor: Update dependencies

* feat: Update version

* docs: Update docs

* chore: Add changeset

* test: Test changeset version

* docs: Create LICENSE

* docs: Update packages info

* chore: Add husky & lint-staged

* abc: test commit lint

* chore: Update husky

* chore: Update husky

* test: test husky

* chore: Add issue & pr template

* fix: Update OpenSwitchNetworkOptions type

* feat: Add options to control modal close

* feat: Add default wallets to walletConnect

* docs: Update useModal document

* refactor: Add className to base components

* chore: Add release github acton

* chore: Add publish ci script

* chore: Fix github action

* chore: Update github action

* test: Test github action

* chore: Add  .pnpm-store to gitignore
  • Loading branch information
wenty22 authored Nov 15, 2023
1 parent a3f373c commit 3b612c2
Show file tree
Hide file tree
Showing 35 changed files with 2,323 additions and 88 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["example-nextjs", "example-vite", "example-test", "website"]
}
5 changes: 5 additions & 0 deletions .changeset/shiny-eggs-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@totejs/walletkit': patch
---

Test github action
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Bug report
about: Create a report to help us improve.
title: '[BUG] '
labels: bug
assignees: ''
---

**Describe the bug**

A clear and concise description of what the bug is.

**Steps to reproduce** Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**

A clear and concise description of what you expected to happen.

**Screenshots**

If applicable, add screenshots to help explain your problem.

**Environment details**

- Wagmi [e.g. 1.0.0]
- WalletKit [e.g. 1.0.0]
- Wallet [e.g. MetaMask ios app v7.9.0, Trust Wallet browser extension v2.0]
- Browser [e.g. Chrome, Firefox]

**Additional context**

Add any other context about the problem here.
32 changes: 32 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Description

<!--- Describe your changes in detail -->

## Issue ticket number and link

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->

- [ ] Docs change / refactoring / dependency upgrade
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist

<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->

- [ ] My code follows the code style of this project.
- [ ] I have updated changeset
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the **CONTRIBUTING** document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
62 changes: 62 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Release
on:
push:
branches:
- main
- dev

env:
CI: true
PNPM_CACHE_FOLDER: .pnpm-store

jobs:
release:
name: release
if: github.repository == 'node-real/walletkit'
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout code repository
uses: actions/checkout@v3
with:
fetch-depth: 0

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

- name: Setup pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
version: 8
run_install: false

- name: Creating .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Setup pnpm config
run: pnpm config set store-dir $PNPM_CACHE_FOLDER

- name: Install dependencies
run: pnpm install

- name: Build packages
run: pnpm --filter "@totejs/**" build

- name: Create and publish versions
uses: changesets/action@v1
with:
version: pnpm ci:version
publish: pnpm ci:publish
commit: 'chore: update versions'
title: 'chore: update versions'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ lerna-debug.log*

node_modules
dist
build
dist-ssr
*.local
.next
Expand All @@ -23,4 +24,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?
.npmrc
.npmrc
.pnpm-store
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"

npx --no-install commitlint --edit $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"

npx lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
'*.{js,jsx,ts,tsx}': ['prettier --write', 'eslint --fix'],
'*.{html,md,mdx}': 'prettier --write',
};
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 node-real

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.
10 changes: 10 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'subject-case': [
2,
'never',
['sentence-case', 'start-case', 'pascal-case', 'upper-case', 'lower-case'],
],
},
};
3 changes: 2 additions & 1 deletion examples/nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "example-nextjs",
"version": "0.1.0",
"version": "0.0.1",
"author": "node-real",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
3 changes: 2 additions & 1 deletion examples/test/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "example-test",
"version": "0.1.0",
"version": "0.0.1",
"author": "node-real",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
10 changes: 7 additions & 3 deletions examples/test/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
getDefaultConfig,
useModal,
} from '@totejs/walletkit';

import { trustWallet, metaMask, walletConnect } from '@totejs/walletkit/wallets';
import { useState } from 'react';

Expand All @@ -31,6 +32,9 @@ const config = createConfig(

const options: WalletKitOptions = {
initialChainId: 56,
closeModalAfterConnected: false,
closeModalOnEsc: true,
closeModalOnOverlayClick: false,
};

export default function App({ Component, pageProps }: AppProps) {
Expand Down Expand Up @@ -58,9 +62,9 @@ function Example() {

return (
<>
<button onClick={onOpen}>Open Connect Modal</button>
<button onClick={onOpenProfile}>Open Profile Modal</button>
<button onClick={onOpenSwitchNetwork}>Open SwitchNetwork Modal</button>
<button onClick={() => onOpen()}>Open Connect Modal</button>
<button onClick={() => onOpenProfile()}>Open Profile Modal</button>
<button onClick={() => onOpenSwitchNetwork()}>Open SwitchNetwork Modal</button>
</>
);
}
3 changes: 2 additions & 1 deletion examples/vite/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "example-vite",
"version": "0.0.1",
"author": "node-real",
"private": true,
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
22 changes: 14 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
{
"name": "walletkit",
"private": true,
"version": "0.0.0",
"type": "module",
"author": "node-real",
"private": true,
"packageManager": "[email protected]",
"description": "Toolkit for connecting wallets.",
"license": "MIT",
"scripts": {
"dev": "pnpm --recursive --parallel --filter example-test --filter @totejs/walletkit dev"
"prepare": "husky install",
"dev": "pnpm --recursive --parallel --filter example-test --filter @totejs/walletkit dev",
"ci:version": "pnpm changeset version && pnpm install",
"ci:publish": "pnpm publish -r"
},
"repository": {
"type": "git",
"url": "git+https://github.com/node-real/walletkit.git"
},
"license": "MIT",
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@commitlint/cli": "^18.4.0",
"@commitlint/config-conventional": "^18.4.0",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"eslint": "^8.53.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.5",
"husky": "^8.0.0",
"lint-staged": "^15.0.2",
"prettier": "^3.0.3"
}
}
13 changes: 13 additions & 0 deletions packages/walletkit/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# @totejs/walletkit

## 1.0.4

### Patch Changes

- Add release github action

## 1.0.3

### Patch Changes

- Add walletConnect recommended wallets
21 changes: 20 additions & 1 deletion packages/walletkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
{
"name": "@totejs/walletkit",
"version": "1.0.2",
"version": "1.0.4",
"author": "node-real",
"private": false,
"description": "WalletKit is a React component library for easily connecting a wallet to your dApp.",
"homepage": "https://node-real.github.io/walletkit",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/node-real/walletkit.git",
"directory": "packages/walletkit"
},
"keywords": [
"walletkit",
"ethereum"
],
"type": "module",
"files": [
"dist",
Expand All @@ -10,6 +24,11 @@
"sideEffects": false,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": "./dist/index.js",
"./styles.css": "./dist/style.css",
"./wallets": "./dist/wallets/index.js"
},
"scripts": {
"dev": "vite build --watch",
"build": "vite build"
Expand Down
4 changes: 3 additions & 1 deletion packages/walletkit/src/base/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export type ButtonProps = BoxProps;
export const Button = React.forwardRef<HTMLElement, ButtonProps>((props: ButtonProps, ref: any) => {
const { className, ...restProps } = props;

return <Box ref={ref} as="button" className={cx(clsButton, className)} {...restProps} />;
return (
<Box ref={ref} as="button" className={cx('wk-button', clsButton, className)} {...restProps} />
);
});

Button.displayName = 'Button';
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const IconButton = (props: IconButtonProps) => {
const { className, icon, ...restProps } = props;

return (
<Button className={cx(clsIconButton, className)} {...restProps}>
<Button className={cx('wk-icon-button', clsIconButton, className)} {...restProps}>
{icon}
</Button>
);
Expand Down
Loading

0 comments on commit 3b612c2

Please sign in to comment.