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

feat: Remove docs and playground packages #300

Closed
wants to merge 5 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
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/web-lib/.eslintrc.cjs → .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module.exports = {
'eslint:recommended',
'plugin:import/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:tailwindcss/recommended',
'plugin:@typescript-eslint/recommended',
'next/core-web-vitals'
Expand Down Expand Up @@ -87,6 +86,7 @@ module.exports = {
'no-multi-spaces': ['error', {ignoreEOLComments: false}],
'@typescript-eslint/no-var-requires': 0,
'@typescript-eslint/no-unused-vars': 2,
'@typescript-eslint/no-explicit-any': [1],
'@typescript-eslint/array-type': ['error', {'default': 'array'}],
'@typescript-eslint/consistent-type-assertions': ['error', {'assertionStyle': 'as', 'objectLiteralTypeAssertions': 'never'}],
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,9 @@ jobs:
with:
node-version: 16

- name: Move to dir
run: cd packages/web-lib

- name: Install project dependencies
run: yarn --prefer-offline
id: install

- name: Run linters
uses: wearerequired/lint-action@v2
with:
eslint: true
run: yarn lint
File renamed without changes.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 yearn
Copyright (c) 2023 yearn

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,8 @@ This repo is mirrored on [NPM](https://www.npmjs.com/package/@yearn-finance/web-
yarn add @yearn-finance/web-lib
```

### Useful Commands
- `yarn dev` - Run all packages locally

### Apps & Packages
The following packages and applications are available

- `package/docs`: Documentation site for the library
- `packages/web-lib`: Actual library for Yearn's projects

Each package and app is 100% [TypeScript](https://www.typescriptlang.org/).


### Releasing
When running `yarn build` in the `package/web-lib` folder, the library will be bumped to the next minor version, the code will be compiled and the various files will be copied in the `package/web-lib/dist` folder.
When running `yarn build` in the root folder, the library will be bumped to the next minor version, the code will be compiled and the various files will be copied in the `dist` folder.
From there the library can be published to NPM via the `yarn publish ./dist` command.

### How to setup
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<div className={'relative z-50 mr-4'}>
<Listbox
value={safeChainID}
onChange={(value: any): void => onSwitchChain(value.value)}>

Check warning on line 89 in components/Header.tsx

View workflow job for this annotation

GitHub Actions / Run linters

Unexpected any. Specify a different type
{({open: isOpen}): ReactElement => (
<>
<Listbox.Button
Expand All @@ -109,7 +109,7 @@
leave={'transition duration-75 ease-out'}
leaveFrom={'transform scale-100 opacity-100'}
leaveTo={'transform scale-95 opacity-0'}>
<Listbox.Options className={'yearn--listbox-menu yearn--shadow bg-neutral-0 -ml-1'}>
<Listbox.Options className={'yearn--listbox-menu yearn--shadow -ml-1 bg-neutral-0'}>
{supportedNetworks.map((network): ReactElement => (
<Listbox.Option key={network.value} value={network}>
{({active: isActive}): ReactElement => (
Expand Down Expand Up @@ -164,7 +164,7 @@
<span>
<IconWallet
className={'yearn--header-nav-item mt-0.5 block h-4 w-4 md:hidden'} />
<span className={'text-neutral-0 relative hidden h-8 cursor-pointer items-center justify-center border border-transparent bg-neutral-900 px-2 text-xs font-normal transition-all hover:bg-neutral-800 md:flex'}>
<span className={'relative hidden h-8 cursor-pointer items-center justify-center border border-transparent bg-neutral-900 px-2 text-xs font-normal text-neutral-0 transition-all hover:bg-neutral-800 md:flex'}>
{'Connect wallet'}
</span>
</span>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, {cloneElement, useCallback} from 'react';
import {useWeb3} from '@yearn-finance/web-lib//contexts/useWeb3';
import {Modal} from '@yearn-finance/web-lib/components/Modal';
import {yToast} from '@yearn-finance/web-lib/components/yToast';
import {useWeb3} from '@yearn-finance/web-lib/contexts/useWeb3';
import {useInjectedWallet} from '@yearn-finance/web-lib/hooks/useInjectedWallet';
import IconWalletWalletConnect from '@yearn-finance/web-lib/icons/IconWalletWalletConnect';

Expand All @@ -21,7 +21,12 @@ function ModalLogin(props: TModalLogin): ReactElement {
const onInjectedConnect = useCallback((): void => {
onConnect(
detectedWalletProvider.type,
(error): string => toast({content: error?.message ?? 'Impossible to connect wallet', type: 'error'}),
(error: unknown): string => {
if (!error || typeof error !== 'object' || !('message' in error) || typeof error.message !== 'string') {
return toast({content: 'Impossible to connect wallet', type: 'error'});
}
return toast({content: error.message, type: 'error'});
},
(): void => onClose()
);
}, [detectedWalletProvider, onConnect, onClose, toast]);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export const Web3ContextAppWrapper = ({children, options}: {children: ReactEleme
isConnecting,
isDisconnected,
ens: ensName || '',
isActive: isConnected && [...supportedChainsID, 1337].includes(chain?.id || -1) && isMounted(),
isActive: isConnected && supportedChainsID.includes(chain?.id || -1) && isMounted(),
lensProtocolHandle: '',
hasProvider: !!(walletClient || publicClient),
provider: connector,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 0 additions & 5 deletions lerna.json

This file was deleted.

128 changes: 112 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,113 @@
{
"name": "@yearn-finance/web-lib-root",
"version": "0.13.28",
"private": true,
"workspaces": [
"packages/*"
],
"devDependencies": {
"lerna": "5.1.6"
},
"scripts": {
"bootstrap": "lerna bootstrap --hoist",
"start": "lerna run dev --stream",
"watch": "lerna run watch --stream",
"lint": "lerna run lint --stream"
}
}
"name": "@yearn-finance/web-lib",
"version": "0.20.96",
"files": [
"."
],
"type": "module",
"scripts": {
"dev": "tsc --watch",
"exportStyle": "npx tailwindcss --postcss -c ./tailwind.config.cjs -i style.css -o dist/build.css --minify && sed -i -e 's/rem/em/g' dist/build.css",
"exportNextStyle": "npx tailwindcss --postcss -c ./tailwind.config.cjs -i style.css -o dist/build.css --minify && sed -i -e 's/rem/em/g' dist/build.css",
"prebuild": "rm -rf dist",
"build": "bump && tsc --module es2022 --outDir dist --jsx react",
"buildNoBump": "tsc --module es2022 --outDir dist --jsx react",
"postbuild": "sh ./scripts/postbuild.sh && npm run exportStyle && npm run exportNextStyle",
"lint": "eslint --ext .js,.jsx,.ts,.tsx .",
"test": "yarn node --experimental-vm-modules $(yarn bin jest)"
},
"dependencies": {
"@babel/preset-typescript": "^7.22.5",
"@headlessui/react": "^1.7.15",
"@ledgerhq/iframe-provider": "^0.4.3",
"@react-hookz/deep-equal": "^1.0.4",
"@react-hookz/web": "^23.1.0",
"@safe-global/safe-apps-provider": "^0.17.0",
"@safe-global/safe-apps-sdk": "^7.11.0",
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/typography": "^0.5.9",
"@types/node": "^20.4.2",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@wagmi/core": "^1.3.8",
"axios": "^1.4.0",
"babel-loader": "^9.1.3",
"dayjs": "^1.11.8",
"eslint": "^8.44.0",
"eslint-config-next": "^13.4.9",
"eslint-plugin-tailwindcss": "^3.13.0",
"eslint-plugin-unused-imports": "^3.0.0",
"graphql": "^16.6.0",
"graphql-request": "^6.1.0",
"nprogress": "^0.2.0",
"postcss": "^8.4.25",
"postcss-nesting": "^12.0.0",
"react": "18.2.0",
"react-dom": "^18.2.0",
"react-hot-toast": "2.4.1",
"sass": "^1.63.6",
"sharp": "^0.32.2",
"tailwindcss": "^3.3.3",
"ts-jest": "^29.1.1",
"ts-loader": "^9.4.4",
"tsup": "^7.1.0",
"typescript": "^5.1.6",
"viem": "^1.3.0",
"wagmi": "^1.3.9",
"zod": "^3.21.4"
},
"devDependencies": {
"@babel/preset-typescript": "^7.21.5",
"@types/express": "^4.17.17",
"@types/ioredis": "^4.28.10",
"@types/jest": "29.5.2",
"@types/node": "^20.2.5",
"@types/nprogress": "^0.2.0",
"@types/react": "^18.2.8",
"@types/react-dom": "^18.2.4",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"autoprefixer": "^10.4.14",
"babel-loader": "^9.1.2",
"bump": "^0.2.5",
"eslint": "^8.42.0",
"eslint-config-next": "^13.4.4",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-brackets": "^0.1.3",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-tailwindcss": "^3.12.1",
"eslint-plugin-unused-imports": "^2.0.0",
"jest": "^29.5.0",
"postcss": "^8.4.24",
"postcss-import": "^15.1.0",
"postcss-nesting": "^11.2.2",
"sass": "^1.62.1",
"sharp": "^0.32.1",
"tailwindcss": "^3.3.2",
"ts-jest": "^29.1.0",
"ts-loader": "^9.4.3",
"tsup": "^6.7.0",
"typescript": "^5.1.3"
},
"peerDependencies": {
"@headlessui/react": ">= 1.7.0",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"eslint": ">= 8.25.0",
"eslint-config-next": ">= 12.3.1",
"eslint-import-resolver-typescript": ">= 3.5.1",
"eslint-plugin-brackets": ">= 0.1.3",
"eslint-plugin-import": ">= 2.26.0",
"eslint-plugin-react": ">= 7.31.10",
"eslint-plugin-simple-import-sort": ">= 8.0.0",
"eslint-plugin-tailwindcss": ">= 3.6.2",
"eslint-plugin-unused-imports": ">= 2.0.0",
"react": ">= 17.0.0",
"react-dom": ">= 17.0.0"
}
}
13 changes: 0 additions & 13 deletions packages/docs/.eslintrc.js

This file was deleted.

16 changes: 0 additions & 16 deletions packages/docs/components/CodeExample.tsx

This file was deleted.

70 changes: 0 additions & 70 deletions packages/docs/components/Header.tsx

This file was deleted.

20 changes: 0 additions & 20 deletions packages/docs/components/RadialBackground.tsx

This file was deleted.

Loading
Loading