Skip to content

Commit d95af34

Browse files
authored
Merge pull request #36 from pkgxdev/faster-shims
2 parents f8afa98 + 9d23e02 commit d95af34

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ jobs:
5959
- run: ./pkgm.ts i curl
6060
- run: /usr/local/bin/curl -L pkgx.sh
6161

62+
- run: ./pkgm.ts shim semverator
63+
- run: ~/.local/bin/semverator validate 1.0.0
64+
6265
# TODO pending: https://github.com/pkgxdev/pantry/issues/8487
6366
# - run: ./pkgm.ts i xpra.org # https://github.com/pkgxdev/pkgm/issues/13
6467
# - run: ls -la /usr/local/pkgs/xpra.org/v6.2.3/venv/bin

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ $ pkgm shim git
3131
# ^^ creates a shim for git in ~/.local/bin
3232
# these shims mimic the pkgx v1 lazy-loading shims, and are desirable for
3333
# certain types of self-healing and dev-setup containers, among other things
34+
# requires pkgx^2.4.0 for --shebang option
3435

3536
$ pkgm list
3637
# ^^ lists what is installed

pkgm.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env -S pkgx --quiet deno^2.1 run --ext=ts --allow-sys=uid --allow-run --allow-env=PKGX_DIR,HOMEBREW_PREFIX,HOME,PATH --allow-read
1+
#!/usr/bin/env -S pkgx --quiet deno^2.1 run --ext=ts --allow-sys=uid --allow-run --allow-env=PKGX_DIR,HOMEBREW_PREFIX,HOME,PATH --allow-read --allow-write
22
import { SemVer, semver } from "https://deno.land/x/libpkgx@v0.20.3/mod.ts";
33
import { dirname, fromFileUrl, join } from "jsr:@std/path@^1";
44
import { ensureDir, existsSync } from "jsr:@std/fs@^1";
@@ -212,8 +212,8 @@ async function shim(args: string[], basePath: string) {
212212
for await (const entry of Deno.readDir(bin_prefix)) {
213213
if (!entry.isFile && !entry.isSymlink) continue;
214214
const name = entry.name;
215-
const shim = "#!/bin/sh\n\n" +
216-
`exec ${pkgx} +${pkg.project}=${pkg.version} -- ${name} "$@"\n`;
215+
const shim =
216+
`#!/usr/bin/env -S pkgx +${pkg.project}=${pkg.version} --shebang --quiet -- ${name}`;
217217

218218
if (existsSync(join(basePath, "bin", name))) {
219219
await Deno.remove(join(basePath, "bin", name));

0 commit comments

Comments
 (0)