top | item 44612626

(no title)

dsabanin | 7 months ago

Really loving Bun these days. Was really pleasantly surprised using their shell scripting API in typescript - single file, shebang line, straightforward DSL, support for piping data here and there.

Really, really nice and ergonomic. Made a few utility scripts today and enjoyed it much better than bash.

https://bun.com/docs/runtime/shell

discuss

order

eknkc|7 months ago

It is also my first choice now. Especially due to built in SQLite support. Also recently needed to write a simple script to dump some data to S3. Found out that bun has built in s3 client too...

Ciantic|7 months ago

I use Bun for many package.json projects, but for shell scripting specifically, I find that Deno is a better choice because you can use dependencies with just import statements via NPM or JSR.

    #!/usr/bin/env -S deno run
    import { z } from "npm:zod";
    import { Webview } from "jsr:@webview/webview";

lioeters|7 months ago

I just learned that Bun supports "autoimports" similar to the above.

> If no node_modules directory is found in the working directory or higher, Bun will abandon Node.js-style module resolution in favor of the Bun module resolution algorithm.

> Under Bun-style module resolution, all imported packages are auto-installed on the fly into a global module cache during execution (the same cache used by bun install).

https://bun.sh/docs/runtime/autoimport