npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

bun-self

v0.1.0

Published

Do you sometimes wish that you could just run javascript as if it was bash?

Readme

bun-self

Let's say you have a file called script.ts with the following content:

import { $ } from "bun";
await $`curl -s wttr.in`;

And you really want your friend to run it, so you decide to share a gist with them, but they are not as cool as you and don't have Bun installed yet. A problem.

But you won't even believe what happens next:

bunx bun-self script.ts

And you send this beauty to your friend instead (script.run.ts):

#!/bin/sh

/*/.this-doesnt-exist 2>/dev/null
## Please do not edit this part of the script, this is a loader created by "npx bun-self"
if ! [ -x "$(command -v bun)" ]; then
    echo "Installing bun.sh"
    sleep 2
    curl -fsSL https://bun.sh/install | bash
    export BUN_INSTALL="$HOME/.bun"
    export PATH="$BUN_INSTALL/bin:$PATH"
    echo "Now let's run the script"
    echo ""
fi >&2
bun "$0"
exit 0
#*/

// Script starts here
import { $ } from "bun";
await $`curl -s wttr.in`;

Your friend just has to run it either with

bash script.run.ts

or

chmod +x ./script.run.ts
./script.run.ts

They won't even know what hit them.

Of course it doesn't have to be a friend, you can hide that stuff in plain sight at your job with an innocent-looking "bash script.run.ts" in the "scripts" section of your package.json and no one even will notice that they are now happy Bun users.

References