Skip to content

Commit

Permalink
chore: Add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
wenty22 committed Nov 15, 2023
1 parent 61e2a16 commit 6aac673
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "release",
"baseBranch": "0.x",
"updateInternalDependencies": "patch",
"ignore": ["example-nextjs", "example-vite", "example-test", "website"]
}
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
- 0.x

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 }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?
.npmrc
.npmrc
.pnpm-store
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
"author": "node-real",
"private": true,
"packageManager": "[email protected]",
"description": "Toolkit for connecting wallets.",
"license": "MIT",
"scripts": {
"prepare": "husky install",
"dev": "pnpm --recursive --parallel --filter example-test --filter @totejs/walletkit dev"
"dev": "pnpm --recursive --parallel --filter example-test --filter @totejs/walletkit dev",
"ci:version": "pnpm changeset version && pnpm install",
"ci:publish": "pnpm publish -r"
},
"devDependencies": {
"@changesets/cli": "^2.26.2",
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
8 changes: 7 additions & 1 deletion packages/walletkit/src/base/components/Link/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ export const Link = (props: LinkProps) => {
const { className, ...restProps } = props;

return (
<Box as="a" className={cx(clsLink, className)} target="_blank" rel="noopener" {...restProps} />
<Box
as="a"
className={cx('wk-link', clsLink, className)}
target="_blank"
rel="noopener"
{...restProps}
/>
);
};

Expand Down
18 changes: 18 additions & 0 deletions packages/walletkit/src/base/utils/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export function isObject(item: any) {
return item && typeof item === 'object' && !Array.isArray(item) && item !== null;
}

export function deepMerge(target: any, source: any) {
if (isObject(target) && isObject(source)) {
for (const key in source) {
if (isObject(source[key])) {
if (!target[key]) Object.assign(target, { [key]: {} });
deepMerge(target[key], source[key]);
} else {
Object.assign(target, { [key]: source[key] });
}
}
}

return target;
}
2 changes: 1 addition & 1 deletion packages/walletkit/src/components/ThemeProvider/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEffect, useMemo, useState } from 'react';
import { CustomTheme, base } from '../../themes/base';
import { deepMerge } from '../../utils/common';
import { ColorMode, ThemeContext } from './context';
import { deepMerge } from '../../base/utils/common';

export type ThemeMode = 'auto' | ColorMode;

Expand Down
19 changes: 0 additions & 19 deletions packages/walletkit/src/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,3 @@ export function commonErrorHandler(props: { log: any; handler: any; error: any }
handler?.(error, description);
}
}

export function isObject(item: any) {
return item && typeof item === 'object' && !Array.isArray(item) && item !== null;
}

export function deepMerge(target: any, source: any) {
if (isObject(target) && isObject(source)) {
for (const key in source) {
if (isObject(source[key])) {
if (!target[key]) Object.assign(target, { [key]: {} });
deepMerge(target[key], source[key]);
} else {
Object.assign(target, { [key]: source[key] });
}
}
}

return target;
}
10 changes: 10 additions & 0 deletions packages/walletkit/src/wallets/walletConnect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ export function walletConnect(props: WalletConnectProps = {}): WalletProps {
icons: [appIcon!],
}
: undefined,
qrModalOptions: {
explorerRecommendedWalletIds: [
'8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4',
'971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709',
'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa',
'7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26',
'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96',
'4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0',
],
},
...connectorOptions,
},
});
Expand Down
6 changes: 3 additions & 3 deletions website/src/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ import { useModal } from '@totejs/walletkit';

const { isOpen, onOpen, onClose, onOpenProfile, onOpenSwitchNetwork } = useModal();

<button onClick={onOpen}>Open Connect Modal</button>
<button onClick={onOpenProfile}>Open Connected Modal</button>
<button onClick={onOpenSwitchNetwork}>Open SwitchNetwork Modal</button>
<button onClick={() => onOpen()}>Open Connect Modal</button>
<button onClick={() => onOpenProfile()}>Open Connected Modal</button>
<button onClick={() => onOpenSwitchNetwork()}>Open SwitchNetwork Modal</button>
```

## Customizing wallets
Expand Down

0 comments on commit 6aac673

Please sign in to comment.