Skip to content

Commit 269121a

Browse files
committed
wip
1 parent f8bc90e commit 269121a

2 files changed

Lines changed: 21 additions & 12 deletions

File tree

README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,19 @@ Install `pkgx` packages to `/usr/local`.
1111

1212
```sh
1313
$ pkgm install node
14-
# ^^ installs latest git to ~/.local. ie. you get ~/.local/bin/git
14+
# ^^ installs latest node to ~/.local. ie. you get ~/.local/bin/node
1515

1616
$ pkgm install node@20.1
17-
# ^^ installs git^2.41 or switches out the installed git to 2.41
17+
# ^^ installs node^20.1 or switches out the installed node to 20.1
1818

1919
$ pkgm uninstall node
2020

2121
$ sudo pkgm install node
22-
# ^^ installs git to /usr/local. ie. you get /usr/local/bin/git
22+
# ^^ installs node to /usr/local. ie. you get /usr/local/bin/node
2323

2424
$ pkgm shim node
25-
# ^^ creates a shim for git in ~/.local/bin
26-
# these shims mimic the pkgx v1 lazy-loading shims, and are desirable for
27-
# certain types of self-healing and dev-setup containers, among other things
28-
# requires pkgx^2.4.0 for --shebang option
25+
# ^^ creates a shim for node at ~/.local/bin/node
26+
# see the docs below for details about shims
2927

3028
$ pkgm list
3129
# ^^ lists what’s installed
@@ -51,9 +49,20 @@ $ sudo pkgm update
5149
>
5250
> You should probably `sudo pkgm install` rather than install to `~/.local`.
5351
> This is because many other tools will not look in `~/.local` for packages
54-
> _even_ if it’s in `PATH`.
52+
> _even_ if it’s in `PATH`. Having said this—by all means—see how it goes!
53+
54+
> ### Shims
55+
>
56+
> Shims are files with a single line, eg `#!/usr/bin/env -S pkgx -q! node@22`.
57+
>
58+
> Thus using the shell to reinvoke the file via `pkgx`. You get all the benefits
59+
> of an installed package without actually having to install it. Desirable
60+
> traits for certain types of self-healing, devops containers and plenty more
61+
> one-off or ephemeral tasks.
5562
>
56-
> Having said this, by all means see how it goes!
63+
> Shims are pretty great—but have caveats. Some software might be surprised that
64+
> a package is not fully “installed” and lead to errors. In practice we have
65+
> seen issues only rarely and for more complex package combinations.
5766
5867
## Installation
5968

pkgm.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ async function install(args: string[], basePath: string) {
140140
// we are running as sudo on linux since it doesn’t give us a good way to get
141141
// the home directory of the pre-sudo user
142142
const pkgx_dir = (() => {
143-
const {path, pkg} = json.pkgs[0]!
143+
const { path, pkg } = json.pkgs[0]!;
144144
const remove = pkg.project + "/v" + pkg.version;
145-
return path.string.slice(0, - remove.length - 1 );
146-
})()
145+
return path.string.slice(0, -remove.length - 1);
146+
})();
147147

148148
const runtime_env = expand_runtime_env(json, basePath);
149149

0 commit comments

Comments
 (0)