(binRoot: string, name: string, packageDir: string, target: string, seen: Set<string>)
| 83 | } |
| 84 | |
| 85 | async function linkBinary(binRoot: string, name: string, packageDir: string, target: string, seen: Set<string>) { |
| 86 | if (!name || !target) { |
| 87 | return |
| 88 | } |
| 89 | const normalizedName = normalizeBinName(name) |
| 90 | if (seen.has(normalizedName)) { |
| 91 | return |
| 92 | } |
| 93 | const resolved = join(packageDir, target) |
| 94 | const script = Bun.file(resolved) |
| 95 | if (!(await script.exists())) { |
| 96 | return |
| 97 | } |
| 98 | seen.add(normalizedName) |
| 99 | const destination = join(binRoot, normalizedName) |
| 100 | const relativeTarget = relative(binRoot, resolved) || "." |
| 101 | await rm(destination, { force: true }) |
| 102 | await symlink(relativeTarget, destination) |
| 103 | rewritten++ |
| 104 | } |
| 105 | |
| 106 | async function exists(path: string) { |
| 107 | try { |
no test coverage detected