Skip to content

Commit

Permalink
fix(core): ignore root projects for project inference (#17949)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored Jul 4, 2023
1 parent b9d30fa commit 90584d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/nx/src/config/workspaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ export function getGlobPatternsFromPlugins(
continue;
}
for (const filePattern of plugin.projectFilePatterns) {
patterns.push('**/' + filePattern);
patterns.push('*/**/' + filePattern);
}
}

Expand All @@ -566,7 +566,7 @@ export async function getGlobPatternsFromPluginsAsync(
continue;
}
for (const filePattern of plugin.projectFilePatterns) {
patterns.push('**/' + filePattern);
patterns.push('*/**/' + filePattern);
}
}

Expand Down
12 changes: 12 additions & 0 deletions packages/nx/src/native/utils/glob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
}

1 comment on commit 90584d3

@vercel
Copy link

@vercel vercel bot commented on 90584d3 Jul 4, 2023

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:

nx-dev – ./

nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev

Please sign in to comment.