{"id":22148600,"url":"https://github.com/xucz/vite-concent-pro","last_synced_at":"2025-07-26T02:32:41.471Z","repository":{"id":218015855,"uuid":"349663447","full_name":"xucz/vite-concent-pro","owner":"xucz","description":"use vite \u0026 concent like a pro","archived":false,"fork":false,"pushed_at":"2021-06-29T06:19:09.000Z","size":11558,"stargazers_count":42,"open_issues_count":1,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-01-19T09:57:36.749Z","etag":null,"topics":["antdesign","concent","react","vite-concent"],"latest_commit_sha":null,"homepage":"https://tnfe.github.io/vite-concent-pro/","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xucz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-03-20T08:02:20.000Z","updated_at":"2024-01-19T09:58:30.571Z","dependencies_parsed_at":"2024-01-19T09:58:14.317Z","dependency_job_id":"3de666d2-9119-4baa-9328-8cbc908cfb68","html_url":"https://github.com/xucz/vite-concent-pro","commit_stats":null,"previous_names":["xucz/vite-concent-pro"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xucz%2Fvite-concent-pro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xucz%2Fvite-concent-pro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xucz%2Fvite-concent-pro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xucz%2Fvite-concent-pro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xucz","download_url":"https://codeload.github.com/xucz/vite-concent-pro/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227645299,"owners_count":17798316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["antdesign","concent","react","vite-concent"],"created_at":"2024-12-01T23:28:40.965Z","updated_at":"2024-12-01T23:28:41.844Z","avatar_url":"https://github.com/xucz.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n   \u003cimg width=\"460\" src=\"https://raw.githubusercontent.com/fantasticsoul/assets/master/c2pro/c2pro-banner.png\"\u003e\n\u003c/p\u003e\n\n## 概述\nvite-concent-pro是一个帮用户整合[vite](https://cn.vitejs.dev/) + [concent](https://github.com/concentjs/concent) + [react](https://github.com/facebook/react) 相关生态库并内置了最佳实践指导的项目，以便提供给用户开箱即用的体验，包括但不局限于以下功能：\n- 常用concent api示范\n- model目录组织示范\n- ts整合示范\n- 测试用例书写示范\n\n\u003e 本项目使用vite开发与构建，同时也提供了基于webpack的[concent-pro](https://github.com/tnfe/concent-pro)版本，两者src源码一样\n\n## 预览\n[在线示例](https://tnfe.github.io/vite-concent-pro)\n\u003cbr/\u003e\n![](https://raw.githubusercontent.com/fantasticsoul/assets/master/c2pro/ccpro4.png)\n\u003cbr/\u003e\n![](https://raw.githubusercontent.com/fantasticsoul/assets/master/c2pro/ccpro5.png)\n\u003cbr/\u003e\n![](https://raw.githubusercontent.com/fantasticsoul/assets/master/c2pro/ccpro6.png)\n\n## 安装与运行\n- 拉取项目代码\n```bash\ngit clone git@github.com:tnfe/vite-concent-pro.git\ncd vite-concent-pro\n```\n- 设置为个人的仓库地址\n```\ngit remote set-url origin git@github.com:tnfe/vite-concent-pro.git\n```\n\n- 安装相关依赖\n```bash\nnpm ci\n```  \n\n- 启动与调试项目\n```bash\nnpm start 启动服务\nnpm run build 编译打包\nnpm run preview 预览打包后的代码\n```\n\n- 测试与格式校验\n```bash\nnpm run test (jest测试)\nnpm run lint (eslint校验)\nnpm run lintfix (eslint修复)\n```\n- 代码提交与推送\n```\ngit commit -am 'xxxx_msg' (触发 husky钩子 pre-commit: npm run lintfix)\ngit push (触发 husky钩子 pre-commit: npm run test)\n```\n\n## 添加页面\n- 添加菜单与路由   \n`src/configs/menus`里添加路由对应的菜单信息\n- 添加路由页面    \n`src/pages`目录下添加页面组件\n\u003e 可参考 `src/pages/_DemoTempalte`查看示例代码，启动项目后 访问 localhost:3000/template可以访问该组件页面\n\n\n## 编码建议\n1 pages里拆分的组件如不涉及到跨页面复用，推荐就近放置，如后期复用在移到`components/**`下\n2 page模块状态推荐就近放置\n\n## 技术栈\n### 运行时依赖\n* [react 16.13.1](https://github.com/facebook/react) 组件化编程ui基础库   \n* [react-router v5](https://github.com/ReactTraining/react-router) react路由方案 \n* [concent v2](https://github.com/concentjs/concent) 内置依赖收集，高性能、渐进式的react开发框架\n* [react-router-concent v2](https://github.com/concentjs/react-router-concent) 桥接react-router和concent的中间库\n* [ant-design v4](https://github.com/ant-design/ant-design) react基础ui组件库\n\n### 开发依赖\n* [vite 2.1.0](https://cn.vitejs.dev/) 下一代前端开发与构建工具  \n* [create-react-app v3](https://github.com/facebook/create-react-app)   \n* [mocker-api v1.13](https://github.com/jaywcjlove/mocker-api)    \n* eslint\n* typescript\n* jest\n* husky\n\n## 根目录结构\n```\n|____config             # jest配置和vite.server的proxy代理配置   \n|____build              # 打包产出目录\n|____public             # 静态资源目录\n|____src                # 项目源码\n|____test               # 测试启动依赖\n```\n\n## src目录结构\n```\n\n|____index.tsx            # app入口文件\n|____utils                # 通用的非业务相关工具函数集合（可以进一步按用途分类）\n|____configs\n| |____constant           # 各种常量定义处目录\n| |____runConcent.ts      # 启动concent\n| |____menus.ts           # 站点菜单配置(包含了路由)\n| |____runConcent.js      # run concent script\n| \n|____models               # [[business models(全局模块配置)]]\n| |____index.js           # 如需全局各个组件共享的model，可提升到此处导出（model可就近放置也可放到models目录下）\n| |____global             # [[ 一个标准的模块文件(可以copy到各处，只需修改meta里的模块名即可 ]]\n| | |____index.ts         # 模型导出文件\n| | |____reducer.ts       # 修改模块数据方法(可选)\n| | |____computed.ts      # 模块数据的计算函数(可选)\n| | |____watch.ts         # 模块数据的观察函数(可选)\n| | |____lifecycle.ts     # 模块生命周期配置(可选)\n| | |____state.ts         # 模块状态(必需)\n| | |____meta.ts          # 模块元数据文件- 导出整个模块的描述对象、相关类型、钩子等\n| |____...\n| |\n|____components           # [[多个页面复用的基础组件集合]]\n| |____biz-dumb           # 业务相关展示型组件\n| |____biz-smart          # 业务相关容器型组件\n| |____dumb               # 非业务相关展示型组件（通常会基于UI库定制一些可复用组合）\n| |____smart              # 非业务相关容器型组件（剥离了业务的容器组件可以沉淀到此，后期可单独发npm包共享）\n|\n|____pages                # [[router component]]\n| |____PageFoo\n|   |____ model           # 当前页面的model定义，方便就近打开就近查看（定义可见models/global）\n|   |____ dumb            # 当前页面的一些业务笨组件（如果出现多个页面重用则可以进一步调整到components/dumb下）\n|   |____ HeaderArea.tsx  \n|   |____ BodyArea.tsx\n|   |____ SearchArea.tsx\n|   |____ index..tsx      # 页面组件导出文件，注意第一行需要 import ./model 触发model配置\n|\n|____types                # 类型定义目录\n| |____store              # store相关的各种类型推导文件(这是一个固定的文件，无需用户改动)\n| |____mods               # 模型推导辅助文件，无需用户修改\n| |____ev-map             # 事件相关的类型定义\n| |____domain             # 业务领域相关的对象类型定义，通常是后端返回的对象\n| |____biz                # 其他一些全局通用的前端定义的对象类型\n|\n|\n|____services             # [[services，涉及业务io相关、业务通用逻辑相关下沉到此处]]\n| |____domain             # 领域模型相关服务\n| | |____user\n| | |____ticket\n| |____common-func        # 和领域无关的基础业务函数集合\n| |____http               # 其他业务基础服务\n| |____...\n```\n\n## 浏览器兼容\n\nModern browsers and IE10.\n\n| [\u003cimg src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/edge/edge_48x48.png\" alt=\"IE / Edge\" width=\"24px\" height=\"24px\" /\u003e](http://godban.github.io/browsers-support-badges/)\u003c/br\u003eIE / Edge | [\u003cimg src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png\" alt=\"Firefox\" width=\"24px\" height=\"24px\" /\u003e](http://godban.github.io/browsers-support-badges/)\u003c/br\u003eFirefox | [\u003cimg src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png\" alt=\"Chrome\" width=\"24px\" height=\"24px\" /\u003e](http://godban.github.io/browsers-support-badges/)\u003c/br\u003eChrome | [\u003cimg src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/safari/safari_48x48.png\" alt=\"Safari\" width=\"24px\" height=\"24px\" /\u003e](http://godban.github.io/browsers-support-badges/)\u003c/br\u003eSafari | [\u003cimg src=\"https://raw.githubusercontent.com/alrra/browser-logos/master/src/opera/opera_48x48.png\" alt=\"Opera\" width=\"24px\" height=\"24px\" /\u003e](http://godban.github.io/browsers-support-badges/)\u003c/br\u003eOpera |\n| --- | --- | --- | --- | --- |\n| IE10, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxucz%2Fvite-concent-pro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxucz%2Fvite-concent-pro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxucz%2Fvite-concent-pro/lists"}