Skip to content

Commit

Permalink
-Added babel instead of tsc for better transpiling of code to both /c…
Browse files Browse the repository at this point in the history
…ore and /react packages

-Added source maps to the outputs
-Remove unnecessary dependencies
-Removed unused assets folder from /react
-Fixed issue with the 'react-icons' package react-icons/react-icons#593
  • Loading branch information
Carson Aberle committed Jul 24, 2023
1 parent d0c1344 commit 479a412
Show file tree
Hide file tree
Showing 9 changed files with 744 additions and 45 deletions.
10 changes: 10 additions & 0 deletions packages/core/babel.config.json
@@ -0,0 +1,10 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-transform-runtime"
]
}
20 changes: 13 additions & 7 deletions packages/core/package.json
Expand Up @@ -5,11 +5,11 @@
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "yarn clean && tsc",
"clean": "rimraf dist",
"format": "eslint --fix . && prettier 'src/**/*.ts' --write --ignore-path .gitignore",
"lint": "eslint --ignore-path .eslintignore .",
"test": "jest"
"prebuild": "rimraf dist",
"build": "yarn build:types && yarn build:js && yarn build:prettier",
"build:types": "tsc --project tsconfig.declarations.json",
"build:js": "babel src --out-dir dist --extensions '.js,.jsx,.ts,.tsx' --source-maps --copy-files",
"build:prettier": "prettier --write dist"
},
"homepage": "https://github.com/sei-protocol/sei-js#readme",
"keywords": [
Expand Down Expand Up @@ -37,5 +37,11 @@
"readonly-date": "^1.0.0",
"xstream": "^11.14.0"
},
"devDependencies": {}
}
"devDependencies": {
"@babel/core": "^7.22.9",
"@babel/plugin-transform-runtime": "^7.22.9",
"@babel/preset-env": "^7.22.9",
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5"
}
}
9 changes: 9 additions & 0 deletions packages/core/tsconfig.declarations.json
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true
},
"include": ["src"],
"exclude": ["node_modules", "**/*.test.ts"]
}
10 changes: 10 additions & 0 deletions packages/react/babel.config.json
@@ -0,0 +1,10 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-transform-runtime"
]
}
29 changes: 17 additions & 12 deletions packages/react/package.json
Expand Up @@ -5,12 +5,11 @@
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "yarn clean && tsc && yarn copy-assets && yarn copyfiles -u 1 src/**/*.css dist/",
"clean": "rimraf dist",
"copy-assets": "cp -r src/lib/assets dist/lib",
"format": "eslint --fix . && prettier 'src/**/*.ts' --write --ignore-path .gitignore",
"lint": "eslint --ignore-path .eslintignore .",
"test": "jest --passWithNoTests"
"prebuild": "rimraf dist",
"build": "yarn build:types && yarn build:js && yarn build:prettier",
"build:types": "tsc --project tsconfig.declarations.json",
"build:js": "babel src --out-dir dist --extensions '.js,.jsx,.ts,.tsx' --source-maps --copy-files",
"build:prettier": "prettier --write dist"
},
"homepage": "https://github.com/sei-protocol/sei-js#readme",
"keywords": [
Expand All @@ -23,18 +22,24 @@
"license": "MIT",
"private": false,
"dependencies": {
"@sei-js/core": "1.4.1",
"react-outside-click-handler": "^1.3.0",
"react-icons": "4.9.0",
"copyfiles": "^2.4.1"
"@react-icons/all-files": "^4.1.0",
"@sei-js/core": "^1.4.1",
"react-outside-click-handler": "^1.3.0"
},
"peerDependencies": {
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
},
"devDependencies": {
"react": "^17.0.0 || ^18.0.0",
"@babel/core": "^7.22.9",
"@babel/plugin-transform-runtime": "^7.22.9",
"@babel/preset-env": "^7.22.9",
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"@types/react": "^17.0.0 || ^18.0.0",
"@types/react-outside-click-handler": "^1.3.1"
"@types/react-outside-click-handler": "^1.3.1",
"prettier": "^3.0.0",
"react": "^17.0.0 || ^18.0.0",
"typescript": "5.1.6"
}
}
@@ -1,11 +1,13 @@
import React, { useContext, useEffect, useState } from 'react';
import OutsideClickHandler from 'react-outside-click-handler';
import { IconContext } from 'react-icons';
import { IoCopyOutline, IoLogOutOutline, IoWalletOutline } from 'react-icons/io5';
import { SeiWalletContext } from '../../provider';
import { WalletConnectButtonProps } from './types';
import './styles.css';
import { isValidCSSColor } from '../../utils';
import { IconContext } from '@react-icons/all-files';
import { IoWalletOutline } from '@react-icons/all-files/io5/IoWalletOutline';
import { IoLogOutOutline } from '@react-icons/all-files/io5/IoLogOutOutline';
import { IoCopyOutline } from '@react-icons/all-files/io5/IoCopyOutline';

export const truncateAddress = (address: string) => `${address.slice(0, 3)}....${address.slice(address.length - 5)}`;

Expand Down
Expand Up @@ -2,9 +2,10 @@ import React, { useContext, useEffect, useState } from 'react';
import { WalletSelectModalProps } from './types';
import { SeiWallet, SeiWalletContext } from '../../provider';
import './styles.css';
import { AiFillCloseCircle } from 'react-icons/ai';
import { BiError, BiErrorAlt } from 'react-icons/bi';
import { FaCheckCircle } from 'react-icons/fa';
import { AiFillCloseCircle } from '@react-icons/all-files/ai/AiFillCloseCircle';
import { BiErrorAlt } from '@react-icons/all-files/bi/BiErrorAlt';
import { BiError } from '@react-icons/all-files/bi/BiError';
import { FaCheckCircle } from '@react-icons/all-files/fa/FaCheckCircle';

const WalletSelectModal = ({ wallets: inputWallets }: WalletSelectModalProps) => {
const { connectedWallet, setTargetWallet, wallets, connectionError, targetWallet, setConnectionError, showConnectModal, setShowConnectModal } =
Expand Down
9 changes: 9 additions & 0 deletions packages/react/tsconfig.declarations.json
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"emitDeclarationOnly": true
},
"include": ["src"],
"exclude": ["node_modules", "**/*.test.ts"]
}

0 comments on commit 479a412

Please sign in to comment.