Skip to content

Commit

Permalink
[idea] Migrate to Vite (#1427)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitayutanov authored Oct 11, 2023
1 parent c90a2af commit 1cceaf2
Show file tree
Hide file tree
Showing 351 changed files with 3,658 additions and 9,396 deletions.
10 changes: 5 additions & 5 deletions idea/frontend/.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
REACT_APP_API_URL=https://idea.gear-tech.io/api
REACT_APP_NODE_ADDRESS=wss://testnet.vara.rs
REACT_APP_HCAPTCHA_SITE_KEY=xxxx-xxxx-xxxx-xxxx-xxxx
REACT_APP_DEFAULT_TRANSFER_BALANCE_VALUE=250000000000
REACT_APP_DEFAULT_NODES_URL=https://idea.gear-tech.io/gear-nodes
VITE_API_URL=https://idea.gear-tech.io/api
VITE_NODE_ADDRESS=wss://testnet.vara-network.io
VITE_HCAPTCHA_SITE_KEY=xxxx-xxxx-xxxx-xxxx-xxxx
VITE_DEFAULT_TRANSFER_BALANCE_VALUE=250000000000
VITE_DEFAULT_NODES_URL=https://idea.gear-tech.io/gear-nodes
72 changes: 36 additions & 36 deletions idea/frontend/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
{
"root": true,
"env": {
"browser": true,
"es2021": true
},
"env": { "browser": true, "es2020": true },

"extends": [
"eslint:recommended",
"plugin:react/recommended",
"airbnb",
"airbnb/hooks",
"airbnb-typescript",

// https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/react-in-jsx-scope.md#when-not-to-use-it
// https://github.com/yannickcr/eslint-plugin-react/issues/3052#issuecomment-1017555974
"plugin:react-hooks/recommended",
"plugin:react/jsx-runtime",

"plugin:import/recommended",
"plugin:jsx-a11y/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json"

"settings": {
"ecmaVersion": "latest",
"react": {
"version": "detect"
},
"import/resolver": {
"typescript": true
}
},
"plugins": ["react", "@typescript-eslint"],
"ignorePatterns": ["src/global.d.ts", "config-overrides.js"],
"rules": {
"react/require-default-props": "off", // we don"t use prop-types

"react/function-component-definition": [
2,
{
"namedComponents": "arrow-function",
"unnamedComponents": "arrow-function"
}
],

"import/prefer-default-export": "off", // force named exports
"import/no-default-export": "error",
"plugins": ["react", "react-hooks", "import", "jsx-a11y", "react-refresh"],

"overrides": [
{
"files": ["*.ts", "*.tsx"],

"@typescript-eslint/no-unused-vars": "warn", // "error" is not convinient in development
"parser": "@typescript-eslint/parser",
"parserOptions": { "project": ["./tsconfig.json"] },

"prefer-destructuring": "off",
"consistent-return": "off", // we want functions to have different return behavior
"extends": [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:import/typescript"
],

"react/jsx-props-no-spreading": [
"error",
{ "exceptions": ["Input", "FileInput", "Textarea", "Select", "NumberFormat", "Radio", "Checkbox"] }
] // disable for form elements, cuz @mantine/form input props needs to be desctructured
}
"plugins": ["@typescript-eslint/eslint-plugin"],

"rules": {
"@typescript-eslint/no-unsafe-enum-comparison": "off",
"@typescript-eslint/no-floating-promises": "off"
}
}
]
}
38 changes: 21 additions & 17 deletions idea/frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.env

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
6 changes: 0 additions & 6 deletions idea/frontend/config-overrides.js

This file was deleted.

12 changes: 12 additions & 0 deletions idea/frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/favicon.png" />
<title>Gear | The Most Advanced Platform for dApp development</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
120 changes: 56 additions & 64 deletions idea/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,72 @@
"version": "0.1.2",
"private": true,
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test",
"eject": "react-scripts eject"
"start": "vite --open",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"@gear-js/api": "0.34.0",
"@gear-js/react-hooks": "0.8.1",
"@gear-js/ui": "0.5.19",
"@hcaptcha/react-hcaptcha": "^1.4.4",
"@mantine/form": "^5.4.0",
"@hcaptcha/react-hcaptcha": "1.8.1",
"@mantine/form": "7.1.2",
"@polkadot/api": "10.9.1",
"@polkadot/extension-dapp": "0.46.5",
"@polkadot/react-identicon": "2.9.14",
"@polkadot/react-identicon": "3.6.3",
"@polkadot/types": "10.9.1",
"@polkadot/util": "12.3.2",
"@react-aria/utils": "^3.14.2",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"assert": "^2.0.0",
"bignumber.js": "9.1.1",
"buffer": "^6.0.3",
"clsx": "^1.2.1",
"final-form": "^4.20.7",
"ky": "^0.31.1",
"localforage": "^1.10.0",
"lodash.isequal": "^4.5.0",
"lodash.isplainobject": "^4.0.6",
"lodash.isstring": "^4.0.1",
"lodash.throttle": "^4.1.1",
"react": "^18.2.0",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.10",
"react-final-form": "^6.5.9",
"react-final-form-listeners": "^1.0.3",
"react-number-format": "^4.9.3",
"react-router-dom": "^6.3.0",
"react-scripts": "^5.0.1",
"react-transition-group": "^4.4.5",
"simplebar-react": "^2.4.1",
"web-vitals": "^2.1.4",
"yup": "^0.32.11"
"@polkadot/util": "12.5.1",
"@react-aria/utils": "3.21.0",
"bignumber.js": "9.1.2",
"clsx": "2.0.0",
"final-form": "4.20.10",
"ky": "1.0.1",
"localforage": "1.10.0",
"lodash.isequal": "4.5.0",
"lodash.isplainobject": "4.0.6",
"lodash.isstring": "4.0.1",
"lodash.throttle": "4.1.1",
"react": "18.2.0",
"react-dnd": "16.0.1",
"react-dnd-html5-backend": "16.0.1",
"react-dom": "18.2.0",
"react-error-boundary": "4.0.11",
"react-final-form": "6.5.9",
"react-final-form-listeners": "1.0.3",
"react-number-format": "5.3.1",
"react-router-dom": "6.16.0",
"react-transition-group": "4.4.5",
"simplebar-react": "3.2.4",
"yup": "1.3.2"
},
"devDependencies": {
"@types/jest": "^27.5.2",
"@types/lodash.isequal": "^4.5.6",
"@types/lodash.isplainobject": "^4.0.7",
"@types/lodash.isstring": "^4.0.7",
"@types/lodash.throttle": "^4.1.7",
"@types/node": "^16.11.54",
"@types/react": "^18.0.21",
"@types/react-dom": "^18.0.6",
"@types/react-final-form-listeners": "^1.0.0",
"@types/react-transition-group": "^4.4.5",
"@typescript-eslint/eslint-plugin": "^5.34.0",
"@typescript-eslint/parser": "^5.34.0",
"eslint": "^8.22.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"msw": "^0.45.0",
"react-app-rewired": "^2.2.1",
"sass": "^1.54.5",
"typescript": "^4.7.4"
},
"eslintConfig": {
"extends": "react-app"
"@types/lodash.isequal": "4.5.6",
"@types/lodash.isplainobject": "4.0.7",
"@types/lodash.isstring": "4.0.7",
"@types/lodash.throttle": "4.1.7",
"@types/node": "20.8.4",
"@types/react": "18.2.27",
"@types/react-dom": "18.2.12",
"@types/react-final-form-listeners": "1.0.1",
"@types/react-transition-group": "4.4.7",
"@typescript-eslint/eslint-plugin": "6.7.5",
"@typescript-eslint/parser": "6.7.5",
"@vitejs/plugin-react": "4.1.0",
"eslint": "8.51.0",
"eslint-config-prettier": "9.0.0",
"eslint-import-resolver-typescript": "3.6.1",
"eslint-plugin-import": "2.28.1",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-react": "7.33.2",
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.3",
"sass": "1.69.1",
"typescript": "5.2.2",
"vite": "4.4.11",
"vite-plugin-eslint": "1.8.1",
"vite-plugin-node-polyfills": "0.15.0",
"vite-plugin-svgr": "4.1.0"
},
"browserslist": {
"production": [
Expand Down
File renamed without changes
Binary file not shown.
Binary file not shown.
Binary file removed idea/frontend/public/favicons/android-icon-36x36.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/android-icon-48x48.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/android-icon-72x72.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/android-icon-96x96.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/apple-icon-114x114.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/apple-icon-120x120.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/apple-icon-144x144.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/apple-icon-152x152.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/apple-icon-180x180.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/apple-icon-57x57.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/apple-icon-60x60.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/apple-icon-72x72.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/apple-icon-76x76.png
Binary file not shown.
Binary file not shown.
Binary file removed idea/frontend/public/favicons/apple-icon.png
Binary file not shown.
2 changes: 0 additions & 2 deletions idea/frontend/public/favicons/browserconfig.xml

This file was deleted.

Binary file removed idea/frontend/public/favicons/favicon-16x16.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/favicon-96x96.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/favicon.ico
Binary file not shown.
41 changes: 0 additions & 41 deletions idea/frontend/public/favicons/manifest.json

This file was deleted.

Binary file removed idea/frontend/public/favicons/ms-icon-144x144.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/ms-icon-150x150.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/ms-icon-310x310.png
Binary file not shown.
Binary file removed idea/frontend/public/favicons/ms-icon-70x70.png
Binary file not shown.
28 changes: 0 additions & 28 deletions idea/frontend/public/index.html

This file was deleted.

6 changes: 3 additions & 3 deletions idea/frontend/src/api/LocalDB.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { HexString } from '@polkadot/util/types';
import localForage from 'localforage';

import { IProgram } from 'features/program';
import { LocalStorage } from 'shared/config';
import { IMeta } from 'entities/metadata';
import { IProgram } from '@/features/program';
import { LocalStorage } from '@/shared/config';
import { IMeta } from '@/entities/metadata';

const PROGRAMS_LOCAL_FORAGE = localForage.createInstance({ name: 'programs' });
const METADATA_LOCAL_FORAGE = localForage.createInstance({ name: 'metadata' });
Expand Down
4 changes: 2 additions & 2 deletions idea/frontend/src/api/balance/requests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { rpcService } from 'shared/services/rpcService';
import { RpcMethods } from 'shared/config';
import { rpcService } from '@/shared/services/rpcService';
import { RpcMethods } from '@/shared/config';

import { FetchTestBalanceParams } from './types';

Expand Down
Loading

0 comments on commit 1cceaf2

Please sign in to comment.