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
- graph: ProjectGraph
- removedEdges: Object
Methods
- addDependency
- addDynamicDependency
- addExplicitDependency
- addExternalNode
- addImplicitDependency
- addNode
- addStaticDependency
- getUpdatedProjectGraph
- mergeProjectGraph
- removeDependency
- removeNode
- setVersion
Constructors
constructor
• new ProjectGraphBuilder(graph?
, projectFileMap?
, nonProjectFiles?
)
Parameters
Name | Type |
---|---|
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
Name | Type |
---|---|
source | string |
target | string |
type | DependencyType |
sourceFile? | string |
Returns
void
addDynamicDependency
▸ addDynamicDependency(sourceProjectName
, targetProjectName
, sourceProjectFile
): void
Adds dynamic dependency from source project to target project
Parameters
Name | Type |
---|---|
sourceProjectName | string |
targetProjectName | string |
sourceProjectFile | string |
Returns
void
addExplicitDependency
▸ addExplicitDependency(sourceProjectName
, sourceProjectFile
, targetProjectName
): void
Add an explicit dependency from a file in source project to target project
Parameters
Name | Type |
---|---|
sourceProjectName | string |
sourceProjectFile | string |
targetProjectName | string |
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
Name | Type |
---|---|
node | ProjectGraphExternalNode |
Returns
void
addImplicitDependency
▸ addImplicitDependency(sourceProjectName
, targetProjectName
): void
Adds implicit dependency from source project to target project
Parameters
Name | Type |
---|---|
sourceProjectName | string |
targetProjectName | string |
Returns
void
addNode
▸ addNode(node
): void
Adds a project node to the project graph
Parameters
Name | Type |
---|---|
node | ProjectGraphProjectNode |
Returns
void
addStaticDependency
▸ addStaticDependency(sourceProjectName
, targetProjectName
, sourceProjectFile?
): void
Adds static dependency from source project to target project
Parameters
Name | Type |
---|---|
sourceProjectName | string |
targetProjectName | string |
sourceProjectFile? | string |
Returns
void
getUpdatedProjectGraph
▸ getUpdatedProjectGraph(): ProjectGraph
Returns
mergeProjectGraph
▸ mergeProjectGraph(p
): void
Merges the nodes and dependencies of p into the built project graph.
Parameters
Name | Type |
---|---|
p | ProjectGraph |
Returns
void
removeDependency
▸ removeDependency(sourceProjectName
, targetProjectName
): void
Removes a dependency from source project to target project
Parameters
Name | Type |
---|---|
sourceProjectName | string |
targetProjectName | string |
Returns
void
removeNode
▸ removeNode(name
): void
Removes a node and all of its dependency edges from the graph
Parameters
Name | Type |
---|---|
name | string |
Returns
void
setVersion
▸ setVersion(version
): void
Set version of the project graph
Parameters
Name | Type |
---|---|
version | string |
Returns
void