Skip to content

v1.1.0

Latest
Compare
Choose a tag to compare
@koistya koistya released this 24 Jul 19:35
· 1 commit to main since this release

🚀 Major Features

New Core API with Custom Word Lists

  • New codenames/core module - Use your own custom word lists
  • Flexible API - Support for both default cities-20 and custom arrays
  • Better TypeScript support - Full type safety with generics
// New: Use custom word lists
import { codename } from "codenames/core";
codename(123, ["alpha", "beta", "gamma"]); // "beta"

// Enhanced: Default cities-20 with optional custom lists
import codename from "codenames";
codename(123); // "berlin" (from cities-20)
codename(123, ["custom", "words"]); // "words"

Comprehensive ESM Package Exports

  • 77+ new export paths - Direct access to all themes and sizes
  • Runtime-specific optimizations - Dedicated Bun and Deno entry points
  • Tree-shaking friendly - Zero side effects for optimal bundling
// Direct theme imports
import codename from "codenames/animals-50";
import { codename } from "codenames/colors-100";

// All themes and sizes now available
import all from "codenames/all"; // Access to every word list

🧪 Testing & Quality

Extensive Test Coverage

  • New test suites for all 12 themes across 5 size variants (60+ theme files)
  • Core functionality testing with edge cases and error scenarios
  • Integration tests for CLI and cross-module compatibility
  • Word list validation ensuring consistency and quality

Enhanced Error Handling

  • Robust input validation - Clear error messages for invalid inputs
  • Finite number checks - Proper handling of NaN, Infinity, and edge cases
  • Empty word list protection - Graceful failures with helpful messages

🛠️ Developer Experience

Improved CLI Interface

  • Default theme support - No flags needed for basic usage
  • Better error reporting - Clear, actionable error messages
  • Enhanced theme selection - Support for all 12 themes and 5 sizes
# Simplified usage
codenames 1234              # Uses default cities-20
codenames 1234 --theme animals-50  # Specific theme and size

Enhanced Documentation

  • Complete README rewrite - Detailed API documentation and examples
  • Practical use cases - Real-world examples including preview deployments
  • Blog content - Comprehensive guide for preview deployment workflows
  • API references - JSDoc comments and TypeScript definitions

📦 Package & Distribution

Modern Package Structure

  • ESM-first approach - Native ES modules with proper exports
  • TypeScript declarations - Full type definitions for all exports
  • Multi-runtime support - Optimized for Node.js, Bun, Deno, and browsers
  • CLI binaries - Both codenames and cn command aliases

Enhanced Metadata

  • Expanded keywords - Better discoverability on npm
  • Proper licensing - SPDX headers on all source files
  • Build improvements - Enhanced scripts and tooling

🎨 Word Lists & Themes

New Theme Management

  • Consolidated word lists - New words/all.ts with complete collection
  • Enhanced generation scripts - Better validation and consistency
  • Improved distribution analysis - Hash distribution validation tools

All 12 Themes Available

Each theme now available in 5 sizes (10, 20, 30, 50, 100 words):

  • Animals, Cities, Colors, Countries, Elements
  • Emotions, Food, Gems, Nature, Snacks, Clothing, Adjectives

🔧 Technical Improvements

Code Architecture

  • Factory pattern implementation - Clean, reusable codename generation
  • Deterministic hashing - FNV-1a algorithm for consistent output
  • Pure functions - Predictable, testable code architecture
  • Modular design - Clear separation of concerns

Performance & Bundle Size

  • Zero runtime dependencies - Lightweight, fast execution
  • Optimized exports - Tree-shaking friendly for minimal bundles
  • Efficient hashing - Sub-millisecond generation times

📋 Files Changed

77 files modified with 1,950 additions and 279 deletions:

New Files

  • core/codename.ts - Core hashing and validation logic
  • core/index.ts - Public core API
  • core/index.test.ts - Core functionality tests
  • words/all.ts - Complete word list collection
  • words/all.test.ts - Comprehensive word list validation

Enhanced Files

  • All 60+ theme files with improved exports and TypeScript types
  • Complete README.md rewrite with practical examples
  • Enhanced package.json with comprehensive exports
  • Improved CLI with better UX and error handling
  • Updated generation and analysis scripts

🎯 Breaking Changes

While this is a minor version bump, some import paths have changed:

Migration Guide

Before (v1.0.x):

import codename from "codenames/cities-20";

After (v1.1.0):

// Still works - backward compatible
import codename from "codenames/cities-20";

// New options available
import codename from "codenames"; // default cities-20
import { codename } from "codenames/core"; // custom words

The library maintains backward compatibility, but the new APIs provide more flexibility and better TypeScript support.

🚀 Getting Started

npm install codenames@1.1.0
// Quick start with default cities-20
import codename from "codenames";
console.log(codename(1234)); // "london"

// Use custom words
import { codename } from "codenames/core";
console.log(codename(1234, ["red", "green", "blue"])); // "green"

// Theme-specific imports
import animalName from "codenames/animals-50";
console.log(animalName(1234)); // "cat"

🔗 Resources


This release transforms codenames from a simple proof-of-concept into a production-ready library with comprehensive features, extensive testing, and excellent developer experience. Perfect for preview deployments, memorable identifiers, and any use case where you need deterministic, human-readable names.