Coder Social home page Coder Social logo

doctor's Introduction


Doctors - For Web Development

研发质量保障的好帮手


📚 官方文档


上手尝试

在本项目的目录打开 terminal

# 构建
pnpm i # 请使用 pnpm 8
npm run build:all

# 使用示例
cd examples/web-tools
npm run test

examples/diy 整合了目前已有的绝大部分 rules

cd examples/diy
npm run test

开发指南

入门案例

web-tools 进行 feature 开发。

cd packages/web-tools
npm run dev

开启 dev 之后,修改该目录下代码会自动更新。本项目是 Monorepo 架构,因此可以直接在 examples/web-tools 下直接运行 npm run doctor:webtools 进行调试。

如果想为其添加新 feature,请参照 packages/web-tools/src/features 中的代码格式,如下。

// `packages/web-tools/src/features/checkXxx.ts`
export default (api: IApi) => {
  api.addDoctorWebToolsCheck(async () => {
    // 你的判断逻辑
    return {
      label: "{{feature-name}}",
      description: "{{description}}",
      // 提示信息等级 ENUM: OFF | WARN | SUCCESS | ERROR
      doctorLevel: DoctorLevel.WARN,
    };
  });
};

并将其统一受 features/index.ts 中暴露。

export default [...+require.resolve("./checkXxx")];

开发一个新的 doctor

打开 terminal,按如下步骤(无需在本项目的 packages 下开发)

mkdir doctor-xxx
cd doctor-xxx
npx create-doctor

选择 preset,并根据提示输入即可。

配置可参照 packages/web-tools

开发进行时同样可以使用

npm run dev

为了能够快速 debug,建议以 Monorepo 的形式开发,如本项目中的 examples 目录。

Windows 开发注意事项

windows 环境下开发可能会遇到一些问题,可以参考:

  1. 确保 node 版本为 16+,pnpm 版本为 8+
  2. 部分命令报错时(如sh, rm -rf等)请使用能够支持这些 shell 的终端运行命令,比如git-bashzsh
  3. 依赖下载失败时,考虑切换下载源,开启管理员模式后重试
  4. 提示doctor等依赖缺失时,请尝试 pnpm i, doctor命令由本地的 @doctors/core 提供,请检查是否正确使用 Monorepo 模式开发

文档贡献

本项目文档基于 dumi + Ant Design主题包 开发。

进入website/,可做如下工作

  1. 修改 .dumirc.ts 配置文件。Powered by And Design主题包。
  2. 编写 Markdown 文档。Powered by dumi

启动

npm run start

doctor's People

Contributors

boyyangzai avatar cjhw avatar coderserio avatar cwrv07 avatar etheral12138 avatar mijiacoding avatar situ2001 avatar sk-luffa avatar sokuritszz avatar tobyhhw avatar yettobetested avatar yixiaojiu avatar zhangmingyuan666 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

doctor's Issues

Task: Presets in doctors

core 提供插件api 功能扩展能力 + features

面向普通项目配置的: tips:建议选用当下最火的 common 类脚手架配置做参考

  • @doctors/npm-pkg rules 参考 father @cjhw @MiJiaCoding @leslieCHUENGT @hangangan - #12 - #21
  • @doctors/eslint elsint 必备字段是否正确配置 是否已经是 eslint+prettier 最佳实践 王心圆的 eslint 实践 @1584965284 @qiushui7 - #20
  • @doctors/vue2 围绕 vue2 整个生态来做 如常用 vscode 插件/webpack 插件/第三方库 - vue2 等
  • @doctors/vue3 围绕 vue3 整个生态来做 如常用 vscode 插件/webpack 插件/第三方库 - vue3 等 @RicardoErii
  • @doctors/react
  • @doctors/rn rules 参考 https://juejin.cn/post/6844903976882683917
  • @doctors/uniapp rules 参考同上
  • @doctors/webpack-config 可以加入对于常用 plugin 的功能检测 如 babel-plugin-import 可以检测是否开启 style等
  • @doctors/vite-config

💡最好能给抽象出来一层 @doctors/common-app(包含 @doctors/eslint 幽灵依赖检测等) 的预设

面向企业级项目配置的: 与其配置紧密相关的

  • @doctors/nextjs
  • @doctors/nuxtjs
  • @doctors/umi => @doctors/bigfish 这个是举例 蚂蚁内部已经有 bigfish 的 doctor 了
    img_v2_5a25836f-3f3b-4853-aef7-e7c96330d64g

可扩展类:

  • @doctors/bundle 可与 @doctors/webpack-config 抽象 不建议加入 bundle 的过程 这样需要强依赖 打包工具的插件
    • bundle size 分析
    • bundle less 的建议 如 treeshaking 配置以及收否生效 检测有无异常的 treeshakjing 未成功 等

Others:

  • 新增 examples/ 目录
    • examples/npm-package => npm 类库开发模板
    • examples/vue2+webpack => @doctors/vue2 + @doctors/webpack-config => 抽象出 @doctors/vue2-webpack
    • examples/vue3+vite => @doctors/vue3 + @doctors/vite-config => 抽象出 @doctors/vue3-vite
    • examples/react+webpack => @doctors/react + @doctors/webpack-config => 抽象出 @doctors/react-webpack
    • examples/react+vite => @doctors/react + @doctors/vite-config => 抽象出 @doctors/react-vite
  • #27

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.