Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter missing tasks from --dry output #1135

Closed
finn-orsini opened this issue Apr 27, 2022 · 1 comment
Closed

Filter missing tasks from --dry output #1135

finn-orsini opened this issue Apr 27, 2022 · 1 comment

Comments

@finn-orsini
Copy link

What version of Turborepo are you using?

1.2.5

What package manager are you using / does the bug impact?

pnpm

What operating system are you using?

Mac

Describe the Bug

Turbo --dry output includes dependency tasks that do not exist. In this reproduction repo, created by running npx create-turbo@latest, both application build web#build tasks and docs#build include three dependent tasks: ui#build, config#build, tsconfig#build.

This output is misleading - there are no tasks which match these task names, since none of the libraries contain a build script. For example, the ui package has no scripts defined. This does not impact the ability of the application build to build correctly - the app build script appears to be correctly building the workspace dependencies in a single task.

Example Output

{
  "packages": [
    "config",
    "docs",
    "tsconfig",
    "ui",
    "web"
  ],
  "tasks": [
    {
      "taskId": "web#build",
      "task": "build",
      "package": "web",
      "hash": "484d1ee93d3f9379",
      "command": "next build",
      "outputs": [
        "dist/**",
        ".next/**"
      ],
      "logFile": "apps/web/.turbo/turbo-build.log",
      "directory": "apps/web",
      "dependencies": [
        "ui#build",
        "config#build",
        "tsconfig#build"
      ],
      "dependents": []
    },
    {
      "taskId": "docs#build",
      "task": "build",
      "package": "docs",
      "hash": "1fb1889e5fab7fbd",
      "command": "next build",
      "outputs": [
        "dist/**",
        ".next/**"
      ],
      "logFile": "apps/docs/.turbo/turbo-build.log",
      "directory": "apps/docs",
      "dependencies": [
        "config#build",  
        "ui#build",
        "tsconfig#build"
      ],
      "dependents": []
    }
  ]
}

I have validated the same behavior in a repo using yarn as well.

Expected Behavior

The --dry output would not include any dependencies that are not also tasks to be run, i.e. does not list dependencies that do not exist. For the above example, this output would be:

{
  "packages": [
    "config",
    "docs",
    "tsconfig",
    "ui",
    "web"
  ],
  "tasks": [
    {
      "taskId": "web#build",
      "task": "build",
      "package": "web",
      "hash": "484d1ee93d3f9379",
      "command": "next build",
      "outputs": [
        "dist/**",
        ".next/**"
      ],
      "logFile": "apps/web/.turbo/turbo-build.log",
      "directory": "apps/web",
      "dependencies": [],
      "dependents": []
    },
    {
      "taskId": "docs#build",
      "task": "build",
      "package": "docs",
      "hash": "1fb1889e5fab7fbd",
      "command": "next build",
      "outputs": [
        "dist/**",
        ".next/**"
      ],
      "logFile": "apps/docs/.turbo/turbo-build.log",
      "directory": "apps/docs",
      "dependencies": [],
      "dependents": []
    }
  ]
}

To Reproduce

  • Create a new repo using npx create-turbo@latest, or fork this example repo: git@github.com:finn-orsini/turbo-repro-filter-dry-output.git.
  • Run a dry build with turbo run build --dry=json, or pnpm run build:dry in the example repo.

Output of the dry command will include additional dependencies as described above.

@gsoltis
Copy link
Contributor

gsoltis commented May 5, 2022

I think this is a duplicate of #937

Currently turbo will attempt to run those tasks, although as you've noted, they don't exist. They are included because turbo will also run their dependencies, if they have any. I would encourage you to chime in on #937 since we will need to make a decision on what is "correct" here, and feedback is extremely helpful.

@gsoltis gsoltis closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2022
kodiakhq bot pushed a commit that referenced this issue May 11, 2022
Related to #937 and #1135

When executing a dry run, don't short-circuit on tasks with a non-existent command. Instead, set the command to `<NONEXISTENT>` and include it in the display.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants