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.
()
| 113 | // Returns "unknown" if no Effect dependency is found, if the version is nil, or if |
| 114 | // conflicting versions are detected. |
| 115 | func (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. |
no test coverage detected