From 96c8a053adf3a97e60da412e287b9201589ad486 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Sun, 21 Dec 2025 07:07:15 +0100 Subject: [PATCH] fix!: allow for single files to be scopes by making patterns explicit Signed-off-by: squidfunk --- crates/mono-changeset/src/changeset.rs | 2 +- crates/mono-changeset/src/changeset/scopes.rs | 2 +- crates/mono-changeset/src/changeset/scopes/builder.rs | 11 ++++------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/crates/mono-changeset/src/changeset.rs b/crates/mono-changeset/src/changeset.rs index 1af6c15..3dd2ae3 100644 --- a/crates/mono-changeset/src/changeset.rs +++ b/crates/mono-changeset/src/changeset.rs @@ -94,7 +94,7 @@ impl Changeset<'_> { { let mut builder = Scopes::builder(); for (path, name) in workspace.packages() { - builder.add(path, name)?; + builder.add(path.join("**"), name)?; } // Append additional scopes from configuration diff --git a/crates/mono-changeset/src/changeset/scopes.rs b/crates/mono-changeset/src/changeset/scopes.rs index 0e42b31..6467ab5 100644 --- a/crates/mono-changeset/src/changeset/scopes.rs +++ b/crates/mono-changeset/src/changeset/scopes.rs @@ -85,7 +85,7 @@ impl Scopes { /// /// // Create scope set builder and add path /// let mut builder = Scopes::builder(); - /// builder.add("crates/mono", "mono")?; + /// builder.add("crates/mono/**", "mono")?; /// /// // Create scope set from builder /// let scopes = builder.build()?; diff --git a/crates/mono-changeset/src/changeset/scopes/builder.rs b/crates/mono-changeset/src/changeset/scopes/builder.rs index 4da8f48..73cd274 100644 --- a/crates/mono-changeset/src/changeset/scopes/builder.rs +++ b/crates/mono-changeset/src/changeset/scopes/builder.rs @@ -85,7 +85,7 @@ impl Builder { /// /// // Create scope set builder and add scope /// let mut builder = Scopes::builder(); - /// builder.add("crates/mono", "mono")?; + /// builder.add("crates/mono/**", "mono")?; /// # Ok(()) /// # } /// ``` @@ -103,13 +103,10 @@ impl Builder { if self.paths.iter().any(|(candidate, _)| candidate == path) { Err(Error::PathExists) - // Create pattern matching all files under the given path + // Create glob and add to builder } else { - let glob = path.join("**"); - - // Create glob and add to builder self.paths.push((path.to_path_buf(), name.into())); - self.globs.add(Glob::new(&glob.to_string_lossy())?); + self.globs.add(Glob::new(&path.to_string_lossy())?); // Return builder for chaining Ok(self) @@ -133,7 +130,7 @@ impl Builder { /// /// // Create scope set builder and add scope /// let mut builder = Scopes::builder(); - /// builder.add("crates/mono", "mono")?; + /// builder.add("crates/mono/**", "mono")?; /// /// // Create scope set from builder /// let scopes = builder.build()?;