bun-check

1.0.1 • Public • Published

bun-check

Description

A simple library to throw onto the top of your bun files to guard against that pesky node.js runtime or old versions of bun. Zero-dependency, utilizes Bun native Bun.semver for comparisions.

How to use

$ bun install bun-check
import { bunCheck } from "bun-check";
// or
import bunCheck from "bun-check";

const opts = {
  desiredVersion: ">=1.0.0",
  error: ({message}) => {
    console.log("go away node.js or old bun.");
    process.exit();
  },
}

bunCheck(opts);

Options

type BunCheckOptions = {
  desiredVersion?: string; // the desired version you want, see Bun.semver API [1]
  error?: ({ message }: { message: string }) => void; // function either throws (default) or if provided an error callback, will fire that instead
}

[1] Bun Semver API

Happy baking!

Readme

Keywords

none

Package Sidebar

Install

npm i bun-check

Weekly Downloads

0

Version

1.0.1

License

none

Unpacked Size

18.8 kB

Total Files

12

Last publish

Collaborators

  • swawrzyn