diff --git a/packages/nx/src/config/workspaces.ts b/packages/nx/src/config/workspaces.ts index 829dd7d3b282c..40f4ab823a2d6 100644 --- a/packages/nx/src/config/workspaces.ts +++ b/packages/nx/src/config/workspaces.ts @@ -546,7 +546,7 @@ export function getGlobPatternsFromPlugins( continue; } for (const filePattern of plugin.projectFilePatterns) { - patterns.push('**/' + filePattern); + patterns.push('*/**/' + filePattern); } } @@ -566,7 +566,7 @@ export async function getGlobPatternsFromPluginsAsync( continue; } for (const filePattern of plugin.projectFilePatterns) { - patterns.push('**/' + filePattern); + patterns.push('*/**/' + filePattern); } } diff --git a/packages/nx/src/native/utils/glob.rs b/packages/nx/src/native/utils/glob.rs index 88cb7e12a0af4..1fd47db978bb9 100644 --- a/packages/nx/src/native/utils/glob.rs +++ b/packages/nx/src/native/utils/glob.rs @@ -41,4 +41,16 @@ mod test { assert!(glob_set.is_match("node_modules")); assert!(glob_set.is_match("packages/nx/node_modules")); } + + #[test] + fn should_not_detect_root_plugin_configs() { + let glob_set = build_glob_set(vec![ + // String::from("!(Cargo.toml)"), + String::from("*/**/Cargo.toml"), + ]) + .unwrap(); + assert!(glob_set.is_match("packages/a/Cargo.toml")); + assert!(glob_set.is_match("a/Cargo.toml")); + assert!(!glob_set.is_match("Cargo.toml")) + } }