molecule icon indicating copy to clipboard operation
molecule copied to clipboard

WIP: feat: migrate to turbo and pnpm

Open mortalYoung opened this issue 2 years ago • 3 comments

简介

  • 本 PR 主要负责仓库迁移至 monorepo 架构

功能点

  • [x] dev
  • [x] build
  • [x] precommit(包含 eslint prettier stylelint 等)
  • [x] test
  • [x] release
  • [x] web

主要变更

  • 基于 #706 讲仓库架构拆分
  • 拆分 gulpfile.js 的功能,每个包都有自己的 gulpfile.js,简单的包直接用 tsc 编译
  • 删除无用的 webpack 配置,以及相关 scripts
  • 修改 alias,由于目录结构改变,之前的 mo/* 以及 mo 都无效了,修改成对应的依赖包。尽在 ide 中保留 mo 的别名
  • 优化 jest 的 alias,防止 workspace 的包找不到
  • 优化 README,主仓库的 README 是 molecule 这个项目的 README 的 symlink,确保 github 仓库的首页和 npm 首页的 README 保持一致。
  • 修复 symlink README 中相对路径引用的问题
  • 优化 common 的 logger 的 __DEVELOPMENT__ 问题,通过 process.env.__DEVELOPMENT__ 来判断
  • 修复 eslintstylelint 等路径问题
  • src/components/monaco 迁移至 packages/ide/components/monaco 而不是 packages/ui/src/monaco

遗留问题

  • [ ] 目前 changelog 是输出在主仓库下的,参照 vite 的话应该是每一个包生成独立的 changelog,这个后续再看如何迁移
  • [ ] 目前自动生成的 API 文档的 define 都是 xxx/esm/xxx 文件,导致无法关联到 github 对应路径,暂时没想到解决办法

Breaking changes

  • 用户侧
    • UI 组件不再通过 @dtinsight/molecule/esm/components 导出改为 @dtinsight/molecule/ui
    • monaco-editor 中导出不再通过 @dtinsight/molecule/esm/monaco,改为 @dtinsight/molecule/monaco
    • 其余导出不再通过 @dtinsight/molecule/esm/xxx,改为 @dtinsight/molecule
    • API 文档结构有所改动,查阅文档方式有所变化

mortalYoung avatar Mar 16 '22 03:03 mortalYoung

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (05ad264) 91.34% compared to head (e4174e5) 91.14%. Report is 78 commits behind head on main.

:exclamation: Current head e4174e5 differs from pull request most recent head 8b565b7. Consider uploading reports for the commit 8b565b7 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #713      +/-   ##
==========================================
- Coverage   91.34%   91.14%   -0.20%     
==========================================
  Files         189      178      -11     
  Lines        5947     5827     -120     
  Branches     1426     1407      -19     
==========================================
- Hits         5432     5311     -121     
- Misses        508      509       +1     
  Partials        7        7              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Mar 16 '22 08:03 codecov[bot]

We need a release script to do the following things:

  1. 检查 git 状态(确保暂存区没有更改)
  2. 检查分支状态(确保 release 的命令仅在 main 分支执行)
  3. 检查 remote 状态(确保当前仓库是最新的)
  4. 检查 npm publish 的地方(确保是 https://registry.npmjs.org/
  5. 运行 npm run build(确保 esm 是最新的)
  6. 生成 changelog(目前依靠 standard-version 的能力,或者直接依靠 conventional-changelog 的 CLI)
  7. 升级主仓库的版本
  8. 升级子仓库的版本,与主仓库保持一致
  9. 升级子仓库中的依赖版本,确保子仓库之间的依赖版本是最新的
  10. 更新 pnpm-lock.yml
  11. git add git commit git tag
  12. publish
  13. push

mortalYoung avatar Mar 16 '22 08:03 mortalYoung

+1

mumiao avatar Mar 21 '22 03:03 mumiao