Skip to content

Commit a24dbc9

Browse files
committed
Add local guide for running and testing a local fork
1 parent 7818a53 commit a24dbc9

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,54 @@ same as `dev` does in your terminal.
248248
We use `deno`, so either install that or—you know—type `dev`.
249249
250250
Edit [./src/sniff.ts](src/sniff.ts) to add new dev types.
251+
252+
### Running your fork locally
253+
254+
`./app.ts` is a `deno` script with a shebang, so once you’ve cloned the repo
255+
you can invoke it directly:
256+
257+
```sh
258+
$ ./app.ts --version
259+
dev 0.0.0+dev
260+
```
261+
262+
To test changes as your daily-driver `dev` you need to make the shellcode it
263+
generates embed _your_ local script. Two gotchas to be aware of:
264+
265+
1. **Symlinking `app.ts` directly breaks `deno.json` resolution.** Deno looks
266+
for `deno.json` next to the script path it’s actually invoked as, and
267+
doesn’t follow symlinks. Use a thin shell wrapper instead:
268+
269+
```sh
270+
cat > ~/.local/bin/dev <<EOF
271+
#!/bin/sh
272+
exec $(pwd)/app.ts "\$@"
273+
EOF
274+
chmod +x ~/.local/bin/dev
275+
```
276+
277+
2. **The shellcode embeds the path to `dev` at generation time** by searching
278+
`$PATH`. So `~/.local/bin` needs to be ahead of any other `dev` install
279+
_before_ shell init runs `eval "$(dev --shellcode)"`.
280+
281+
In your `~/.zshrc` (or `~/.bashrc`), prepend `~/.local/bin` to `PATH`
282+
before the `dev` integration line:
283+
284+
```sh
285+
export PATH="$HOME/.local/bin:$PATH"
286+
eval "$(dev --shellcode)"
287+
```
288+
289+
(If you’re already integrated via `dev integrate`, that line will already
290+
exist, just add the `export PATH=…` above it)
291+
292+
Open a fresh shell and verify the hook is wired to your local script:
293+
294+
```zsh
295+
functions _pkgx_chpwd_hook | grep eval
296+
# expect: eval "$(/Users/you/.local/bin/dev "$dir")"
297+
```
298+
299+
If you see the path to your wrapper, you’re running your fork end-to-end.
300+
Reverting is a `rm ~/.local/bin/dev` and removing the line(s) from your
301+
shell rc.

0 commit comments

Comments
 (0)