-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Turborepo): Handle new packages in lockfile comparisons (#8127)
### Description When comparing lockfiles between revisions to identify what packages have been affected, we treated missing packages in the previous lockfile (added in the new lockfile) as errors, and fell back to considering all packages as affected. This change adds a boolean to determine what the behavior should be when we can't find a package that we expect. When building the package graph, it continues to be an error, as well as when tracing the dependencies of a package we've already found in the lockfile. However, for the first round of packages that we look for in a previous lockfile, we ignore missing packages. This allows us to more gracefully handle comparisons between commits that add new packages. ### Testing Instructions Added an integration test inspired by the repro from the linked issue. Fixes #8125 --------- Co-authored-by: Greg Soltis <Greg Soltis>
- Loading branch information
Greg Soltis
authored
May 13, 2024
1 parent
cc565e8
commit 04248f4
Showing
7 changed files
with
64 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
turborepo-tests/integration/tests/lockfile-aware-caching/new-package.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Setup | ||
$ . ${TESTDIR}/../../../helpers/setup.sh | ||
$ . ${TESTDIR}/setup.sh $(pwd) pnpm | ||
|
||
Add new package with an external dependency | ||
$ mkdir -p apps/c | ||
$ echo '{"name":"c", "dependencies": {"has-symbols": "^1.0.3"}}' > apps/c/package.json | ||
|
||
Update lockfile | ||
$ pnpm i --frozen-lockfile=false > /dev/null | ||
|
||
Now build and verify that only the new package is in scope | ||
Note that we need --skip-infer because we've now installed a local | ||
turbo in this repo | ||
Note that we need to disable path conversion because on windows, git bash considers | ||
'//' to be an escape sequence translating to '/'. | ||
$ MSYS_NO_PATHCONV=1 ${TURBO} --skip-infer build -F '[HEAD]' -F '!//' --dry=json | jq '.packages' | ||
[ | ||
"c" | ||
] | ||
|
||
|