【发布时间】:2019-01-01 23:59:14
【问题描述】:
我在使用 yarn workspaces 和 lerna 的单一存储库中有这个大型打字稿项目,具有以下架构:
repo
├── API
│ └── (GraphQL API)
├── Apps
│ └── (Front-end React Apps)
├── Libs
│ └── (Shared libraries)
└── Services
└── (Back-end Services)
我的package.json 看起来像:
{
...
"workspaces": [
"API/**/*",
"Apps/**/*",
"Libs/**/*",
"Services/**/*",
],
"scripts": {
"bootstrap": "lerna bootstrap",
"build": "lerna run build"
}
...
}
我的lerna.json 看起来像:
{
"lerna": "2.11.0",
"npmClient": "yarn",
"useWorkspaces": true,
"workspaces": [
"Libs/**/*",
"API/**/*",
"Apps/**/*",
"Services/**/*"
],
"version": "1.0.0"
}
现在我需要在Apps 和Services 之前构建所有共享的Libs,因为它们有依赖关系。但是当我运行yarn build 并触发lerna run build 时,它似乎以随机(?)顺序触发build 进程,因此它无法构建,因为库“还不存在”。
有没有办法设置lerna 如何触发构建的顺序?
【问题讨论】:
标签: typescript build yarnpkg lerna yarn-workspaces