153 - 《手撕源码 17:bulletproof-react》
发布于 2022年7月18日
上周看到的这个脚手架,Star 12.6K,作者是 Alan Alickovic。Star 过万的仓库肯定有其过人之处,今天翻翻源码学习下。
先看工具部分。构建基于 @craco/craco,类 rewired 的配置式的 CRA 使用方式,提供 start、build 和 test 命令;质量工具基于 prettier(新学到一个参数 --list-different)、eslint 和 tsc(新学到一个参数 --pretty);git 辅助基于 husky 和 lint-staged,precommit hook 跑 tsc + eslint;测试基于 jest + testing-library + cypress + start-server-and-test;mock 基于 msw + @mswjs/data + 已经 404 的 faker;组件调试基于 storybook;代码生成基于 plop;此外 tsconfig-paths-webpack-plugin 也是第一次看到;样式方案基于 postcss + tailwindcss,但是用的 @tail