diff --git a/packages/workspace/src/core/nx-deps/nx-deps-cache.ts b/packages/workspace/src/core/nx-deps/nx-deps-cache.ts index 40b22bd377..d627dc8d77 100644 --- a/packages/workspace/src/core/nx-deps/nx-deps-cache.ts +++ b/packages/workspace/src/core/nx-deps/nx-deps-cache.ts @@ -183,10 +183,10 @@ export function extractCachedFileData( cachedFileData: { [project: string]: { [file: string]: FileData } }; } { const filesToProcess: ProjectFileMap = {}; + const cachedFileData: Record> = {}; const currentProjects = Object.keys(fileMap).filter( (name) => fileMap[name].length > 0 ); - const cachedFileData = {}; currentProjects.forEach((p) => { processProjectNode(p, c.nodes[p], cachedFileData, filesToProcess, fileMap); }); diff --git a/packages/workspace/src/utils/graph-utils.ts b/packages/workspace/src/utils/graph-utils.ts index 6ceec0d9bd..2846d32688 100644 --- a/packages/workspace/src/utils/graph-utils.ts +++ b/packages/workspace/src/utils/graph-utils.ts @@ -1,4 +1,4 @@ -import type { ProjectGraph, ProjectGraphNode } from '@nrwl/devkit'; +import type { FileData, ProjectGraph, ProjectGraphNode } from '@nrwl/devkit'; import { isWorkspaceProject } from '../core/project-graph/operators'; interface Reach { @@ -120,10 +120,12 @@ export function findFilesInCircularPath( for (let i = 0; i < circularPath.length - 1; i++) { const next = circularPath[i + 1].name; - const files = circularPath[i].data.files; + const files: FileData[] = circularPath[i].data.files; filePathChain.push( Object.keys(files) - .filter((key) => files[key].deps?.indexOf(next) !== -1) + .filter( + (key) => files[key].deps && files[key].deps.indexOf(next) !== -1 + ) .map((key) => files[key].file) ); } diff --git a/packages/workspace/src/utils/runtime-lint-utils.ts b/packages/workspace/src/utils/runtime-lint-utils.ts index 022875c063..8b0f93b227 100644 --- a/packages/workspace/src/utils/runtime-lint-utils.ts +++ b/packages/workspace/src/utils/runtime-lint-utils.ts @@ -227,8 +227,8 @@ export function mapProjectGraphFiles( projectGraph.nodes as Record ).forEach(([name, node]) => { const files: Record = {}; - node.data.files.forEach(({ file, hash }) => { - files[removeExt(file)] = { file, hash }; + node.data.files.forEach(({ file, hash, deps }) => { + files[removeExt(file)] = { file, hash, ...(deps && { deps }) }; }); const data = { ...node.data, files };