MCPcopy Create free account
hub / github.com/TanStack/db / updateDependencies

Function updateDependencies

scripts/update-example-deps.ts:93–113  ·  view source on GitHub ↗
(
  deps: Record<string, string> | undefined,
  versions: Map<string, string>,
)

Source from the content-addressed store, hash-verified

91
92// Update dependencies in a package.json file
93function updateDependencies(
94 deps: Record<string, string> | undefined,
95 versions: Map<string, string>,
96): { updated: boolean; deps: Record<string, string> | undefined } {
97 if (!deps) return { updated: false, deps }
98
99 let updated = false
100 const newDeps = { ...deps }
101
102 for (const [name, currentVersion] of Object.entries(deps)) {
103 if (name.startsWith(`@tanstack/`) && versions.has(name)) {
104 const newVersion = `^${versions.get(name)}`
105 if (currentVersion !== newVersion) {
106 newDeps[name] = newVersion
107 updated = true
108 }
109 }
110 }
111
112 return { updated, deps: newDeps }
113}
114
115function main() {
116 console.log(`\n📦 Updating example dependencies...\n`)

Callers 1

mainFunction · 0.85

Calls 3

entriesMethod · 0.45
hasMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected