nx/docs/generated/devkit/ProjectGraphBuilder.md
Jason Jean 8f705e31e2
fix(misc): adjust deprecation messages to v20 (#23223)
<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Breaking Changes:


BREAKING CHANGE: `nx print-affected` was deprecated in 16.4.0 and has
been removed.
BREAKING CHANGE: `nx affected:graph` was deprecated in 16.4.0 and has
been removed.
BREAKING CHANGE: The `criticalPath` and `affectedProjects` properties of
the JSON created by `nx graph --file graph.json` was deprecated in
16.2.0 and has been removed.

## Current Behavior
<!-- This is the behavior we have today -->

Some deprecation messages still reference v19.

`nx print-affected` was deprecated in 16.4.0 to be removed in Nx 19 but
was not removed.
`nx affected:graph` was deprecated in 16.4.0 to be removed in Nx 19 but
was not removed.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

Deprecation messages reference v20 now.

`nx print-affected` is removed.
`nx affected:graph` is removed.

There are redirects to a `deprecated` page describing those commands for
Nx users using Nx <19

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #
2024-05-08 21:54:41 -04:00

7.0 KiB

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 20.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

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

Parameters

Name Type
graph? ProjectGraph
projectFileMap? ProjectFileMap
nonProjectFiles? FileData[]

Returns

ProjectGraphBuilder

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

ProjectGraph


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