* 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 * * @public * @param {string} [startName] Name of the project to start the traversal at. Defau
(startName, callback)
| 443 | * @param {@ui5/project/graph/ProjectGraph~traversalCallback} callback Will be called |
| 444 | */ |
| 445 | async traverseDepthFirst(startName, callback) { |
| 446 | if (!callback) { |
| 447 | // Default optional first parameter |
| 448 | callback = startName; |
| 449 | startName = this._rootProjectName; |
| 450 | } |
| 451 | |
| 452 | if (!this.getProject(startName)) { |
| 453 | throw new Error(`Failed to start graph traversal: Could not find project ${startName} in project graph`); |
| 454 | } |
| 455 | return this._traverseDepthFirst(startName, Object.create(null), [], callback); |
| 456 | } |
| 457 | |
| 458 | async _traverseDepthFirst(projectName, visited, ancestors, callback) { |
| 459 | this._checkCycle(ancestors, projectName); |
no test coverage detected