diff --git a/packages/nx/src/utils/find-matching-projects.spec.ts b/packages/nx/src/utils/find-matching-projects.spec.ts index 7420b22faa470..99272de67ea92 100644 --- a/packages/nx/src/utils/find-matching-projects.spec.ts +++ b/packages/nx/src/utils/find-matching-projects.spec.ts @@ -162,22 +162,6 @@ describe('findMatchingProjects', () => { 'nested', ]); }); - - it('should support "all except" style patterns', () => { - expect(findMatchingProjects(['!a'], projectGraph)).toEqual([ - 'test-project', - 'b', - 'c', - 'nested', - ]); - expect(findMatchingProjects(['!tag:api'], projectGraph)).toEqual([ - 'b', - 'nested', - ]); - expect( - findMatchingProjects(['!tag:api', 'test-project'], projectGraph) - ).toEqual(['b', 'nested', 'test-project']); - }); }); const projects = [ diff --git a/packages/nx/src/utils/find-matching-projects.ts b/packages/nx/src/utils/find-matching-projects.ts index 2b17d8703c63d..bdef3dd085353 100644 --- a/packages/nx/src/utils/find-matching-projects.ts +++ b/packages/nx/src/utils/find-matching-projects.ts @@ -39,16 +39,6 @@ export function findMatchingProjects( const matchedProjects: Set = new Set(); - // If the first pattern is an exclude pattern, - // we add a wildcard pattern at the first to select - // all projects, except the ones that match the exclude pattern. - // e.g. ['!tag:someTag', 'project2'] will match all projects except - // the ones with the tag 'someTag', and also match the project 'project2', - // regardless of its tags. - if (isExcludePattern(patterns[0])) { - patterns.unshift('*'); - } - for (const stringPattern of patterns) { if (!stringPattern.length) { continue; @@ -215,15 +205,11 @@ function addMatchingProjectsByTag( } } -function isExcludePattern(pattern: string): boolean { - return pattern.startsWith('!'); -} - function parseStringPattern( pattern: string, projects: Record ): ProjectPattern { - const isExclude = isExcludePattern(pattern); + const isExclude = pattern.startsWith('!'); // Support for things like: `!{type}:value` if (isExclude) {