File tree Expand file tree Collapse file tree 4 files changed +20
-24
lines changed
Expand file tree Collapse file tree 4 files changed +20
-24
lines changed Original file line number Diff line number Diff line change 1- import { flatten } from "lodash" ;
21import { ProjectGraphProjectNodeWithPackage , ProjectGraphWithPackages } from "./project-graph-with-packages" ;
32
43export function addDependents (
54 projects : ProjectGraphProjectNodeWithPackage [ ] ,
65 projectGraph : ProjectGraphWithPackages
76) : ProjectGraphProjectNodeWithPackage [ ] {
87 const projectsLookup = new Set ( projects . map ( ( p ) => p . name ) ) ;
9- const dependents : Record < string , string [ ] > = flatten (
10- Object . values ( projectGraph . localPackageDependencies )
11- ) . reduce (
12- ( prev , next ) => ( {
13- ...prev ,
14- [ next . target ] : [ ...( prev [ next . target ] || [ ] ) , next . source ] ,
15- } ) ,
16- { } as Record < string , string [ ] >
17- ) ;
8+ const dependents : Record < string , string [ ] > = Object . values ( projectGraph . localPackageDependencies )
9+ . flat ( )
10+ . reduce (
11+ ( prev , next ) => ( {
12+ ...prev ,
13+ [ next . target ] : [ ...( prev [ next . target ] || [ ] ) , next . source ] ,
14+ } ) ,
15+ { } as Record < string , string [ ] >
16+ ) ;
1817
1918 const collected = new Set < ProjectGraphProjectNodeWithPackage > ( ) ;
2019
Original file line number Diff line number Diff line change 11import { ExecOptions } from "child_process" ;
2- import { flatten } from "lodash" ;
32import { describeRefSync } from "../describe-ref" ;
43import { getPackagesForOption } from "../get-packages-for-option" ;
54import log from "../npmlog" ;
@@ -178,15 +177,15 @@ export function collectDependents(
178177 nodes : Record < string , ProjectGraphProjectNodeWithPackage > ,
179178 projectGraph : ProjectGraphWithPackages
180179) : Set < ProjectGraphProjectNodeWithPackage > {
181- const dependents : Record < string , string [ ] > = flatten (
182- Object . values ( projectGraph . localPackageDependencies )
183- ) . reduce (
184- ( prev , next ) => ( {
185- ...prev ,
186- [ next . target ] : [ ...( prev [ next . target ] || [ ] ) , next . source ] ,
187- } ) ,
188- { } as Record < string , string [ ] >
189- ) ;
180+ const dependents : Record < string , string [ ] > = Object . values ( projectGraph . localPackageDependencies )
181+ . flat ( )
182+ . reduce (
183+ ( prev , next ) => ( {
184+ ...prev ,
185+ [ next . target ] : [ ...( prev [ next . target ] || [ ] ) , next . source ] ,
186+ } ) ,
187+ { } as Record < string , string [ ] >
188+ ) ;
190189
191190 const collected = new Set < ProjectGraphProjectNodeWithPackage > ( ) ;
192191
Original file line number Diff line number Diff line change 1- import { flatten } from "lodash" ;
21import PQueue from "p-queue" ;
32import { getCycles , mergeOverlappingCycles , reportCycles } from "./cycles" ;
43import { ProjectGraphProjectNodeWithPackage , ProjectGraphWithPackages } from "./project-graph-with-packages" ;
@@ -24,7 +23,7 @@ export async function runProjectsTopologically<T>(
2423
2524 const projectsMap = new Map ( projects . map ( ( p ) => [ p . name , p ] ) ) ;
2625 const localDependencies = projectGraph . localPackageDependencies ;
27- const flattenedLocalDependencies = flatten ( Object . values ( localDependencies ) ) ;
26+ const flattenedLocalDependencies = Object . values ( localDependencies ) . flat ( ) ;
2827
2928 const getProject = ( name : string ) => {
3029 const project = projectsMap . get ( name ) ;
Original file line number Diff line number Diff line change 1- import { flatten } from "lodash" ;
21import { getCycles , mergeOverlappingCycles , reportCycles } from "./cycles" ;
32import { ProjectGraphProjectNodeWithPackage , ProjectGraphWithPackages } from "./project-graph-with-packages" ;
43
@@ -9,7 +8,7 @@ export function toposortProjects(
98) : ProjectGraphProjectNodeWithPackage [ ] {
109 const projectsMap = new Map ( projects . map ( ( p ) => [ p . name , p ] ) ) ;
1110 const localDependencies = projectGraph . localPackageDependencies ;
12- const flattenedLocalDependencies = flatten ( Object . values ( localDependencies ) ) ;
11+ const flattenedLocalDependencies = Object . values ( localDependencies ) . flat ( ) ;
1312
1413 const getProject = ( name : string ) => {
1514 const project = projectsMap . get ( name ) ;
You can’t perform that action at this time.
0 commit comments