Skip to content

Commit

Permalink
Merge pull request #12 from pkgxdev/integration-test
Browse files Browse the repository at this point in the history
check we… like… work
  • Loading branch information
mxcl authored Jan 17, 2025
2 parents 871c0b0 + d649ef5 commit 8588514
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
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/[email protected]";
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

0 comments on commit 8588514

Please sign in to comment.