MCPcopy Create free account
hub / github.com/SAP/ui5-project / _declareDependency

Method _declareDependency

lib/graph/ProjectGraph.js:221–240  ·  view source on GitHub ↗

* Declare a dependency from one project in the graph to another * * @param {object} map Adjacency map to use * @param {string} fromProjectName Name of the depending project * @param {string} toProjectName Name of project on which the other depends

(map, fromProjectName, toProjectName)

Source from the content-addressed store, hash-verified

219 * @param {string} toProjectName Name of project on which the other depends
220 */
221 _declareDependency(map, fromProjectName, toProjectName) {
222 if (!this._projects.has(fromProjectName)) {
223 throw new Error(
224 `Unable to find depending project with name ${fromProjectName} in project graph`);
225 }
226 if (!this._projects.has(toProjectName)) {
227 throw new Error(
228 `Unable to find dependency project with name ${toProjectName} in project graph`);
229 }
230 if (fromProjectName === toProjectName) {
231 throw new Error(
232 `A project can't depend on itself`);
233 }
234 const adjacencies = map.get(fromProjectName);
235 if (adjacencies.has(toProjectName)) {
236 log.warn(`Dependency has already been declared: ${fromProjectName} depends on ${toProjectName}`);
237 } else {
238 adjacencies.add(toProjectName);
239 }
240 }
241
242 /**
243 * Get all direct dependencies of a project as an array of project names

Callers 2

declareDependencyMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected