Hacker News new | ask | show | jobs
by Ciantic 339 days 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";
1 comments

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