Class: ProjectGraphBuilder

A class which builds up a project graph

Deprecated

The ProjectGraphProcessor has been deprecated. Use a CreateNodes and/or a CreateDependencies instead. This will be removed in Nx 18.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ProjectGraphBuilder(graph?, projectFileMap?, nonProjectFiles?)

Parameters

NameType
graph?ProjectGraph
projectFileMap?ProjectFileMap
nonProjectFiles?FileData[]

Properties

graph

Readonly graph: ProjectGraph


nonProjectFiles

Private Readonly nonProjectFiles: FileData[]


projectFileMap

Private Readonly projectFileMap: ProjectFileMap


removedEdges

Readonly removedEdges: Object = {}

Index signature

▪ [source: string]: Set<string>

Methods

addDependency

addDependency(source, target, type, sourceFile?): void

Parameters

NameType
sourcestring
targetstring
typeDependencyType
sourceFile?string

Returns

void


addDynamicDependency

addDynamicDependency(sourceProjectName, targetProjectName, sourceProjectFile): void

Adds dynamic dependency from source project to target project

Parameters

NameType
sourceProjectNamestring
targetProjectNamestring
sourceProjectFilestring

Returns

void


addExplicitDependency

addExplicitDependency(sourceProjectName, sourceProjectFile, targetProjectName): void

Add an explicit dependency from a file in source project to target project

Deprecated

this method will be removed in v17. Use addStaticDependency or addDynamicDependency instead

Parameters

NameType
sourceProjectNamestring
sourceProjectFilestring
targetProjectNamestring

Returns

void


addExternalNode

addExternalNode(node): void

Adds a external node to the project graph

Parameters

NameType
nodeProjectGraphExternalNode

Returns

void


addImplicitDependency

addImplicitDependency(sourceProjectName, targetProjectName): void

Adds implicit dependency from source project to target project

Parameters

NameType
sourceProjectNamestring
targetProjectNamestring

Returns

void


addNode

addNode(node): void

Adds a project node to the project graph

Parameters

NameType
nodeProjectGraphProjectNode

Returns

void


addStaticDependency

addStaticDependency(sourceProjectName, targetProjectName, sourceProjectFile?): void

Adds static dependency from source project to target project

Parameters

NameType
sourceProjectNamestring
targetProjectNamestring
sourceProjectFile?string

Returns

void


calculateAlreadySetTargetDeps

Private calculateAlreadySetTargetDeps(sourceProject): Map<string, Map<string, ProjectGraphDependency>>

Parameters

NameType
sourceProjectstring

Returns

Map<string, Map<string, ProjectGraphDependency>>


calculateTargetDepsFromFiles

Private calculateTargetDepsFromFiles(sourceProject): Map<string, Set<string>>

Parameters

NameType
sourceProjectstring

Returns

Map<string, Set<string>>


getUpdatedProjectGraph

getUpdatedProjectGraph(): ProjectGraph

Returns

ProjectGraph


mergeProjectGraph

mergeProjectGraph(p): void

Merges the nodes and dependencies of p into the built project graph.

Parameters

NameType
pProjectGraph

Returns

void


removeDependenciesWithNode

Private removeDependenciesWithNode(name): void

Parameters

NameType
namestring

Returns

void


removeDependency

removeDependency(sourceProjectName, targetProjectName): void

Removes a dependency from source project to target project

Parameters

NameType
sourceProjectNamestring
targetProjectNamestring

Returns

void


removeNode

removeNode(name): void

Removes a node and all of its dependency edges from the graph

Parameters

NameType
namestring

Returns

void


setVersion

setVersion(version): void

Set version of the project graph

Parameters

NameType
versionstring

Returns

void