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
3 changes: 2 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ jobs:
mv pkgm.ts pkgm
tar czf pkgm-$V.tgz pkgm

- uses: pkgxdev/setup@v2
- uses: pkgxdev/setup@v3

- name: verify `pkgm --version`
run: test "$(./pkgm --version)" = "pkgm $V"

Expand Down
13 changes: 6 additions & 7 deletions pkgm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ 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";

const out = new Deno.Command("pkgx", { args: ["--version"] }).outputSync();
const match = new TextDecoder().decode(out.stdout).match(/pkgx 2.(\d+)/);
if (!match || parseInt(match[1]) < 4) {
console.error("pkgm requires pkgx 2.4.0 or later");
Deno.exit(1);
}

function standardPath() {
let path = "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin";

Expand Down Expand Up @@ -461,6 +454,12 @@ function get_pkgx() {
for (const path of Deno.env.get("PATH")!.split(":")) {
const pkgx = join(path, "pkgx");
if (existsSync(pkgx)) {
const out = new Deno.Command(pkgx, { args: ["--version"] }).outputSync();
const match = new TextDecoder().decode(out.stdout).match(/pkgx 2.(\d+)/);
if (!match || parseInt(match[1]) < 4) {
console.error("pkgm requires pkgx 2.4.0 or later");
Deno.exit(1);
}
return pkgx;
}
}
Expand Down
Loading