fix(linter): fix broken circular deps output (#7810)

This commit is contained in:
Miroslav Jonaš 2021-11-22 03:51:41 -06:00 committed by GitHub
parent 4a3686c501
commit 2af9d4b4b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View File

@ -183,10 +183,10 @@ export function extractCachedFileData(
cachedFileData: { [project: string]: { [file: string]: FileData } };
} {
const filesToProcess: ProjectFileMap = {};
const cachedFileData: Record<string, Record<string, FileData>> = {};
const currentProjects = Object.keys(fileMap).filter(
(name) => fileMap[name].length > 0
);
const cachedFileData = {};
currentProjects.forEach((p) => {
processProjectNode(p, c.nodes[p], cachedFileData, filesToProcess, fileMap);
});

View File

@ -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)
);
}

View File

@ -227,8 +227,8 @@ export function mapProjectGraphFiles<T>(
projectGraph.nodes as Record<string, ProjectGraphProjectNode>
).forEach(([name, node]) => {
const files: Record<string, FileData> = {};
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 };