@ui5/project/graph/ProjectGraph

@ui5/project/graph/ProjectGraph

A rooted, directed graph representing a UI5 project, its dependencies and available extensions.

While it allows defining cyclic dependencies, both traversal functions will throw an error if they encounter cycles.

Constructor

new @ui5/project/graph/ProjectGraph(parameters)

Source:
Parameters:
Name Type Description
parameters object Parameters
Properties
Name Type Description
rootProjectName string Root project name

Methods

addExtension(extension)

Description:
  • Add an extension to the graph
Source:
Parameters:
Name Type Description
extension @ui5/project/specifications/Extension Extension which should be available in the graph

addProject(project)

Description:
  • Add a project to the graph
Source:
Parameters:
Name Type Description
project @ui5/project/specifications/Project Project which should be added to the graph

(async) build(parameters) → {Promise}

Description:
  • Executes a build on the graph
Source:
Parameters:
Name Type Description
parameters object Build parameters
Properties
Name Type Attributes Default Description
destPath string Target path
cleanDest boolean <optional>
false Decides whether project should clean the target path before build
includedDependencies Array.<(string|RegExp)> <optional>
[] List of names of projects to include in the build result If the wildcard '*' is provided, all dependencies will be included in the build result.
excludedDependencies Array.<(string|RegExp)> <optional>
[] List of names of projects to exclude from the build result.
dependencyIncludes @ui5/project/build/ProjectBuilder~DependencyIncludes <optional>
Alternative to the includedDependencies and excludedDependencies parameters. Allows for a more sophisticated configuration for defining which dependencies should be part of the build result. If this is provided, the other mentioned parameters will be ignored.
selfContained boolean <optional>
false Flag to activate self contained build
cssVariables boolean <optional>
false Flag to activate CSS variables generation
jsdoc boolean <optional>
false Flag to activate JSDoc build
createBuildManifest boolean <optional>
false Whether to create a build manifest file for the root project. This is currently only supported for projects of type 'library' and 'theme-library'
includedTasks Array.<string> <optional>
[] List of tasks to be included
excludedTasks Array.<string> <optional>
[] List of tasks to be excluded.
outputStyle module:@ui5/project/build/ProjectBuilderOutputStyle <optional>
Default Processes build results into a specific directory structure.
Returns:
Promise resolving to undefined once build has finished
Type
Promise

declareDependency(fromProjectName, toProjectName)

Description:
  • Declare a dependency from one project in the graph to another
Source:
Parameters:
Name Type Description
fromProjectName string Name of the depending project
toProjectName string Name of project on which the other depends

declareOptionalDependency(fromProjectName, toProjectName)

Description:
  • Declare a dependency from one project in the graph to another
Source:
Parameters:
Name Type Description
fromProjectName string Name of the depending project
toProjectName string Name of project on which the other depends

getDependencies(projectName) → {Array.<string>}

Description:
  • Get all direct dependencies of a project as an array of project names
Source:
Parameters:
Name Type Description
projectName string Name of the project to retrieve the dependencies of
Returns:
Names of all direct dependencies
Type
Array.<string>

getExtension(extensionName) → {@ui5/project/specifications/Extension|undefined}

Source:
Parameters:
Name Type Description
extensionName string Name of the extension to retrieve
Returns:
Extension instance or undefined if the extension is unknown to the graph
Type
@ui5/project/specifications/Extension | undefined

getExtensionNames() → {Array.<string>}

Description:
  • Get names of all extensions in the graph
Source:
Returns:
Names of all extensions
Type
Array.<string>

getExtensions() → {Iterable.<@ui5/project/specifications/Extension>}

Description:
  • Get all extensions in the graph
Source:
Returns:
Type
Iterable.<@ui5/project/specifications/Extension>

getProject(projectName) → {@ui5/project/specifications/Project|undefined}

Description:
  • Retrieve a single project from the dependency graph
Source:
Parameters:
Name Type Description
projectName string Name of the project to retrieve
Returns:
project instance or undefined if the project is unknown to the graph
Type
@ui5/project/specifications/Project | undefined

getProjectNames() → {Array.<string>}

Description:
  • Get names of all projects in the graph
Source:
Returns:
Names of all projects
Type
Array.<string>

getProjects() → {Iterable.<@ui5/project/specifications/Project>}

Description:
  • Get all projects in the graph
Source:
Returns:
Type
Iterable.<@ui5/project/specifications/Project>

getRoot() → {@ui5/project/specifications/Project}

Description:
  • Get the root project of the graph
Source:
Returns:
Root project
Type
@ui5/project/specifications/Project

getSize() → {integer}

Description:
  • Get the number of projects in the graph
Source:
Returns:
Count of projects in the graph
Type
integer

getTransitiveDependencies(projectName) → {Array.<string>}

Description:
  • Get all (direct and transitive) dependencies of a project as an array of project names
Source:
Parameters:
Name Type Description
projectName string Name of the project to retrieve the dependencies of
Returns:
Names of all direct and transitive dependencies
Type
Array.<string>

isSealed() → {boolean}

Description:
  • Check whether the project graph has been sealed. This means the graph is read-only. Neither projects, nor dependencies between projects can be added or removed.
Source:
Returns:
True if the project graph has been sealed
Type
boolean

join(projectGraph)

Description:
  • Join another project graph into this one. Projects and extensions which already exist in this graph will cause an error to be thrown
Source:
Parameters:
Name Type Description
projectGraph @ui5/project/graph/ProjectGraph Project Graph to merge into this one

(async) resolveOptionalDependencies()

Description:
  • Transforms any optional dependencies declared in the graph to non-optional dependency, if the target can already be reached from the root project.
Source:

seal()

Description:
  • Seal the project graph so that no further changes can be made to it
Source:

(async) traverseBreadthFirst(startNameopt, callback)

Description:
  • Visit every project in the graph that can be reached by the given entry project exactly once. The entry project defaults to the root project. In case a cycle is detected, an error is thrown
Source:
Parameters:
Name Type Attributes Description
startName string <optional>
Name of the project to start the traversal at. Defaults to the graph's root project
callback @ui5/project/graph/ProjectGraph~traversalCallback Will be called

(async) traverseDepthFirst(startNameopt, callback)

Description:
  • Visit every project in the graph that can be reached by the given entry project exactly once. The entry project defaults to the root project. In case a cycle is detected, an error is thrown
Source:
Parameters:
Name Type Attributes Description
startName string <optional>
Name of the project to start the traversal at. Defaults to the graph's root project
callback @ui5/project/graph/ProjectGraph~traversalCallback Will be called

Type Definitions

(async) traversalCallback(parameters) → {Promise|undefined}

Description:
  • Callback for graph traversal operations
Source:
Parameters:
Name Type Description
parameters object Parameters passed to the callback
Properties
Name Type Description
project @ui5/project/specifications/Project Project that is currently visited
dependencies Array.<string> Array containing the names of all direct dependencies of the project
Returns:
If a promise is returned, graph traversal will wait and only continue once the promise has resolved.
Type
Promise | undefined