refactor: migrate project to react18, tailwind3, storybook6

This commit is contained in:
MTG2000
2022-04-20 17:42:16 +03:00
parent 3fe65e02e9
commit c11bfa0c7e
11 changed files with 34656 additions and 27729 deletions

2
.gitignore vendored
View File

@@ -7,7 +7,7 @@ environments/.dev.preview-server.env
# dependencies
/node_modules
/node_modules2
/node_modules_t
/.pnp
.pnp.js

View File

@@ -1,41 +1,19 @@
const path = require("path");
module.exports = {
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/preset-create-react-app",
"@storybook/addon-interactions",
"@storybook/preset-create-react-app"
],
webpackFinal: async (config) => {
config.module.rules.push({
test: /\.css$/,
use: [
{
loader: "postcss-loader",
options: {
ident: "postcss",
plugins: [require("tailwindcss"), require("autoprefixer")],
},
},
],
include: path.resolve(__dirname, "../"),
});
config.module.rules.push({
type: "javascript/auto",
test: /\.mjs$/,
include: /node_modules/,
});
"framework": "@storybook/react",
"core": {
"builder": "@storybook/builder-webpack5"
}
}
config.resolve.alias = {
...config.resolve.alias,
"@/SB": path.resolve(__dirname),
"@/Components": path.resolve(__dirname, "../src/Components"),
"@/Api": path.resolve(__dirname, "../src/api"),
"@/Utils": path.resolve(__dirname, "../src/utils"),
};
return config;
},
};

View File

@@ -11,9 +11,7 @@ export const parameters = {
date: /Date$/,
},
},
};
}
addDecorator(AppDecorator);

View File

@@ -1,20 +0,0 @@
module.exports = {
style: {
postcss: {
plugins: [require("tailwindcss"), require("autoprefixer")],
},
},
webpack: {
configure: {
module: {
rules: [
{
type: "javascript/auto",
test: /\.mjs$/,
include: /node_modules/,
},
],
},
},
},
};

62313
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,67 +1,67 @@
{
"name": "makers.bolt.fun",
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@apollo/client": "^3.5.5",
"@prisma/client": "3.5.0",
"@react-hookz/web": "^13.1.0",
"@react-spring/web": "^9.4.2",
"@reduxjs/toolkit": "^1.6.2",
"@testing-library/jest-dom": "^5.15.0",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"@types/jest": "^26.0.24",
"@types/node": "^12.20.36",
"@types/react": "^17.0.33",
"@types/react-dom": "^17.0.10",
"@use-gesture/react": "^10.2.5",
"apollo-server": "^3.5.0",
"apollo-server-lambda": "^3.5.0",
"axios": "^0.24.0",
"@apollo/client": "^3.5.10",
"@prisma/client": "^3.12.0",
"@react-hookz/web": "^13.2.1",
"@react-spring/web": "^9.4.4",
"@reduxjs/toolkit": "^1.8.1",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.1.1",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.4.1",
"@types/node": "^16.11.27",
"@types/react": "^18.0.5",
"@types/react-dom": "^18.0.1",
"@use-gesture/react": "^10.2.11",
"apollo-server": "^3.6.7",
"apollo-server-lambda": "^3.6.7",
"axios": "^0.26.1",
"chance": "^1.1.8",
"dayjs": "^1.11.1",
"env-cmd": "^10.1.0",
"framer-motion": "^5.3.0",
"graphql": "^16.0.1",
"invoices": "^2.0.2",
"framer-motion": "^6.3.0",
"graphql": "^16.3.0",
"invoices": "^2.0.6",
"linkify-html": "^3.0.5",
"linkifyjs": "^3.0.5",
"lodash.debounce": "^4.0.8",
"lodash.throttle": "^4.1.1",
"marked": "^4.0.14",
"nexus": "^1.3.0",
"prisma": "3.5.0",
"react": "^17.0.2",
"prisma": "^3.12.0",
"react": "^18.0.0",
"react-confetti": "^6.0.1",
"react-copy-to-clipboard": "^5.0.4",
"react-copy-to-clipboard": "^5.1.0",
"react-datepicker": "^4.7.0",
"react-dom": "^17.0.2",
"react-dom": "^18.0.0",
"react-icons": "^4.3.1",
"react-image-lightbox": "^5.1.4",
"react-loader-spinner": "^6.0.0-0",
"react-loading-skeleton": "^3.0.2",
"react-multi-carousel": "^2.6.5",
"react-query": "^3.32.3",
"react-redux": "^7.2.6",
"react-responsive-carousel": "^3.2.22",
"react-router-dom": "^6.2.2",
"react-scripts": "4.0.3",
"react-loading-skeleton": "^3.1.0",
"react-multi-carousel": "^2.8.0",
"react-query": "^3.35.0",
"react-redux": "^8.0.0",
"react-responsive-carousel": "^3.2.23",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"react-topbar-progress-indicator": "^4.1.1",
"typescript": "^4.4.4",
"web-vitals": "^1.1.2",
"webln": "^0.2.2"
"typescript": "^4.6.3",
"web-vitals": "^2.1.4",
"webln": "^0.3.0"
},
"scripts": {
"client:prod-server": "env-cmd -f ./environments/.dev.prod-server.env craco start",
"client:preview-server": "env-cmd -f ./environments/.dev.preview-server.env craco start",
"client:mocks": "env-cmd -f ./environments/.dev.mock-server.env craco start",
"client:dev-server": "env-cmd -f ./environments/.dev.server.env craco start",
"client:prod-server": "env-cmd -f ./environments/.dev.prod-server.env react-scripts start",
"client:preview-server": "env-cmd -f ./environments/.dev.preview-server.env react-scripts start",
"client:mocks": "env-cmd -f ./environments/.dev.mock-server.env react-scripts start",
"client:dev-server": "env-cmd -f ./environments/.dev.server.env react-scripts start",
"server:dev": "serverless offline",
"generate-graphql": "graphql-codegen",
"build": "craco build",
"build:mocks": "env-cmd -f ./environments/.prod.mock-server.env craco build",
"test": "craco test",
"build": "react-scripts build",
"build:mocks": "env-cmd -f ./environments/.prod.mock-server.env react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"predeploy": "env-cmd -f ./environments/.prod.github.env npm run build",
"deploy": "gh-pages -d build",
@@ -109,32 +109,36 @@
]
},
"devDependencies": {
"@craco/craco": "^6.4.0",
"@graphql-codegen/cli": "2.3.0",
"@graphql-codegen/cli": "^2.6.2",
"@graphql-codegen/typed-document-node": "^2.2.8",
"@graphql-codegen/typescript": "^2.4.1",
"@graphql-codegen/typescript-operations": "^2.2.1",
"@graphql-codegen/typescript-react-apollo": "3.2.2",
"@storybook/addon-actions": "^6.3.12",
"@storybook/addon-essentials": "^6.3.12",
"@storybook/addon-links": "^6.3.12",
"@storybook/addon-postcss": "^2.0.0",
"@storybook/node-logger": "^6.3.12",
"@storybook/preset-create-react-app": "^3.2.0",
"@storybook/react": "^6.3.12",
"@graphql-codegen/typescript": "^2.4.8",
"@graphql-codegen/typescript-operations": "^2.3.5",
"@graphql-codegen/typescript-react-apollo": "^3.2.11",
"@storybook/addon-actions": "^6.4.22",
"@storybook/addon-essentials": "^6.4.22",
"@storybook/addon-interactions": "^6.4.22",
"@storybook/addon-links": "^6.4.22",
"@storybook/builder-webpack5": "^6.4.22",
"@storybook/manager-webpack5": "^6.4.22",
"@storybook/node-logger": "^6.4.22",
"@storybook/preset-create-react-app": "^4.1.0",
"@storybook/react": "^6.4.22",
"@storybook/testing-library": "^0.0.10",
"@tailwindcss/forms": "^0.5.0",
"@types/chance": "^1.1.3",
"@types/lodash.debounce": "^4.0.6",
"@types/lodash.throttle": "^4.1.6",
"@types/lodash.debounce": "^4.0.7",
"@types/lodash.throttle": "^4.1.7",
"@types/marked": "^4.0.3",
"@types/react-copy-to-clipboard": "^5.0.2",
"@types/react-datepicker": "^4.4.0",
"autoprefixer": "^9.8.8",
"autoprefixer": "^10.4.4",
"gh-pages": "^3.2.3",
"msw": "^0.39.1",
"netlify-cli": "^8.15.0",
"postcss": "^7.0.39",
"serverless-offline": "^8.5.0",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17"
"msw": "^0.39.2",
"netlify-cli": "^10.0.0",
"postcss": "^8.4.12",
"serverless-offline": "^8.7.0",
"tailwindcss": "^3.0.24",
"webpack": "^5.72.0"
},
"msw": {
"workerDirectory": "public"

6
postcss.config.js Normal file
View File

@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

View File

@@ -17,7 +17,7 @@
}
.input-wrapper {
@apply w-full relative border border-gray-300 rounded-lg shadow-xs flex focus-within:outline-primary;
@apply w-full relative border border-gray-300 rounded-lg shadow-xs flex focus-within:outline-primary-400;
}
.input-field {

View File

@@ -1,9 +1,8 @@
import React from 'react';
import ReactDOM from 'react-dom';
import ReactDOM from 'react-dom/client';
import Wrapper from './utils/Wrapper';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
if (process.env.REACT_APP_ENABLE_MOCKS) {
@@ -14,17 +13,14 @@ if (process.env.REACT_APP_ENABLE_MOCKS) {
}
ReactDOM.render(
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<React.StrictMode>
<Wrapper>
<App />
</Wrapper>
</React.StrictMode>,
document.getElementById('root')
</React.StrictMode>
);
// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

View File

@@ -1,15 +1,14 @@
const THEME = require('./src/utils/theme')
module.exports = {
mode: "jit",
purge: [
content: [
"./src/features/**/*.{html,js,ts,tsx,jsx}",
"./src/pages/**/*.{html,js,ts,tsx,jsx}",
"./src/Components/**/*.{html,js,ts,tsx,jsx}",
"./src/layouts/**/*.{html,js,ts,tsx,jsx}",
"./src/index.html",
],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {
colors: THEME.colors,
@@ -100,4 +99,4 @@ module.exports = {
plugins: [
require('@tailwindcss/forms'),
],
};
}

View File

@@ -1,8 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"baseUrl": ".",
"allowJs": true,
"skipLibCheck": true,
@@ -18,5 +21,7 @@
"noEmit": true,
"jsx": "react-jsx"
},
"include": ["src","./src/utils/types/assets.d.ts"]
"include": [
"src"
]
}