-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: filter package.json files that are subfolders of other packages (#…
…7025) ### Description We have an issue in the rust port with an overeager glob walking implementation. We want to stop walking when a package.json is encountered such that sub-packages are ignored. This is not possible unfortunately due to the traversal order in `walkdir`, so instead we must filter the values out afterwards. ### Testing Instructions New integration test. Co-authored-by: Alexander Lyon <Alexander Lyon>
- Loading branch information
Showing
9 changed files
with
179 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,4 @@ pub mod inference; | |
pub mod package_graph; | ||
pub mod package_json; | ||
pub mod package_manager; | ||
mod util; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
pub trait IsLast: Iterator + Sized { | ||
/// Returns an iterator that yields a tuple of (is_last, item). | ||
/// Note that this uses a peekable under the hood so items will be buffered. | ||
fn with_last(self) -> Iter<Self>; | ||
} | ||
|
||
impl<I> IsLast for I | ||
where | ||
I: Iterator, | ||
{ | ||
fn with_last(self) -> Iter<Self> { | ||
Iter(self.peekable()) | ||
} | ||
} | ||
pub struct Iter<I>(std::iter::Peekable<I>) | ||
where | ||
I: Iterator; | ||
|
||
impl<I> Iterator for Iter<I> | ||
where | ||
I: Iterator, | ||
{ | ||
type Item = (bool, I::Item); | ||
|
||
fn next(&mut self) -> Option<Self::Item> { | ||
self.0.next().map(|e| (self.0.peek().is_none(), e)) | ||
} | ||
} |
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,21 @@ | ||
Setup | ||
$ . ${TESTDIR}/../../helpers/setup_integration_test.sh nested_packages | ||
|
||
Run a build. In this test, the fixture is set up so that the build will | ||
if we read nested packages, in a manner similar to the `.next` folder | ||
since it will not always produce a `name` field. | ||
$ ${TURBO} build | ||
\xe2\x80\xa2 Packages in scope: my-app (esc) | ||
\xe2\x80\xa2 Running build in 1 packages (esc) | ||
\xe2\x80\xa2 Remote caching disabled (esc) | ||
my-app:build: cache miss, executing [0-9a-f]+ (re) | ||
my-app:build: | ||
my-app:build: > build | ||
my-app:build: > echo building | ||
my-app:build: | ||
my-app:build: building | ||
|
||
Tasks: 1 successful, 1 total | ||
Cached: 0 cached, 1 total | ||
Time: (.+) (re) | ||
|
3 changes: 3 additions & 0 deletions
3
turborepo-tests/integration/fixtures/nested_packages/.gitignore
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,3 @@ | ||
node_modules/ | ||
.turbo | ||
.npmrc |
1 change: 1 addition & 0 deletions
1
turborepo-tests/integration/fixtures/nested_packages/apps/my-app/.ignore/package.json
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 @@ | ||
{} |
10 changes: 10 additions & 0 deletions
10
turborepo-tests/integration/fixtures/nested_packages/apps/my-app/package.json
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,10 @@ | ||
{ | ||
"name": "my-app", | ||
"scripts": { | ||
"build": "echo building", | ||
"maybefails": "exit 4" | ||
}, | ||
"dependencies": { | ||
"util": "*" | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
turborepo-tests/integration/fixtures/nested_packages/package.json
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,10 @@ | ||
{ | ||
"name": "monorepo", | ||
"scripts": { | ||
"something": "turbo run build" | ||
}, | ||
"workspaces": [ | ||
"apps/**", | ||
"packages/**" | ||
] | ||
} |
8 changes: 8 additions & 0 deletions
8
turborepo-tests/integration/fixtures/nested_packages/turbo.json
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,8 @@ | ||
{ | ||
"$schema": "https://turbo.build/schema.json", | ||
"pipeline": { | ||
"build": { | ||
"outputs": [] | ||
} | ||
} | ||
} |
a3d3736
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.
Successfully deployed to the following URLs:
turbo-site – ./docs
turbo.vercel.app
turbopack.org
turbo.vercel.sh
www.turbo.build
turborepo.org
turborepo.com
turbo.build
www.turbopack.org
www.turborepo.com
www.turborepo.org
turbo-site.vercel.sh
turbo-site-git-main.vercel.sh