Skip to content

Try pnpm + nx to build a mono project. Use docker to speed up dev.

Notifications You must be signed in to change notification settings

SherlockHomer/pnpm-mono

Repository files navigation

Commitizen friendly

todo

  • 尝试使用 @nx/react 模式
  • 观察 @nx/react 模式给全局配置和子项目带来的影响,学习 nx/generate 的一些配置思想

Rules

commit rules

  • start with revert|feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release

关于 eslint

一定要有 IDE 扩展程序

  • 阶段1: 严格模式:仅 root 安装ESLint,configs/x 同步 root,
    • 通过 syncpack 管理
    • 利于 lint-staged 触发的 唯一eslint 处理

syncpack

find mismatches version in every package.json of subpackages & fix them, be care npx syncpack list-mismatches npx syncpack fix-mismatches

watch more

builds

docker build react-3d-nginx

  • ⚠️ 指定 build.Dockerfile 后会指定 build.Dockerfile.dockerignore ,会忽略根目录的 .dockeringore,像 node_modules 这种就需要重写 docker build . --target react-3d-nginx --tag react-3d-ng:latest -f ./docker/build.Dockerfile
  • 改进 v1:基础的 mono-dep 总包下,子包自己实现 dockerfile
    • root/package.json/docker:mono:container for mono-dep
    • 例如 react-3d 下实现了 Dockerfile(for build) && Dockerfile.dev(for dev),查看 react-3d/package.json/docker:xxx:container
    • react-3d/compose.yml 用于启动 dev 服务,更加便捷且有热更,当依赖的内容没有通过 volumes 挂载时,热更会失败,需要 compose build
    • root/docker/build.Dockerfile prune

types intellisense

cypress

install it in root project avoid install cypress binary twice but sometimes when you need to use ci, you can use npm install --ignore-scripts to aviod cypress postinstall

when you use cypress in your subpackage, you may need this. add this in your tsconfig.json "compilerOptions": { "types": ["cypress"] }

issue

@mono-> @repo

原有的 @mono 会引起 @mono/eslint-config-react 在 npm 库中找寻而导致超时

package name

@repo/tsconfig ❌,会忽略本地