github/rafifos/bits
jsrepo init github/rafifos/bits
Rafifos's Bits and Bytes
A collection of reusable TypeScript utility functions and helpers that are too small to be their own libraries.
Overview
This repository contains small, focused utility functions that can be easily imported into your projects using jsrepo. Each utility is thoroughly tested and follows modern TypeScript best practices.
Installation
This library is distributed via jsrepo, which allows you to import just the specific utilities you need without any additional dependencies.
- Setup jsrepo if you haven't already:
npx jsrepo init --project
- Use any utility directly in your project:
npx jsrepo add github/rafifos/bits/utils/handle-async
Available Utilities
- handle-async: A utility for handling async functions with proper error handling.
- should-never-happen: A utility for handling cases that should never occur in your application flow.
Development
Prerequisites
- Node.js ≥ 22
- pnpm ≥ 10
Setup
- Clone the repository:
git clone https://github.com/rafifos/bits.git
cd bits
- Install dependencies:
pnpm install
Commands
pnpm build
- Builds the jsrepo registrypnpm test
- Runs tests with Jestpnpm lint
- Runs Biome linter and formatter
Adding a New Utility
- Create a new file in the appropriate category directory (e.g.,
src/utils/my-utility.ts
) - Add tests in a corresponding
my-utility.test.ts
file - Run
pnpm build
to update the jsrepo manifest - Run
pnpm test
to ensure everything works correctly
Commit Guidelines
This project uses Conventional Commits for commit messages, enforced by commitlint.
Examples:
feat: add new handle-error utility
fix: correct type definition in handle-async
docs: update usage examples
test: add more test cases for should-never-happen
CI/CD
This project uses GitHub Actions for continuous integration:
- Code quality checks with Biome
- Unit tests with Jest
- Commit message validation with commitlint
- Automatic jsrepo manifest updates
License
MIT License - see the LICENSE file for details.
Files
- handle-async.ts
- handle-async.test.ts
Remote Dependencies
Local Dependencies
utils/should-never-happen
Files
- should-never-happen.ts
- should-never-happen.test.ts
Remote Dependencies
Local Dependencies
Package | Version |
---|
{
"categories": [
{
"name": "utils",
"blocks": [
{
"name": "handle-async",
"category": "utils",
"localDependencies": [],
"dependencies": [],
"devDependencies": [],
"tests": true,
"list": true,
"directory": "src/utils",
"subdirectory": false,
"files": [
"handle-async.ts",
"handle-async.test.ts"
],
"_imports_": {}
},
{
"name": "should-never-happen",
"category": "utils",
"localDependencies": [],
"dependencies": [],
"devDependencies": [],
"tests": true,
"list": true,
"directory": "src/utils",
"subdirectory": false,
"files": [
"should-never-happen.ts",
"should-never-happen.test.ts"
],
"_imports_": {}
}
]
}
]
}
Copy
Repository https://github.com/rafifos/bits
Categories 1
Blocks 2
Dependencies 0
Config Files 0