{"id":23635350,"url":"https://github.com/filefoxper/generator-dc","last_synced_at":"2026-04-20T13:06:48.879Z","repository":{"id":57246878,"uuid":"369744410","full_name":"filefoxper/generator-dc","owner":"filefoxper","description":"react 项目快速开发脚手架","archived":false,"fork":false,"pushed_at":"2021-07-22T17:33:46.000Z","size":99,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T06:49:16.845Z","etag":null,"topics":["agent-reducer","react","react-router","use-agent-reducer","yeoman-generator-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/filefoxper.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGE_LOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-22T07:26:45.000Z","updated_at":"2021-07-10T02:53:34.000Z","dependencies_parsed_at":"2022-08-24T16:50:23.880Z","dependency_job_id":null,"html_url":"https://github.com/filefoxper/generator-dc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/filefoxper/generator-dc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filefoxper%2Fgenerator-dc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filefoxper%2Fgenerator-dc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filefoxper%2Fgenerator-dc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filefoxper%2Fgenerator-dc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/filefoxper","download_url":"https://codeload.github.com/filefoxper/generator-dc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filefoxper%2Fgenerator-dc/sbom","scorecard":{"id":399477,"data":{"date":"2025-08-11","repo":{"name":"github.com/filefoxper/generator-dc","commit":"d5c23b4079104f12795b2e1ca05ee204ddcbe26b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/10 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-18T19:47:06.795Z","repository_id":57246878,"created_at":"2025-08-18T19:47:06.796Z","updated_at":"2025-08-18T19:47:06.796Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32048472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["agent-reducer","react","react-router","use-agent-reducer","yeoman-generator-typescript"],"created_at":"2024-12-28T05:34:06.923Z","updated_at":"2026-04-20T13:06:48.853Z","avatar_url":"https://github.com/filefoxper.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm][npm-image]][npm-url]\n\n[npm-image]: https://img.shields.io/npm/v/generator-dc.svg?style=flat-square\n[npm-url]: https://www.npmjs.com/package/generator-dc\n\n# 介绍\n\n`generator-dc`是一个react快速搭建脚手架项目，该项目依赖于 [yeoman](https://yeoman.io/learning/index.html) 。\n使用者可参考 API 生成一套可供快速开发的 react web 项目，甚至在此基础上按规则生成`react-router`路由。\n该脚手架内部集成了一些相对有用的开发工具，可供选择，使用者可根据自身喜好直接修改这些工具。\n\n# 声明\n\n该项目确定使用`typescript`作为类型系统，在选择该工具之前请先做了解。\n\n该项目具有一定的普遍性，但并非万能，所有脚手架生成的代码可直接修改。\n另外根据项目作者喜好，脚手架为使用者提供类似 [use-agent-reducer](https://www.npmjs.com/package/use-agent-reducer) \n、[antd](https://www.npmjs.com/package/antd) 、[type-qs](https://www.npmjs.com/package/type-qs) 等便捷库，\n使用者可自行参考这些库的文档，并使用它们。关于部分生成工具的使用说明，可参考生成项目不同目录下的 README.md 文件。\n\n# 安装\n\n一、安装 `yeoman`\n\n```\nnpm install -g yo\n```\n\n二、安装 `generator-dc`\n\n```\nnpm install -g generator-dc\n```\n\n# 使用\n\n## 生成脚手架代码\n\n输入命令\n\n```\n/path/my$ yo dc --git\n```\n\n按提示进行功能选择：\n\n1. 请输入网页名称\n2. 请输入编译目标路径（可以是相对路径，默认为 `../dist`）\n3. 请选择路由history类型（目前只支持`h5`和`hash`两种单页模式）\n4. 请选择测试模式:（该选择将直接影响后续使用的测试架构生成器的使用）\n* 独立测试包 - 独立测试包会在当前项目的根目录下新建一个`test`目录，`test`目录下的测试文件路径和`src`目录下的真实路径相对相同。 \n* 附属测试包 - 这个选择会直接在被测文件当前目录下简历同名的`*.test.ts(x)`文件。\n\n命令： `yo dc`\n\n参数：\n1. --git: `generator-dc`的修改统一加入git\n2. --skip-install: `generator-dc`在搭建完脚手架后不自动安装`package.json`中的内容\n\n## 生成 react-router 路由\n\n输入命令\n\n```\n// 生成 react-router 路由及相关目录\n/path/my$ yo dc:route /myPage\n// 生成 react-router 路由及相关目录，并指定当前路由为 index redirect 路由\n/path/my$ yo dc:route /otherPage/subPage --redirect\n// 清除所有路由\n/path/my$ yo dc:route /\n```\n\n生成目录：\n\n```\n+ src -\n    ...\n    + pages -\n        + myPage -\n            index.tsx       // 路由\n            layout.tsx      // 页面渲染\n            style.less      // less文件\n        + otherPage -\n            index.tsx\n            layout.tsx\n            style.less\n            + subPage -\n                index.tsx\n                layout.tsx\n                style.less\n```\n\n生成路由访问:\n\nmyPage页面路由\n\n```\nhttp://[host]:[?port]/[?basename/]my-page\n```\notherPage页面路由\n```\nhttp://[host]:[?port]/[?basename/]other-page\n\n因为该路由的子路由 subPage 使用了 --redirect 参数，所以自动跳转至\n\nhttp://[host]:[?port]/[?basename/]other-page/sub-page\n```\n\n命令：`dc:route [path]` path起点根目录为 `./src/pages`\n\n参数：\n1. --redirect: 指定当前路由为直接访问父路由时的默认转入子路由。\n2. --snake-case: 选择蛇形路由模式\n3. --force: 强制重写（对layout影响会比较大）\n\n```\n/path/my$ yo dc:route /myPage --snake-case\n```\n\n效果\n\n```\nhttp://[host]:[?port]/[?basename/]my_page\n```\n\n## 生成 agent-reducer 模型\n\n输入命令\n\n```\n/path/my$ yo dc:agent /path/xxx\n```\n\n可用于生成 agent 模型，如：\n\n```\n/path/my$ yo dc:agent /pages/myPage\n```\n\n生成结构如下\n\n```\n+ src -\n    ...\n    + pages -\n        + myPage -\n            index.tsx       \n            layout.tsx      \n            model.ts        // agent-reducer 模型文件\n            style.less      \n            type.ts         // agent-reducer 模型类型文件\n        + otherPage -\n            index.tsx\n            layout.tsx\n            style.less\n            + subPage -\n                index.tsx\n                layout.tsx\n                style.less\n```\n\n使用 --sharing 默认路径为 src/modules\n\n```\n/path/my$ yo dc:agent --sharing --name user\n```\n\n生成结构如下\n\n```\n+ src -\n    ...\n    + modules -\n        + user -            // 共享 agent-reducer 模型名\n            index.ts        // 共享 agent-reducer 模型文件\n            type.ts         // 共享 agent-reducer 模型类型文件\n    + pages -\n        + myPage -\n            index.tsx       \n            layout.tsx      \n            model.ts        \n            style.less      \n            type.ts         \n        + otherPage -\n            index.tsx\n            layout.tsx\n            style.less\n            + subPage -\n                index.tsx\n                layout.tsx\n                style.less\n```\n\n命令：`dc:agent [?path]` path 起点根目录为 `./src`\n\n参数：\n1. --name: 指定 agent-reducer 模型名，在使用 `--sharing` 参数且未指定生成路径时，会影响模型包的目录名，否则只会影响模型的类名，默认为 `Module` 。\n2. --sharing: 指定模型为共享模型，模型文件会导出 sharing 对象。\n3. --weak-sharing: 指定模型为弱共享模型，模型文件会导出 weakSharing 对象。\n\n关于 [agent-reducer](https://github.com/filefoxper/agent-reducer) 和 [use-agent-reducer](https://filefoxper.github.io/use-agent-reducer/#/zh/) 使用方式请参考相关包文档。\n\n## 生成单元测试\n\n输入命令\n\n```\n/path/my$ yo dc:test /path/xxx[?.ts|.tsx]\n```\n\n可用于生成指定路径目录或源码文件的测试脚本。\n\n如：\n\n```\n/path/my$ yo dc:test /modules/user/index.ts\n```\n\n独立包配置结果：\n\n```\n+ src -\n    ...\n    + modules -\n        + user -            \n            index.ts        \n            type.ts         \n    + pages -\n        + myPage -\n            index.tsx       \n            layout.tsx      \n            model.ts        \n            style.less      \n            type.ts         \n        + otherPage -\n            index.tsx\n            layout.tsx\n            style.less\n            + subPage -\n                index.tsx\n                layout.tsx\n                style.less\n+ test -\n    ...\n    + modules -\n        + user -\n            index.test.ts       // 测试脚本\n```\n\n附属包配置结果：\n\n```\n+ src -\n    ...\n    + modules -\n        + user -\n            + __test__ -\n                index.test.ts    // 测试脚本   \n            index.ts        \n            type.ts         \n    + pages -\n        + myPage -\n            index.tsx       \n            layout.tsx      \n            model.ts        \n            style.less      \n            type.ts         \n        + otherPage -\n            index.tsx\n            layout.tsx\n            style.less\n            + subPage -\n                index.tsx\n                layout.tsx\n                style.less\n```\n\n可输入包名，生成当前包文件测试脚本。\n\n```\n/path/my$ yo dc:test /pages/otherPage\n```\n\n独立包配置结果：\n\n```\n+ src -\n    ...\n    + modules -\n        + user -            \n            index.ts        \n            type.ts         \n    + pages -\n        + myPage -\n            index.tsx       \n            layout.tsx      \n            model.ts        \n            style.less      \n            type.ts         \n        + otherPage -\n            index.tsx\n            layout.tsx\n            style.less\n            + subPage -\n                index.tsx\n                layout.tsx\n                style.less\n+ test -\n    ...\n    + modules -\n        + user -\n            index.test.ts       \n    + pages -\n        + otherPage -\n            index.test.tsx      // 测试脚本\n            layout.test.tsx     // 测试脚本\n```\n\n附属包配置结果：\n\n```\n+ src -\n    ...\n    + modules -\n        + user -\n            + __test__ -\n                index.test.ts       \n            index.ts        \n            type.ts         \n    + pages -\n        + myPage -\n            index.tsx       \n            layout.tsx      \n            model.ts        \n            style.less      \n            type.ts         \n        + otherPage -\n            + __test__ -\n                index.test.tsx      // 测试脚本\n                layout.test.tsx     // 测试脚本\n            index.tsx\n            layout.tsx\n            style.less\n            + subPage -\n                index.tsx\n                layout.tsx\n                style.less\n```\n\n命令：`dc:test [?path]` path 起点根目录为 `./src`\n\n参数：（无）\n\n## 设置\n\n在配置结束后，允许重新配置部分选项，可通过该命令进行再配置\n\n```\n/path/my$ yo dc:setting\n```\n\n命令：`dc:setting`\n\n参数：\n1. --lock: 锁定项目配置\n2. --unlock: 解锁项目配置\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilefoxper%2Fgenerator-dc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffilefoxper%2Fgenerator-dc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilefoxper%2Fgenerator-dc/lists"}