{"id":13560562,"url":"https://github.com/ecomfe/reskript","last_synced_at":"2025-08-02T12:43:16.773Z","repository":{"id":37935631,"uuid":"332403300","full_name":"ecomfe/reskript","owner":"ecomfe","description":"一个帮助开发React应用的全功能命令行套件","archived":false,"fork":false,"pushed_at":"2025-02-12T14:22:22.000Z","size":26322,"stargazers_count":218,"open_issues_count":27,"forks_count":36,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-25T08:05:20.598Z","etag":null,"topics":["babel","eslint","jest","react","webpack"],"latest_commit_sha":null,"homepage":"https://reskript.dev","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/ecomfe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-24T08:45:53.000Z","updated_at":"2025-03-31T13:23:48.000Z","dependencies_parsed_at":"2024-01-14T02:51:53.035Z","dependency_job_id":"e87f9dfd-8b6e-4eca-8c0f-9dbc9cd030a3","html_url":"https://github.com/ecomfe/reskript","commit_stats":null,"previous_names":[],"tags_count":111,"template":false,"template_full_name":null,"purl":"pkg:github/ecomfe/reskript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Freskript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Freskript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Freskript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Freskript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ecomfe","download_url":"https://codeload.github.com/ecomfe/reskript/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ecomfe%2Freskript/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268392180,"owners_count":24243297,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["babel","eslint","jest","react","webpack"],"created_at":"2024-08-01T13:00:46.575Z","updated_at":"2025-08-02T12:43:16.744Z","avatar_url":"https://github.com/ecomfe.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://reskript.dev\"\u003e\n    \u003cimg width=\"200\" src=\"https://reskript.dev/images/logo.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cdiv align=\"center\"\u003e基于 React 与 Ant Design 开发的命令行工具套件\u003c/div\u003e\n\n本文档对应`6.x`版本，如果你使用其它版本，请参考[升级手册](https://reskript.dev/docs/migration/v6)进行升级。\n\n**6.x版本对应antd 5.x，如果你使用4.x版本，请参考[第三方库优化](https://reskript.dev/docs/settings/build#%E7%89%B9%E6%AE%8A%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%93%E7%9A%84%E4%BC%98%E5%8C%96)进行配置。**\n\n**[reSKRipt](https://reskript.dev)** 是基于 [React](https://github.com/facebook/react) 与 [Ant Design](https://github.com/ant-design/ant-design) 开发的一套命令行工具套件，整合了代码检查、单元测试、构建、代码转义和本地调试等一系列功能，意图做到在开发业务时无需关心工具选型。\n\n## 快速开始\n\n```shel\nmkdir my-app\nnpx @reskript/init@latest my-app\ncd my-app\nnpm start\n```\n\n进一步的使用欢迎[参考使用文档](https://reskript.dev)。\n\n## 为什么自研\n\n社区中的 [create-react-app](https://www.npmjs.com/package/create-react-app) 提供了最基础的开发体验，而 reSKRipt 则在此基础之上加了一些独特的能力和更多的约束，在此例举一些主要的：\n\n- **更严格地挑选 Babel 插件**：我们曾经在 [bind operator](https://github.com/tc39/proposal-bind-operator) 标准上吃过不小亏，从此以后便开始避免无脑地使用 `stage-0` 来进行转义，精细地挑选当前的插件，选择更为成熟且比较确定会持续演进最终进入规范的部分。\n- **默认 CSS Modules**：所有的 .less 和 .css 文件均经过 CSS Modules 处理，仅有 `.global.{less,css}` 被排除在外，这能够更好地控制样式的隔离，更符合一个严谨的工程开发模式。\n- **样式被转化为函数**：对于样式文件，在引入后会变成一个函数，比如： `import c from './index.less'` 后可以使用 `c('text', {'size-small': props.small})` 这样的形式生成元素的className，内部基于 [classnames](https://www.npmjs.com/package/classnames) 实现。\n- **SVG组件化**：可以通过 `import ReactComponent from './icon.svg?react'` 将 SVG 转化为组件，这与 [create-react-app](https://www.npmjs.com/package/create-react-app) 提供的能力相似，但 reSKRipt 使用了自定义的 loader 来实现这一功能，具备更好的转换性能。\n- **严格的代码检查规则**：基于百度内部的编码规范，使用 [@ecomfe/eslint-config](https://www.npmjs.com/package/@ecomfe/eslint-config) 和 [@ecomfe/stylelint-config](https://www.npmjs.com/package/@ecomfe/stylelint-config) 的严格规则做检查，并在此基础上增加了一系列自己的规则，代码检查远比社区更加严格。\n- **自动添加组件名称**：所有组件都会自动加上 displayName 属性，无论是以 function、const 还是 export default 定义，都能很好地识别出来并自动的推导最合适的组件名称。\n- **追求更新的框架版本**：仅支持 react@17 和 webpack@5，并且我们在未来也将以最快速度跟进框架的最新版本，不断淘汰对旧版本的支持，以此让业务紧密跟随社区的发展。\n- **更低成本地升级工具**：统一封装Vite、Webpack等底层工具链，便于社区向前走时及时的跟上切换。\n\n因此，使用 reSKRipt 可能会一定程度上约束你的开发模式，它并不一定适用于所有的应用，但我们有信心在开发模式契合的情况下为你大幅度提升开发效率。\n\n## 版本管理\n\n所有的包始终使用同一个版本，由 lerna 进行管理，使用 pnpm 作为包管理工具。\n\n我们会在发布版本的时候使用 `--force-publish` 参数，这意味着即便有一个包没有任何的改动，也会跟随发布新的版本。这样做的好处是能很好地处理各包之间错综复杂的依赖关系，避免某个包被重复引入多个版本。\n\n如果你需要升级包，在知道最新版本号的前提下，大可以在 package.json 文件中把所有以 `@reskript/` 开头的包的版本统一修改，再运行 `npm install` 或 `yarn` 来更新。\n\n## 安装\n\n**要求系统安装`node \u003e= 14.0.0`版本。**\n\n一些你基本上一定会需要的依赖，任何场景都请先安装上：\n\n```bash\nnpm install -D eslint stylelint typescript webpack\n```\n\nreSKRipt 由多个包组成，你可以按照下面描述的不同场景选择性安装：\n\n- 我想用 webpack 构建我的应用\n\n```bash\nnpm install -D -E @reskript/cli @reskript/cli-build\n\nskr build\n```\n\n- 我想用 webpack-dev-server 调试我的应用\n\n```bash\nnpm install -D -E @reskript/cli @reskript/cli-dev\n\nskr dev\n```\n\n- 我想基于已有的 webpack 配置自己定义构建\n\n```bash\nnpm install -D -E @reskript/config-webpack\n```\n\n- 我想检查我的代码规范\n\n```bash\nnpm install -D -E @reskript/cli @reskript/cli-lint\n\nskr lint\n```\n\n- 我直接使用 eslint、通过 vscode 的 eslint 插件检查代码，但想使用已有的规则配置\n\n```bash\nnpm install -D -E @reskript/config-lint\n```\n\n- 我想用jest 进行单元测试\n\n```bash\nnpm install -D -E @reskript/cli @reskript/cli-test\n\nskr test\n```\n\n- 我想基于已有的 jest 配置进一步定制我的单元测试\n\n```bash\nnpm install -D -E @reskript/config-jest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecomfe%2Freskript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fecomfe%2Freskript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fecomfe%2Freskript/lists"}