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

Function getPackageVersions

scripts/update-example-deps.ts:25–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23
24// Build a map of @tanstack package names to their current versions
25function getPackageVersions(): Map<string, string> {
26 const packagesDir = join(rootDir, `packages`)
27 const versions = new Map<string, string>()
28
29 for (const dir of readdirSync(packagesDir)) {
30 const packageJsonPath = join(packagesDir, dir, `package.json`)
31 try {
32 const stat = statSync(packageJsonPath)
33 if (!stat.isFile()) continue
34 } catch {
35 continue
36 }
37
38 try {
39 const packageJson: PackageJson = JSON.parse(
40 readFileSync(packageJsonPath, `utf-8`),
41 )
42 // Only include packages that have a name, version, and are @tanstack scoped
43 if (
44 packageJson.name.startsWith(`@tanstack/`) &&
45 packageJson.version &&
46 !packageJson.name.includes(`e2e`) // Skip e2e test packages
47 ) {
48 versions.set(packageJson.name, packageJson.version)
49 }
50 } catch {
51 console.warn(`Warning: Could not parse ${packageJsonPath}`)
52 }
53 }
54
55 return versions
56}
57
58// Find all package.json files in examples directory recursively
59function findExamplePackageJsons(dir: string): Array<string> {

Callers 1

mainFunction · 0.85

Calls 2

joinFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected