Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ jobs:
- run: ./pkgm.ts shim semverator
- run: ~/.local/bin/semverator validate 1.0.0

# tests shims do not shim deps
- run: ./pkgm.ts shim node
- run: test ! -d ~/.local/bin/openssl

- run: ./pkgm.ts i hyperfine@1.18
- run: ./pkgm.ts outdated | grep hyperfine
- run: if pkgx semverator satisfies '>=1.19' "$(hyperfine --version | cut -f 2 -d ' ')"; then false; fi
Expand Down
16 changes: 16 additions & 0 deletions pkgm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { dirname, join } from "jsr:@std/path@^1";
import { ensureDir, existsSync, walk } from "jsr:@std/fs@^1";
import { parseArgs } from "jsr:@std/cli@^1";
import hydrate from "https://deno.land/x/libpkgx@v0.20.3/src/plumbing/hydrate.ts";
import { basename } from "node:path";

function standardPath() {
let path = "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin";
Expand Down Expand Up @@ -211,7 +212,22 @@ async function shim(args: string[], basePath: string) {

const json = (await query_pkgx(pkgx, args))[0];

const projects_we_care_about = [];
for (const pkg of json.pkgs) {
const cmds = await hooks.usePantry().project(pkg.pkg.project).provides();
const set = new Set(cmds.map((x) => basename(x)));
if (!args.some((x) => set.has(x))) continue;
const companions = await hooks.usePantry().project(pkg.pkg.project)
.companions();
projects_we_care_about.push(
pkg.pkg.project,
...companions.map((x) => x.project),
);
}

for (const pkg of json.pkgs) {
if (!projects_we_care_about.includes(pkg.pkg.project)) continue;

for (const bin of ["bin", "sbin"]) {
const bin_prefix = pkg.path.join(bin);
if (!bin_prefix.exists()) continue;
Expand Down
Loading