(binPath)
| 61 | } |
| 62 | |
| 63 | function getInstalledVersion(binPath) { |
| 64 | try { |
| 65 | const result = spawnSync(binPath, ["version"], { |
| 66 | encoding: "utf8", |
| 67 | timeout: 3000, |
| 68 | }); |
| 69 | const match = (result.stdout || "").match(/v(\d+\.\d+(?:\.\d+)?)/); |
| 70 | return match ? match[1] : null; |
| 71 | } catch (_) { |
| 72 | return null; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | function fetchLatestVersion(pkg) { |
| 77 | const registry = (pkg.publishConfig && pkg.publishConfig.registry) || DEFAULT_REGISTRY; |