-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Implementing package inference #2112
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
9 Ignored Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance we could go over how this relates to the Rust shim? Like how the flag is supposed to be computed? I understand what the code is doing but I don't have a full mental model ready.
cli/internal/scope/filter/filter.go
Outdated
selector.namePattern = pi.PackageName | ||
} | ||
if selector.parentDir != "" { | ||
parentDir := pi.DirectoryRoot.UntypedJoin(selector.parentDir).ToStringDuringMigration() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible for parentDir
to be an absolute path? From reading the code, it seems possible if, for instance, --cwd
is set to an absolute path. In which case, does this do the right thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. We unfortunately have not plumbed through our paths here yet.
Looking through the code, specifying an absolute path will break currently, or at least not match anything. We join it with the repo root / cwd regardless. But that does mean the above behavior is incorrect, since if we have a parentDir
, it is always going to be an absolute path, and the correct behavior for inference is to join what the user specified to the inferred directory.
I'm going to take a stab at using our path types to sort this out and hope it doesn't spiral out too much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ported parentDir
on TargetSelector
to RelativeSystemPath
, and pulled the thread to doing the right thing here.
It wasn't possible for the user input to parentDir
to be an absolute path before, but that was not obvious.
c419bff
to
422e11d
Compare
aa9e09d
to
72cbb82
Compare
🟢 CI successful 🟢Thanks |
Co-authored-by: Chris Olszewski <chris.olszewski@vercel.com>
Benchmark for 2136e79Click to view benchmark
|
Benchmark for 0d4dc97Click to view benchmark
|
Benchmark for af3e613Click to view benchmark
|
TURBO_INVOCATION_DIR
env var to global turbo's invocation of local turbo. This allows local turbos that support it to calculate package inference, without passing a bad argument to local turbos that don't yet have this feature.--pkg-inference-root
flag, intended to be passed by the shim after calculating an appropriate value, based on the monorepo root andTURBO_INVOCATION_DIR
env variable.TargetSelector
instances in the presence of an inferred directory. If there's a single package at or above the directory, use that. Otherwise, consider the directory to be a prefix on a parentDir specifierTargetSelector
instances by reference so they can be updated in place--cwd