molecule icon indicating copy to clipboard operation
molecule copied to clipboard

Breaking the repo down into the Monorepo architecture.

Open wewoor opened this issue 3 years ago • 3 comments

Discussed in https://github.com/DTStack/molecule/discussions/681

Originally posted by wewoor November 24, 2021 拆分 src 源码为多个子包,后期可单独发布 ui、react 等不同的包,目录结构类似:


├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README-koKR.md
├── README-zhCN.md
├── README.md
├── babel.config.json
├── build
├── codecov.yml
├── commitlint.config.js
├── coverage
├── docs
├── jest.config.js
├── mock
├── node_modules
├── package.json
├── packages
         ├── common
         ├── react
         ├── ui
         ├── ide
├── stories
├── test
├── tsconfig.base.json
├── tsconfig.build.json
├── tsconfig.json
├── website
└── yarn.lock

wewoor avatar Mar 10 '22 05:03 wewoor

技术选型:pnpm + turbo 拆依赖包如下:

  • @dtinsight/molecule - 用户主要引入的包
  • @dtinsight/molecule/glue - 抽象出 molecule 的开发范式,主要为 ide 服务
  • @dtinsight/molecule/ide - Molecule 用到的大部分业务组件以及 services controllers
  • @dtinsight/molecule/ui - Molecule 抽象出来的组件
  • @dtinsight/molecule/website - Molecule 的文档
  • @dtinsight/molecule/common - 包含通用的 common 和 utils
  • @dtinsight/molecule/extensions - 包含常用的 extensions

对应目录结构如下

├── ...
├── packages
         ├── molecule  # 对应依赖包为 `@dtinsight/molecule` 
         ├── glue # `@dtinsight/molecule/glue`
         ├── ui # `@dtinsight/molecule/ui`
         ├── ide # `@dtinsight/molecule/ide`
         ├── common # `@dtinsight/molecule/common`
├── ...

对用户侧的影响: 期望用户依然通过 import xxx from '@dtinsight/molecule',故无影响 对开发侧的影响:

  • dev 阶段:需要先把各个依赖包编译之后,然后才能启动项目投入开发,即 start 命令的前置条件是 build
  • test 阶段:每个依赖包仅仅测试自己包的内容,所以期望是无影响
  • release 阶段:通过命令一键发布上面的提到的包,期望是无影响

mortalYoung avatar Mar 11 '22 03:03 mortalYoung

@mortalYoung webiste 应该不用做 package 的抽象。拆包更多还是为了后面需要独立发包来考虑。 extensions 我觉得可以多考虑下。

wewoor avatar Mar 11 '22 04:03 wewoor

@mortalYoung webiste 应该不用做 package 的抽象。拆包更多还是为了后面需要独立发包来考虑。 extensions 我觉得可以多考虑下。

那我再改下

mortalYoung avatar Mar 11 '22 05:03 mortalYoung