Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog

- **Fixed** Broad workspace globs no longer discover and run package scripts inside `node_modules` ([#539](https://github.com/voidzero-dev/vite-task/pull/539)).
- **Fixed** An issue where Bun tasks on macOS did not rerun when files they read, wrote, or listed changed ([#532](https://github.com/voidzero-dev/vite-task/issues/532), [#542](https://github.com/voidzero-dev/vite-task/pull/542)).
- **Improved** Windows file-access tracking now uses sparse temporary backing files where supported, avoiding upfront allocation of the full backing file on disk ([#524](https://github.com/voidzero-dev/vite-task/pull/524)).
- **Fixed** Automatic file-access tracking on Linux now works in containers and Kubernetes runners with limited `/dev/shm` space ([#353](https://github.com/voidzero-dev/vite-task/issues/353), [#523](https://github.com/voidzero-dev/vite-task/pull/523)).
Expand Down
33 changes: 31 additions & 2 deletions crates/vite_workspace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ use vec1::smallvec_v1::SmallVec1;
use vite_glob::path::PathGlobSet;
use vite_path::{AbsolutePath, AbsolutePathBuf, RelativePathBuf};
use vite_str::Str;
use wax::{Glob, walk::Entry as _};
use wax::{
Glob,
walk::{Entry as _, FileIterator as _},
};

pub use crate::{
error::Error,
Expand Down Expand Up @@ -112,7 +115,9 @@ impl WorkspaceMemberGlobs {
// TODO: parallelize this
for inclusion in inclusions {
let glob = Glob::new(&inclusion)?;
for entry in glob.walk(workspace_root.as_path().to_path_buf()) {
for entry in
glob.walk(workspace_root.as_path().to_path_buf()).not("**/node_modules/**")?
Comment thread
jong-kyung marked this conversation as resolved.
{
let Ok(entry) = entry else {
continue;
};
Expand Down Expand Up @@ -572,6 +577,30 @@ mod tests {
assert!(!found_excluded, "Should not have found excluded package");
}

#[test]
fn test_get_package_graph_workspace_ignores_node_modules() {
let temp_dir = TempDir::new().unwrap();
let temp_dir_path = AbsolutePath::new(temp_dir.path()).unwrap();
fs::write(
temp_dir_path.join("package.json"),
r#"{"name":"root","workspaces":["samples/**"]}"#,
)
.unwrap();
fs::create_dir_all(temp_dir_path.join("samples/app/node_modules/dependency")).unwrap();
fs::write(temp_dir_path.join("samples/app/package.json"), r#"{"name":"app"}"#).unwrap();
fs::write(
temp_dir_path.join("samples/app/node_modules/dependency/package.json"),
r#"{"name":"dependency"}"#,
)
.unwrap();

let graph = discover_package_graph(temp_dir_path).unwrap();
let package_names: HashSet<_> =
graph.node_weights().map(|package| package.package_json.name.as_str()).collect();

assert_eq!(package_names, HashSet::from_iter(["root", "app"]));
}

#[test]
fn test_get_package_graph_workspace_work_with_last_match_wins() {
let temp_dir = TempDir::new().unwrap();
Expand Down