From 9548714871cef484ed91879512a46657ce4984e9 Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Mon, 21 Aug 2023 13:43:50 -0400 Subject: [PATCH] fix(core): projects within folders that start with a `.` should be found (#18748) --- packages/nx/src/generators/utils/project-configuration.ts | 6 +++++- packages/nx/src/hasher/task-hasher.ts | 2 +- .../project-graph/affected/locators/project-glob-changes.ts | 4 +++- .../project-graph/affected/locators/workspace-projects.ts | 2 +- .../src/project-graph/utils/project-configuration-utils.ts | 2 +- packages/nx/src/utils/find-matching-projects.ts | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/nx/src/generators/utils/project-configuration.ts b/packages/nx/src/generators/utils/project-configuration.ts index 901b5d4d910a1..1d8bd17915bfa 100644 --- a/packages/nx/src/generators/utils/project-configuration.ts +++ b/packages/nx/src/generators/utils/project-configuration.ts @@ -252,7 +252,11 @@ function findCreatedProjectFiles(tree: Tree, globPatterns: string[]) { for (const change of tree.listChanges()) { if (change.type === 'CREATE') { const fileName = basename(change.path); - if (globPatterns.some((pattern) => minimatch(change.path, pattern))) { + if ( + globPatterns.some((pattern) => + minimatch(change.path, pattern, { dot: true }) + ) + ) { createdProjectFiles.push(change.path); } else if (fileName === 'package.json') { try { diff --git a/packages/nx/src/hasher/task-hasher.ts b/packages/nx/src/hasher/task-hasher.ts index a3651aa26574a..64c3526b6c1c5 100644 --- a/packages/nx/src/hasher/task-hasher.ts +++ b/packages/nx/src/hasher/task-hasher.ts @@ -408,7 +408,7 @@ class TaskHasherImpl { const filteredFiles = outputFiles.filter( (p) => p === dependentTasksOutputFiles || - minimatch(p, dependentTasksOutputFiles) + minimatch(p, dependentTasksOutputFiles, { dot: true }) ); const hashDetails = {}; const hashes: string[] = []; diff --git a/packages/nx/src/project-graph/affected/locators/project-glob-changes.ts b/packages/nx/src/project-graph/affected/locators/project-glob-changes.ts index caed925a44d0e..81dc8e94f418e 100644 --- a/packages/nx/src/project-graph/affected/locators/project-glob-changes.ts +++ b/packages/nx/src/project-graph/affected/locators/project-glob-changes.ts @@ -23,7 +23,9 @@ export const getTouchedProjectsFromProjectGlobChanges: TouchedProjectLocator = const touchedProjects = new Set(); for (const touchedFile of touchedFiles) { - const isProjectFile = minimatch(touchedFile.file, globPattern); + const isProjectFile = minimatch(touchedFile.file, globPattern, { + dot: true, + }); if (isProjectFile) { // If the file no longer exists on disk, then it was deleted if (!existsSync(join(workspaceRoot, touchedFile.file))) { diff --git a/packages/nx/src/project-graph/affected/locators/workspace-projects.ts b/packages/nx/src/project-graph/affected/locators/workspace-projects.ts index 04b34a75e5010..678eb67d0692f 100644 --- a/packages/nx/src/project-graph/affected/locators/workspace-projects.ts +++ b/packages/nx/src/project-graph/affected/locators/workspace-projects.ts @@ -49,7 +49,7 @@ export const getImplicitlyTouchedProjects: TouchedProjectLocator = ( for (const [pattern, projects] of Object.entries(implicits)) { const implicitDependencyWasChanged = fileChanges.some((f) => - minimatch(f.file, pattern) + minimatch(f.file, pattern, { dot: true }) ); if (!implicitDependencyWasChanged) { continue; diff --git a/packages/nx/src/project-graph/utils/project-configuration-utils.ts b/packages/nx/src/project-graph/utils/project-configuration-utils.ts index d82a801c3fcc1..f14dbabec5983 100644 --- a/packages/nx/src/project-graph/utils/project-configuration-utils.ts +++ b/packages/nx/src/project-graph/utils/project-configuration-utils.ts @@ -103,7 +103,7 @@ export function buildProjectsConfigurationsFromProjectPathsAndPlugins( continue; } for (const file of projectFiles) { - if (minimatch(file, pattern)) { + if (minimatch(file, pattern, { dot: true })) { const { projects: projectNodes, externalNodes: pluginExternalNodes } = configurationConstructor(file, { nxJsonConfiguration: nxJson, diff --git a/packages/nx/src/utils/find-matching-projects.ts b/packages/nx/src/utils/find-matching-projects.ts index 24f8cba75905a..9f2c85c23b7da 100644 --- a/packages/nx/src/utils/find-matching-projects.ts +++ b/packages/nx/src/utils/find-matching-projects.ts @@ -245,7 +245,7 @@ export const getMatchingStringsWithCache = (() => { } const patternCache = minimatchCache.get(pattern)!; if (!regexCache.has(pattern)) { - const regex = minimatch.makeRe(pattern); + const regex = minimatch.makeRe(pattern, { dot: true }); if (regex) { regexCache.set(pattern, regex); } else {