shartjs
Version:
When your app crashes, it farts. That's it.
66 lines (43 loc) β’ 1.38 kB
Markdown
# π Debugging doesn't have to stink. But it can.
[](https://www.npmjs.com/package/shartjs)
[](./LICENSE)
[](https://nodejs.org/)
>
**`shartjs`** is a tiny Node.js package that plays a random fart sound when your app crashes β consider it a strong motivator to write better error handling.
---
## π Install
```bash
pnpm add -D shartjs
# or
npm install --save-dev shartjs
# or
yarn add -D shartjs
```
## π Usage
In your app entry point (index.ts, server.ts, etc.):
```ts
import { initShart } from "shartjs";
initShart();
```
Now, if your app throws an unhandled exception or rejection, shart will:
β’ π¨ Play a random fart sound
β’ π₯ Log the error
β’ β οΈ Exit the process
## π± Dev-Only Mode
Want to keep things professional in production?
if (process.env.NODE_ENV === "development") {
initShart();
}
## π§ͺ Example
```ts
import { initShart } from "shart";
initShart();
throw new Error("Oh no I sharted"); // π©π¨
```
## π¦ Whatβs Included
- β
3 glorious .wav fart files
- β
Zero runtime dependencies (except play-sound)
- β
Works with Node.js v16+
- β
ESM-only support (modern import style)
## π License
MIT Β© Parth Koshti