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


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

Parameters

NameType
sourceProjectNamestring
sourceProjectFilestring
targetProjectNamestring

Returns

void

Deprecated

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


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


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


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