- Notifications
You must be signed in to change notification settings - Fork2
vite + react + ts + redux template
License
NotificationsYou must be signed in to change notification settings
qqxs/react-antd-typescript-starter
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
vite + react + ts + redux template
git clone git@github.com:qqxs/react-antd-typescript-starter.gitcd react-antd-typescript-starterpnpm install
# 安装项目依赖# only allow pnpmpnpm install# 开启开发环境react 编译# start development environmentpnpm run dev# 开始编译生产环境# production environmentpnpm run build# 开始编译生产环境并输出分析# production environment analyzerpnpm run analyzer# 对部分不符合eslint 语法进行修复# 注意⚠️: 不是所有的错误都会修复,部分还是要手动修复# eslint fix codepnpm run fix# 进行eslint语法检查, 如果有错会在控制中指出# eslint lint codepnpm run lint# 使用prettier 代码进行格式化# prettier format codepnpm run fmt# testpnpm runtest# 首先要安装nginx镜像# docker nginx deploy# http://localhost:8000# docker-compose up -ddocker compose up -d
.├── assets# @/assets/xxx assets source│ ├── FE.png│ └── react.svg├── components# @/components common components│ ├── Auth# auth│ ├── ErrorBoundary# ErrorBoundary│ └── Layout# layout├── constant# @/constant constant├── hooks# @/hooks│ ├── useTheme.ts# theme hooks│ └── redux.ts# redux hooks├── main.tsx# entry├── services# @/services api├── pages# pages│ ├── error# error page│ ├── home# home page│ ├── login# login page│ └── register# register page├── router.tsx# router tree├── sentry.ts# sentry config├── store# redux store│ ├── index.ts│ └── features# redux state├── styles│ ├── themes# antd theme file│ └── theme.scss├── utils│ ├── Axios.ts# axios│ └── auth.ts└── vite-env.d.ts
自定义组件放在src/components
下
Place custom components undersrc/components
如果需要修改antd5 主题,请更改src/styles/themes下文件
If it is necessary to modify theantd5 theme, Please modify thesrc/styles/themes file.
// https://ant.design/docs/react/customize-theme-cn// default.scss:root {--color-primary:#00b96b;// -> colorPrimary: #00b96b--border-radius:4px;// -> borderRadius: 4px}
scripts/sass-to-json.ts 转换src/styles/themes下文件为下面对象格式
{"theme" {"tokens": {"dark": {"colorPrimary":"#000","borderRadius":"4px", },"default": {"colorPrimary":"#00b96b","borderRadius":"4px" } },"vars": {"dark":" --color-primary: #000; --border-radius: 4px;","default":" --color-primary: #00b96b; --border-radius: 4px;" } }}
css 变量在切换主题时自动注入到head
下,保证antd@5.x 主题 token 变量和css 变量对应
head
下style
标签
<!-- $____theme____$ 是唯一id --><styleid="$____theme____$"data-theme="default">:root {--color-primary:#00b96b;--border-radius:4px; }</style>
警告
在vite.config.ts中开启OPEN_SENTRY=true
, 并在src/sentry.tsx 中配置$__SENTRY__DSN__$
。
About
vite + react + ts + redux template
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.