ITADN

Differentiate `deps` that should not contribute to to typescript paths and references.

#2535Openjamestalmage 创建于 2026-05-24
J
jamestalmagecommented
I described this setup for combining test coverage in a [previous issue](https://github.com/moonrepo/moon/issues/2534)... ```yml # packages/build-scripts/moon.yml tasks: combine-coverage: deps: - '#vitest:vitest-coverage' options: runsinCI: true command: 'node ./combine-coverage-script.ts' ``` One annoying side-effect is that this creates a dependency for my `build-scripts` project on any project with that tag, and that causes the `tsconfig.json` to be synced with references to all those projects, which in turn causes the `typecheck` task to fail for my build-scripts, when my actual type-errors are in other projects. In actuality, I've got multiple "tooling" projects in the repo that are like this, so a single type-failure creates a ton of noise that makes it hard to track down. It would be great to have a way to turn this off, some ideas: 1. An individual setting in the `deps` array that prevents a task from creating a project-to-project dependency. ```yml tasks: someTask: deps: - target: '#tagName:taskName' autoInferAsProjectDep: false ``` 2. A task option that can disable the behavior universally ```yml #this should work in workspace.yml, on a specific projects moon.yml, or on a specific task taskOptions: taskDepsContributeToProjectDeps: false ``` 3. Just make the typescript reference `syncPaths` / `syncReferences` options require explicit declarations in the projects top level `dependsOn` array. 4. A way to opt individual dependencies out of the typescript behavior. ```yml dependsOn: - id: someOtherProject syncTypescript: false - id: anotherOne syncTypescript: references: false # I don't know that this level of granularity would be beneficial paths: true ``` For `1` and `2`, this would allow changing the behavior beyond just the typescript issue I am hitting, it would affect how `^:taskName` targets as well (which, I don't have an example for beyond this one, but I'm sure I could dream one up) Honestly, if I had my way task `deps` wouldn't add project level dependencies. They'd impact the task dependency graph only, not the project dependency graph. If you want `^:taskName` to work, you've got to explicitly add it to `dependsOn`. Having task deps create project deps was surprising (and, I think, not the original behavior?). Entirely possible (likely) I'm missing the context that led to that decision. I have opted to mitigate by turning off both `sync...` options on the individual projects, but this isn't ideal (I would like any project-level dependencies I add via `dependsOn` to sync). Sorry for the long-winded issue, hopefully it all makes sense.
2 条评论