* Add a project to the graph * * @public * @param {@ui5/project/specifications/Project} project Project which should be added to the graph
(project)
| 56 | * @param {@ui5/project/specifications/Project} project Project which should be added to the graph |
| 57 | */ |
| 58 | addProject(project) { |
| 59 | this._checkSealed(); |
| 60 | const projectName = project.getName(); |
| 61 | if (this._projects.has(projectName)) { |
| 62 | throw new Error( |
| 63 | `Failed to add project ${projectName} to graph: A project with that name has already been added. ` + |
| 64 | `This might be caused by multiple modules containing projects with the same name`); |
| 65 | } |
| 66 | if (!isNaN(projectName)) { |
| 67 | // Reject integer-like project names. They would take precedence when traversing object keys which |
| 68 | // could lead to unexpected behavior. We don't really expect anyone to use such names anyways |
| 69 | throw new Error( |
| 70 | `Failed to add project ${projectName} to graph: Project name must not be integer-like`); |
| 71 | } |
| 72 | log.verbose(`Adding project: ${projectName}`); |
| 73 | this._projects.set(projectName, project); |
| 74 | this._adjList.set(projectName, new Set()); |
| 75 | this._optAdjList.set(projectName, new Set()); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Retrieve a single project from the dependency graph |
no test coverage detected