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
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 6 additions & 5 deletions pkgm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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;
Expand Down Expand Up @@ -79,7 +80,7 @@ async function install(args: string[]) {
args = args.map((x) => `+${x}`);

const env: Record<string, string> = {
"PATH": standardPath,
"PATH": standardPath(),
};
const set = (key: string) => {
const x = Deno.env.get(key);
Expand Down
Loading