How to handle adapting a monorepo with build scripts that invoke multiple other scripts #10784
-
SummaryI have a monorepo where packages currently define {
"scripts": {
"build": "pnpm build:ts && pnpm generate:clients",
"build:ts": "tsup",
"generate:clients": "..."
}
}And I'm wondering what's the best way to adapt this to turborepo as this monorepo will benefit immensely from caching. Because technically it's As developers are currently used to Additional informationNo response ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
As long as I'm reading right, this is how I would go about it: // package.json
{
"scripts": {
"build": "turbo run build:ts generate:clients"
}
}{
"tasks": {
"build:ts": { ... }
"generate:clients": { ... }
}
}From your description, it sounds like there is no dependency between these two tasks. As shown above, this creates two tasks that If the order matters as shown in your original {
"tasks": {
"build:ts": { ... }
"generate:clients": {
"dependsOn": ["build:ts"]
}
}
}In both cases, developers would still run the package manager's |
Beta Was this translation helpful? Give feedback.
As long as I'm reading right, this is how I would go about it:
{ "tasks": { "build:ts": { ... } "generate:clients": { ... } } }From your description, it sounds like there is no dependency between these two tasks. As shown above, this creates two tasks that
turbowould run in parallel.If the order matters as shown in your original
buildscript, you would want to make sure that the"generate:clientstask depends onbuild:ts, like so:{ "tasks": { "build:ts": { ... } "generate:clients": { "dependsOn": ["build:ts"] } } }In both cases, developers would st…