MCPcopy
hub / github.com/tldraw/tldraw / enforceConsistentDependenciesAcrossTheProject

Function enforceConsistentDependenciesAcrossTheProject

yarn.config.cjs:7–35  ·  view source on GitHub ↗

* @param {Context} context

({ Yarn })

Source from the content-addressed store, hash-verified

5 * @param {Context} context
6 */
7function enforceConsistentDependenciesAcrossTheProject({ Yarn }) {
8 // check non-peer deps:
9 for (const dependency of Yarn.dependencies()) {
10 if (dependency.type === 'peerDependencies') continue
11
12 for (const otherDependency of Yarn.dependencies({ ident: dependency.ident })) {
13 if (otherDependency.type === 'peerDependencies') continue
14
15 dependency.update(otherDependency.range)
16 }
17 }
18
19 // check peer deps:
20 for (const dependency of Yarn.dependencies()) {
21 if (dependency.type !== 'peerDependencies') continue
22
23 for (const otherDependency of Yarn.dependencies({ ident: dependency.ident })) {
24 if (otherDependency.type !== 'peerDependencies') continue
25
26 dependency.update(otherDependency.range)
27 }
28 }
29
30 for (const workspace of Yarn.workspaces()) {
31 if (workspace.cwd === '.') continue
32
33 workspace.set('packageManager', undefined)
34 }
35}
36
37/**
38 * Require a Node version where `require()` of an ES module works natively, so

Callers 1

yarn.config.cjsFile · 0.85

Calls 2

updateMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…