* Detect whether the current installation was done via bun. * Checks if the binary path contains "bun" or if bun's global install dir has our package.
()
| 46 | * Checks if the binary path contains "bun" or if bun's global install dir has our package. |
| 47 | */ |
| 48 | function isBunInstallation(): boolean { |
| 49 | // Check if the running binary is under bun's global install path |
| 50 | const execPath = process.execPath |
| 51 | if (execPath.includes('bun')) { |
| 52 | return true |
| 53 | } |
| 54 | |
| 55 | // Check bun's global install directory |
| 56 | const bunGlobalDir = join(homedir(), '.bun', 'install', 'global') |
| 57 | if (existsSync(join(bunGlobalDir, 'node_modules', PACKAGE_NAME))) { |
| 58 | return true |
| 59 | } |
| 60 | |
| 61 | return false |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Get the latest version from npm registry. |
no test coverage detected