@awesomeness-js/utils
v1.2.7
Published
Awesomeness - Utils
Readme
Nothing Special
Just some zero dependency* utils that every Awesomeness.js project uses.
Perfect? Far from it.
Better than what you have now? For sure.
🚀 Auto-Generate API Exports for Your Node.js Project
📌 Why "build" Exists
When you’re building a Node.js project, pulling functions together into a clean, predictable API shouldn’t feel like busywork. But maintaining a manual index.js is a waste of time, and Webpack? That’s a browser bundler—great for shipping front-end bundles, useless for building a logical backend export layer.
This script takes that grunt work off your plate and does it right:
✅ Consolidates all exports into a single, perfectly structured API object
✅ Keeps function names and namespaces exactly as your folder structure dictates—no mystery, no guessing
✅ Pulls in JSDoc comments so your documentation is baked right into the build. Intellisense loves this.
✅ Runs in plain Node.js—zero bundlers, zero fluff, zero excuses
Hint: Use the Awesomeness Intellitip VS Code Extension for classy hover documentation.
💡 Why Use This Over Webpack or Manual Indexing?
Webpack is a great bundler, but it’s not suited for building a structured export layer for backend code. This script offers a focused, ergonomic solution:
✔ Automatic export generation — no more maintaining index.js by hand
✔ JSDoc extraction—Includes comments directly in the generated file.
✔ Simple and predictable—You control how exports are structured.
✔ Namespace support—Uses folder structure to organize functions logically.
✔ Minimal setup — one line to generate your exports
⚙️ How It Works
- Scans the
./srcdirectory for.jsfiles - Generates import statements
- Creates an API object that mirrors your folder structure.
- Extracts JSDoc comments from each file and attaches them to the exports.
- Outputs a clean, structured
index.jsfile, ready to use.
🔧 Usage
To run it:
import { build } from '@awesomeness-js/utils';
await build();This will:
- Scan the
./srcdirectory - Create or overwrite
./index.js - Structure exports based on your file and folder layout
Customize it:
await build({
src: './my-functions',
dest: './api.js',
includeComments: true,
useTabs: true,
});📦 Example Output
Given this folder structure:
src/
├── roxbury/
│ ├── didYouJustGrabMyAss.js
│ ├── areYouGuysBrothers.js
├── bros/
│ ├── didWeJustBecomeBestFriends.js
│ ├── prestigeWorldwide.js
├── rickyBobby/
│ ├── iWakeUpAndPissExcellence.js
│ ├── iRaiseWinners.js
│ ├── shakeAndBake.js
├── oldSchool/
│ ├── youMyBoyBlue.js
├── news/
│ ├── thatEscalatedQuickly.js
│ ├── stayClassy.js
│ ├── milkWasABadChoice.js
├── tommy/
│ ├── roomService.js
│ ├── fatGuyInALittleCoat.js
├── menInTights/
│ ├── youGrewBoobs.js
│ ├── merryMen/
│ │ ├── snipTheTip.jsUse it like:
// Default import: full API
import api from './index.js';
// Use the full API
api.roxbury.didYouJustGrabMyAss();
// perfect for CTRL+F
api.rickyBobby.shakeAndBake();
// deep
api.menInTights.youGrewBoobs();
api.menInTights.merryMen.snipTheTip();
// Named import also work
import { youMyBoy, roxbury } from './api.js';
// Use the named group
youMyBoy.blue();
roxbury.didYouGrabMyAss();
💪 Who’s This For?
- Teams who want clean and consistent APIs
- Expert ~~developers~~ architects obsessed with
- organization
- hierarchy
- explicit namespacing
- clean code
- Champions who know CTRL+F
app.roxbury.didYouJustGrabMyAsswill always beat any “magic” refactor tool when it comes to finding every. single. usage. - Developers who refuse to hide functions behind lazy aliases, and instead demand predictable, grep-able APIs that tell you exactly where the code lives.
If you want a smarter way to manage and structure exports in a Node.js project — without extra tooling bloat — this script was built for you.
If that makes you hard, you’re in the right place.
If it makes you mad… you’ve probably never built a scalable codebase.
Ready to make development great again? 👉 awesomenessjs.com
✱ disclaimer... Kinda zero dependencies. Zero prod dependencies.
dev dependencies:
vitestfor testing
