MCPcopy Create free account
hub / github.com/Effect-TS/tsgo / DetectEffectVersionString

Method DetectEffectVersionString

internal/typeparser/discover.go:115–141  ·  view source on GitHub ↗

DetectEffectVersionString returns the exact version string of the Effect library. Returns "unknown" if no Effect dependency is found, if the version is nil, or if conflicting versions are detected.

()

Source from the content-addressed store, hash-verified

113// Returns "unknown" if no Effect dependency is found, if the version is nil, or if
114// conflicting versions are detected.
115func (tp *TypeParser) DetectEffectVersionString() string {
116 if tp == nil || tp.checker == nil {
117 return "unknown"
118 }
119 packages := tp.DiscoverPackages()
120
121 var detected string
122 found := false
123
124 for _, pkg := range packages {
125 if pkg.Name != "effect" || pkg.Version == nil {
126 continue
127 }
128
129 if !found {
130 detected = *pkg.Version
131 found = true
132 } else if detected != *pkg.Version {
133 return "unknown"
134 }
135 }
136
137 if !found {
138 return "unknown"
139 }
140 return detected
141}
142
143// DiscoverPackages iterates all source files in the program, resolves each one's
144// nearest package.json, and returns a deduplicated list of discovered packages.

Callers 2

RunEffectTestFunction · 0.80
lazy_effect.goFile · 0.80

Calls 1

DiscoverPackagesMethod · 0.95

Tested by

no test coverage detected