这是indexloc提供的服务,不要输入任何密码
Skip to content

Start only a single app, and have that app's dependencies build. #417

@NullVoxPopuli

Description

@NullVoxPopuli

Related discussion: #372

Describe the feature you'd like to request

In a largeish monorepo, (150+ JS/TS projects), it's infeasible to build everything, even if just initially -- there are entire teams that never see sections of the monorepo, so why make their machines pay the cost of building / starting those apps?

Today, when doing turbo run <cmd>, it seems that <cmd> is run in every project that defines a <cmd> in package.json#scripts -- which is totally reasonable for small monorepos!

I would like the following behavior,
given a config:

{
  "turbo": {
    "baseBranch": "origin/main",
    "pipeline": {
      "start": { "dependsOn": ["^build"], "cache": false },
      "build": { "dependsOn": ["^build"] },
      "lint": {},
      "lint:fix": {},
    }
  },
}  

I would like the following to happen:

  • when "starting an app for local development", currently: yarn turbo run start --scope='my-app' --include-dependencies
  • build all the dependent projects in the monorepo (that have a build script)

What happens right now:

  • in addition to the above all dependent projects are also "started" (even though I feel like I didn't tell them to?)

Describe the solution you'd like

maybe a --target='app-name' or --entry='app-name' instead of scope, that only runs the specified script in at the traget/entrypoint but first does the dependencies' build step (per the config).

so, `yarn turbo run start --target="app-name" would

  1. run build in all dependencies
  2. run start in app-name

Describe alternatives you've considered

I could try to re-work my scripts in my packages so that start means something else so this'd be a non-issue -- but that's a lot of work across a big monorepo that demands incremental changes 🙃
In small monorepos, it's reasonable to do have a "watch"-like behavior across all your packages (I assume that's what the dev pipeline refers to in the docs), and I can do that for the small open source monorepo I have here: NullVoxPopuli/limber#377 (there are like.. 5 packages).
but starting 30+ libraries in watch mode during development isn't a great option if app devs are going to stick to their apps.
For C.I., it's also important have the above requested behavior, because I'll need to run tests for a specific app and that app's dependencies need to be built in non-watch mode before the tests for the one app run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions