(pkg: { json: Record<string, unknown>; dir: string; pkg: string })
| 143 | } |
| 144 | |
| 145 | function packageTargets(pkg: { json: Record<string, unknown>; dir: string; pkg: string }) { |
| 146 | const spec = |
| 147 | typeof pkg.json.name === "string" && pkg.json.name.trim().length > 0 ? pkg.json.name.trim() : path.basename(pkg.dir) |
| 148 | const targets: Target[] = [] |
| 149 | const server = exportTarget(pkg.json, "server") |
| 150 | if (server) { |
| 151 | targets.push({ kind: "server", opts: server.opts }) |
| 152 | } else if (hasMainTarget(pkg.json)) { |
| 153 | targets.push({ kind: "server" }) |
| 154 | } |
| 155 | |
| 156 | const tui = exportTarget(pkg.json, "tui") |
| 157 | if (tui) { |
| 158 | targets.push({ kind: "tui", opts: tui.opts }) |
| 159 | } |
| 160 | |
| 161 | if (!targets.some((item) => item.kind === "tui") && readPackageThemes(spec, pkg).length) { |
| 162 | targets.push({ kind: "tui" }) |
| 163 | } |
| 164 | |
| 165 | return targets |
| 166 | } |
| 167 | |
| 168 | function patch(text: string, path: Array<string | number>, value: unknown, insert = false) { |
| 169 | return applyEdits( |
no test coverage detected