create-whenny
v1.0.8
Published
CLI for adding Whenny date utilities to your project
Downloads
911
Maintainers
Readme
create-whenny
CLI for installing Whenny using the shadcn-style approach. Copy code directly into your project for full ownership and customization.
Usage
Initialize
Set up Whenny in your project:
npx create-whenny initThis creates:
src/lib/whenny/directorywhenny.config.tsconfiguration file- Core utilities and types
Add Modules
Add specific modules to your project:
npx create-whenny add relative
npx create-whenny add smart calendar duration
npx create-whenny add allAvailable modules:
relative- Relative time formatting ("5 minutes ago")smart- Context-aware formattingcompare- Date comparison utilitiesduration- Duration formattingcalendar- Calendar helperstransfer- Server/browser timezone transfernatural- Natural language parsing
List Modules
See all available modules:
npx create-whenny listCheck for Updates
See what's changed between your local code and the latest version:
npx create-whenny diffWhy Copy Code?
The shadcn approach has several benefits:
- Full Ownership - The code is yours to modify
- AI Friendly - Your AI assistant can read and edit the code
- No Lock-in - Remove or replace any part freely
- Customizable - Adapt to your exact needs
- Visible - See exactly how dates are formatted
Project Structure
After running init and add all:
src/
└── lib/
└── whenny/
├── index.ts # Main exports
├── config.ts # Configuration
├── types.ts # TypeScript types
├── core/
│ ├── utils.ts # Core utilities
│ └── formatter.ts
├── relative.ts # Relative time
├── smart.ts # Smart formatting
├── compare.ts # Comparison
├── duration.ts # Duration
├── calendar.ts # Calendar helpers
├── transfer.ts # Transfer protocol
└── natural.ts # Natural languageConfiguration
The CLI creates a whenny.config.ts that you can customize:
import { defineConfig } from './src/lib/whenny/config'
export default defineConfig({
locale: 'en-US',
relative: {
justNow: 'just now',
minutesAgo: (n) => `${n} min ago`,
},
// ... more options
})License
MIT
