{"id":19957179,"url":"https://github.com/neatfx/minidozer","last_synced_at":"2026-02-25T10:35:48.433Z","repository":{"id":37203355,"uuid":"205207594","full_name":"neatfx/minidozer","owner":"neatfx","description":"轻量级 Electron + React + TypeScript 工程模板","archived":false,"fork":false,"pushed_at":"2023-01-01T10:44:58.000Z","size":2824,"stargazers_count":2,"open_issues_count":21,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-03T21:32:29.015Z","etag":null,"topics":["css-grid","electron","framework","function-component","hook","react","styled-components","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neatfx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":["https://github.com/neatfx/donation"]}},"created_at":"2019-08-29T16:39:05.000Z","updated_at":"2021-10-26T02:38:58.000Z","dependencies_parsed_at":"2023-01-31T21:46:03.662Z","dependency_job_id":null,"html_url":"https://github.com/neatfx/minidozer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/neatfx/minidozer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neatfx%2Fminidozer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neatfx%2Fminidozer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neatfx%2Fminidozer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neatfx%2Fminidozer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neatfx","download_url":"https://codeload.github.com/neatfx/minidozer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neatfx%2Fminidozer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29817840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T05:36:42.804Z","status":"ssl_error","status_checked_at":"2026-02-25T05:36:31.934Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["css-grid","electron","framework","function-component","hook","react","styled-components","typescript"],"created_at":"2024-11-13T01:36:49.859Z","updated_at":"2026-02-25T10:35:48.416Z","avatar_url":"https://github.com/neatfx.png","language":"TypeScript","funding_links":["https://github.com/neatfx/donation"],"categories":[],"sub_categories":[],"readme":"# Minidozer\n\nMinidozer 是一个轻量级 Electron + React + TypeScript 工程模板\n\n- 函数组件 + Styled-components + CSS Grid 组合，简单易维护\n- 内置微框架，基于 React Hook \u0026 TypeScript 支持状态管理、模块化、代码提示\n- 内置异步 Action 处理、状态跟踪，并提供接口支持编写自定义插件\n- 最小化依赖组合，版本更新及时，配置满足基础需求，使用改造成本低\n\n## 为什么\n\n很难找到满意的模版，总而言之，要么不能覆盖需求，要么既复杂又不能覆盖需求......\n\n## 截图\n\n![demo-app](./screenshot/demo-app.png)\n![code-hint-action-type](./screenshot/code-hint-action-type.png)\n![code-hint-state](./screenshot/code-hint-state.png)\n\n## 模版内容\n\n- 项目文件组织结构\n- 示例应用 - \"Minidozer\"\n- Electron\n  - 初始代码 \u0026 应用打包配置\n- React\n  - HMR\n    - 【优化】采用 @hot-loader/react-dom 方案，避免引入 Babel 依赖\n  - 模块化\n    - 内置 Hook API 实现\n    - 内置模块路由\n  - 状态管理\n    - 基于 Hook API 实现，无 Redux 依赖\n    - 模块化，不依赖单一状态树\n    - 支持同步 \u0026 异步 Action\n    - 暂态处理 - 内置 Action 操作状态信息队列，供UI读取展现\n    - 可跟踪输出状态变化信息，便于调试\n  - 通信机制\n    - 组件间通信（基于状态管理，支持同步 \u0026 异步）\n    - 模块间通信（基于状态管理，支持同步 \u0026 异步）\n  - 组件（仅包含示例应用涉及组件）\n  - 代码规范\n    - 使用函数组件\n    - 使用 Styled-components 作为 CSS-in-JS 样式控制方案\n    - 使用 CSS Grid 布局\n  - 测试\n    - ~~单元测试~~\n    - ~~快照测试~~\n    - ~~E2E 测试~~\n- TypeScript\n  - 使用 ESLint 进行代码检查\n- Webpack\n  - v4.32.2\n  - 最小化配置，使用默认优化项\n  - 【优化】关闭 \"ts-loader\" 类型检查，配合使用 ForkTsCheckerWebpackPlugin 进行异步检查\n  - 【优化】使用 DllPlugin 提取公共代码\n  - 【优化】提取 runtimeChunk\n\n## Hook API\n\ncompose - 定义模块组件\n\n```javascript\n// modules/foo/index.tsx\n\nimport { compose, ModuleContext } from '@minidozer/Module' // 内置模块化工具\nimport { actions, ActionType } from './actions' // 模块 Actions 及 Action-Type 类型\nimport { reducer, State, defaultState } from './reducer' // 模块 Reducer、默认 state、 state 类型\n\nexport type Context = ModuleContext\u003cState, ActionType\u003e // 导出模块 Context 类型\n\nexport default compose\u003cProps, State, Types\u003e('ModuleFoo', actions, reducer, defaultState, (props): ReactElement =\u003e {\n    const { state, dispatcher, suspense, tracer } = props\n\n    // 作用于模块 ModuleFoo，代码提示可用\n    dispatcher.dispatch('ACTION_TYPE', payload)\n\n    // suspense 包含当前模块所有 Action 的实时状态队列\n    return(\n      \u003cFragment\u003e\n        \u003cSubComponent {...state} /\u003e\n        \u003cActionStatusIndicator queue={suspense}/\u003e\n      \u003c/Fragment\u003e\n    )\n  }\n)\n```\n\nuseModuleContext - 引用模块上下文资源\n\n```javascript\n// modules/foo/some-component/index.tsx 或 modules/bar/some-component/index.tsx\n\nimport { useModuleContext } from '@minidozer/Module'\nimport { Context } from '@modules/foo'\n\nexport function SomeComponent(): ReactElement {\n    const { state, dispatcher, suspense, tracer } = useModuleContext\u003cContext\u003e('ModuleFoo')\n\n    // 作用于模块 ModuleFoo，代码提示可用\n    dispatcher.dispatch('ACTION_TYPE', payload)\n\n    return(\u003cFragment /\u003e)\n}\n```\n\nuseRouter - 模块路由\n\n```javascript\n// modules/../layout.tsx\n\nexport function Layout(): ReactElement {\n    // \"active\" 为模块组件 \"ModuleNav\" 内部状态，对应当前处于可见状态的模块名（ \"ModuleA\"|\"ModuleB\"|\"ModuleC\" ）\n    const [router, route] = useRouter('active')\n\n    return(\n        \u003cFragment\u003e\n            \u003cModuleNav router={router} /\u003e\n            \u003cModuleA route={route}/\u003e\n            \u003cModuleB route={route}/\u003e\n            \u003cModuleC route={route}/\u003e\n        \u003c/Fragment\u003e\n    )\n}\n```\n\n## 编写自定义插件\n\n```javascript\n// 以内置插件 “logMiddleware” 为例\n\nimport { middlewares, Middleware } from '@minidozer/Middleware'\nimport { log } from '@minidozer/Utils'\n\nconst logMiddleware: Middleware = async params =\u003e {\n    const { moduleName, state, action, reducer } = params\n\n    log('Minidozer.Dispatcher')('Action', {\n        'From': moduleName,\n        'Prev State': state,\n        'Action': action.next,\n        'Next State': reducer(state, action.next)\n    })\n}\n\nmiddlewares.external = [userDefinedMiddlewareA]\n```\n\n## 使用\n\n``` makefile\n# 安装依赖\n$ npm install\n\n# 编译动态链接库\n$ npm run build:dll\n\n# 启动开发服务\n$ npm run dev\n\n# 资源分析\n$ npm run analyze:dll\n$ npm run analyze:bundle\n\n# 测试\n# $ npm run test:unit\n# $ npm run test:e2e\n\n# 应用打包\n$ npm run build:mac\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneatfx%2Fminidozer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneatfx%2Fminidozer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneatfx%2Fminidozer/lists"}