@egjiri/node-kit
v2.6.0
Published
TypeScript/Javascript Utilities
Readme
A collection of useful Node.js utility functions that can be used across projects. Written in TypeScript.
- 🚀 Node.js Only (not for DOM/browsers)
- 📦 Zero Dependencies - No runtime dependencies
Installation
The library is available as an npm package. To install the package using your favorite package manager run:
| Package Manager | Command |
|-----------------|---------|
| npm | npm install @egjiri/node-kit |
| pnpm | pnpm add @egjiri/node-kit |
| yarn | yarn add @egjiri/node-kit |
| bun | bun add @egjiri/node-kit |
Usage Examples
import { formatNumber } from '@egjiri/node-kit/numbers'
formatNumber(1234.56, 'currency');
// => $1,234.56import { removeKeysWithBlankValues } from '@egjiri/node-kit/objects'
removeKeysWithBlankValues({
first: 'first',
second: null,
third: undefined,
fourth: 4
});
// => { first: 'first', fourth: 4 }Development
- Install dependencies:
pnpm install - Run tests:
pnpm run test - Run tests in watch mode:
pnpm run test:watch(tests automatically re-run when TypeScript src files change) - Run code coverage report and open it in the browser
pnpm run coverage - Run all checks (lint, build, and coverage):
pnpm run all- This is the comprehensive command to run before committing changes - Start Coding!
Setting up GitHub Secrets
The CI GitHub Action requires a BADGE_API_KEY GitHub secret. To fetch this secret from 1Password and set it on GitHub, run the following command locally once. Re-run this command whenever the secret changes.
gh secret set BADGE_API_KEY --repo egjiri/node-kit --body "$(op read 'op://Infrastructure/Badge/BADGE_API_KEY' -n)"The coverage badge is automatically updated by the CI GitHub Action whenever tests run on the main branch. The badge is generated using the egjiri/badge project and hosted at badge.egjiri.com.
Release
This project uses automated publishing through GitHub Actions. Publishing happens automatically when you create and push a version tag.
How to Release:
Update the version in
package.json:# For a patch release (1.7.0 → 1.7.1) pnpm version patch -m "Upgrade version to %s" # For a minor release (1.7.0 → 1.8.0) pnpm version minor -m "Upgrade version to %s" # For a major release (1.7.0 → 2.0.0) pnpm version major -m "Upgrade version to %s"Push the tag to trigger the release workflow:
git push origin main --tags
What happens automatically:
- 🏷️ GitHub Release is created with the tag name
- 🏗️ Package is built (TypeScript → CommonJS & ESM with type definitions)
- 📦 Published to NPM with public access
- ✅ No manual intervention required
