Fork me on GitHub
#babashka
<
2024-01-28
>
Felix Dorner14:01:05

I have a symlink to a bb script in ~/bin, and there’s a bb.edn next to target bb file. When I run via symlink, deps are not picked up. When I run via direct invocation, it works. I guess this is known behaviour? Would be nice if that worked.

Felix Dorner14:01:11

Basically what I would like is to have the script in the path, but not the bb.edn file. How do you guys solve this?

borkdude14:01:39

> How do you guys solve this? Add the directory with the script to the path?

borkdude14:01:09

but yeah, perhaps bb should resolve symlink of the executed script

borkdude14:01:28

another way to do it as add a bash script that invokes bb with the target script

Felix Dorner14:01:43

Yeah I think it should but then again… it’s either or, and you dont want to break other folks stuff now.

borkdude14:01:08

how would it break anyone if we followed the symlink?

Felix Dorner14:01:51

Not sure. I always expect the worst.

borkdude14:01:55

you could also use #C0400TZENE7 to install the script locally

Felix Dorner14:01:01

Hmm, yea, maybe it wouldnt break. Maybe someone has a bb.edn in it’s bin folder with ALL dependencies ever needed by all their scripts.. I’ts a bit constructed though.

borkdude14:01:29

we could search in both places and prioritize

borkdude14:01:11

I expect no breakage though, it seems highly unlikely that someone would want to use a local bb.edn if the script points elsewhere

Felix Dorner14:01:24

Should I open an issue for people to comment on?

borkdude14:01:53

I would vote for "use the bb.edn adjacent to the resolved link"

Felix Dorner14:01:15

For the moment, I’ll probably just add a wrapper in .zshrc

Stephan Renatus19:01:22

+1, I like to symlink my scripts into ~/bin, too 😅

borkdude19:01:06

please +1 the github issue if you haven't done so

borkdude19:01:21

I now see you have

🙂 1
Stephan Renatus19:01:43

I was hoping to get counted twice 🙃

borkdude19:01:37

it would also be worth checking what Node.js does: Node.js respects an adjacent package.json

borkdude19:01:56

yep, node.js does the same

borkdude11:01:56

symlink stuff has been merged, you can try it out with:

bash <(curl ) --dev-build --dir /tmp

Felix Dorner11:01:24

This will install to /tmp?

borkdude11:01:58

just to not mess with your "official" install, but feel free to install it elsewhere of course

Felix Dorner11:01:16

checked, and works! Awesome 🙂

simonsimonsimon05:01:10

didn't completely follow this im a noob but declaring dependencies in the script could be a potential solution? https://clojurians.slack.com/archives/CLX41ASCS/p1706662987274729

borkdude09:01:59

The add-deps way is fine for single scripts, but not for projects that require more than one file. Also clojure-lsp support is better with bb.edn

👀 1