MCPcopy Create free account
hub / github.com/hashintel/hash / enforceConsistentDependenciesAcrossTheProject

Function enforceConsistentDependenciesAcrossTheProject

yarn.config.cjs:68–93  ·  view source on GitHub ↗

* Enforces consistent dependency versions across all workspaces in the project. * * This rule ensures that all workspaces use the same version of a given dependency. * * @param {Context} context - The Yarn constraint context.

({ Yarn })

Source from the content-addressed store, hash-verified

66 * @param {Context} context - The Yarn constraint context.
67 */
68function enforceConsistentDependenciesAcrossTheProject({ Yarn }) {
69 const workspaceIdents = new Set(
70 Yarn.workspaces().map((workspace) => workspace.ident),
71 );
72
73 for (const dependency of Yarn.dependencies()) {
74 if (shouldIgnoreDependencyForConsistency(dependency)) {
75 continue;
76 }
77
78 // Skip workspace dependencies; enforceProtocols handles them via workspace:*
79 if (workspaceIdents.has(dependency.ident)) {
80 continue;
81 }
82
83 for (const otherDependency of Yarn.dependencies({
84 ident: dependency.ident,
85 })) {
86 if (shouldIgnoreDependencyForConsistency(otherDependency)) {
87 continue;
88 }
89
90 dependency.update(otherDependency.range);
91 }
92 }
93}
94
95/**
96 * Enforces no dual-type dependencies across workspaces.

Callers 1

constraintsFunction · 0.85

Calls 4

hasMethod · 0.80
mapMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected