From 3edd5d6c60566f02198d1c5d321106b5584e25e3 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Fri, 17 Jan 2025 16:54:33 -0500 Subject: [PATCH 1/2] =?UTF-8?q?check=20we=E2=80=A6=20like=E2=80=A6=20work?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af1297e..b55c490 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,3 +21,10 @@ jobs: - run: deno fmt --check . - run: deno lint . - run: deno check ./pkgm.ts + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pkgxdev/setup@v3 + - run: ./pkgm.ts i git From d649ef5d5aeaba5e216e5f48cc6bb515ed672c32 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Fri, 17 Jan 2025 16:59:33 -0500 Subject: [PATCH 2/2] Just add the PATH if on mac --- pkgm.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pkgm.ts b/pkgm.ts index c51faa0..27d484c 100755 --- a/pkgm.ts +++ b/pkgm.ts @@ -4,15 +4,16 @@ import { ensureDir, existsSync } from "jsr:@std/fs@^1"; import { parse as parse_args } from "jsr:@std/flags@0.224.0"; import * as semver from "jsr:@std/semver@^1"; -const standardPath = (() => { +function standardPath() { const basePath = "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"; + // for pkgm installed via homebrew const homebrew = `${Deno.env.get("HOMEBREW_PREFIX") || "/opt/homebrew"}/bin`; - if (existsSync(homebrew)) { + if (Deno.build.os === "darwin") { return `${homebrew}:${basePath}`; } else { return basePath; } -})(); +} const parsedArgs = parse_args(Deno.args, { alias: { @@ -28,7 +29,7 @@ if (parsedArgs.help) { args: ["gh", "repo", "view", "pkgxdev/pkgm"], clearEnv: true, env: { - "PATH": standardPath, + "PATH": standardPath(), "HOME": Deno.env.get("HOME")!, }, }).spawn().status; @@ -79,7 +80,7 @@ async function install(args: string[]) { args = args.map((x) => `+${x}`); const env: Record = { - "PATH": standardPath, + "PATH": standardPath(), }; const set = (key: string) => { const x = Deno.env.get(key);