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 🙏

© 2025 – Pkg Stats / Ryan Hefner

bunjs-env

v1.0.0

Published

Cross-platform environment variable setter for Bun.js

Readme

bunjs-env

Cross-platform environment variable setter optimized for Bun.js.

Installation

# Install globally
bun install -g bunjs-env

# Or use with bunx (no installation required)
bunx bunjs-env NODE_ENV=production bun run start

Usage

Set environment variables before running commands, works consistently across all platforms:

bunjs-env NODE_ENV=production bun run start
bunjs-env DEBUG=true API_KEY=secret bun run dev
bunjs-env NODE_ENV=test bun test

Multiple Environment Variables

bunjs-env NODE_ENV=production PORT=3000 DEBUG=false bun run start

Debug Mode

See exactly what environment variables are set and which command is executed:

bunjs-env --debug NODE_ENV=test bun run test

Why bunjs-env?

Built specifically for the Bun ecosystem with native performance optimizations. Inspired by the excellent cross-env but optimized for Bun's unique capabilities:

  • Zero dependencies - Lightweight and secure
  • Native Bun integration - Uses Bun's built-in shell capabilities
  • TypeScript ready - Works seamlessly with TypeScript projects
  • Fast execution - Leverages Bun's performance advantages

Note: If you're using Node.js, cross-env is the excellent standard choice. bunjs-env is designed specifically for Bun users who want native integration.

Examples

Development

bunjs-env NODE_ENV=development DEBUG=true bun run dev
bunjs-env NODE_ENV=test DATABASE_URL=test.db bun test

Production

bunjs-env NODE_ENV=production bun run build
bunjs-env NODE_ENV=production PORT=8080 bun run start

CI/CD

bunjs-env NODE_ENV=test CI=true bun run test:coverage

CLI Options

  • -h, --help — Show help message
  • --debug — Enable debug output showing environment variables and command execution

Requirements

  • Bun.js >= 1.0.0

API

Environment variables must follow standard naming conventions:

  • Start with a letter or underscore
  • Contain only letters, numbers, and underscores
  • Format: KEY=value

Migration from cross-env

Switching from cross-env is straightforward - just replace cross-env with bunjs-env:

# Before (cross-env)
cross-env NODE_ENV=production npm run build

# After (bunjs-env)
bunjs-env NODE_ENV=production bun run build

License

MIT License — see LICENSE for details.

Related