66<!-- [![npm downloads][npm-downloads-src]][npm-downloads-href] -->
77<!-- [![Codecov][codecov-src]][codecov-href] -->
88
9- # bun-ts-starter
9+ # nanofaker
1010
11- This is an opinionated TypeScript Starter kit to help kick-start development of your next Bun package .
11+ A performance-focused and lightweight faker library for TypeScript with comprehensive locale support .
1212
1313## Features
1414
15- This Starter Kit comes pre-configured with the following:
15+ - ⚡️ ** Performance-focused** - Built with speed and efficiency in mind
16+ - 🌍 ** Multi-locale Support** - Complete translations for 9 languages:
17+ - English (en)
18+ - Spanish (es)
19+ - French (fr)
20+ - German (de)
21+ - Italian (it)
22+ - Portuguese (pt)
23+ - Japanese (ja)
24+ - Filipino (tl)
25+ - Chinese (zh)
26+ - 📦 ** Lightweight** - Minimal dependencies and small bundle size
27+ - 💪 ** Fully Typed** - Written in TypeScript with comprehensive type definitions
28+ - 🎯 ** Comprehensive Data** - 16+ data categories including:
29+ - Person (names, job titles, genders)
30+ - Address (streets, cities, countries)
31+ - Company (names, industries, buzzwords)
32+ - Internet (emails, domains)
33+ - Phone numbers
34+ - Food (dishes, ingredients, cuisines)
35+ - Animals (dogs, cats, birds, fish, etc.)
36+ - Sports (teams, athletes)
37+ - Music (genres, artists, songs)
38+ - Commerce (products, colors, materials)
39+ - Books (titles, authors, publishers)
40+ - Vehicles (manufacturers, models, types)
41+ - Words (adjectives, verbs, nouns, etc.)
42+ - Hacker/Tech (abbreviations, phrases)
43+ - System (file names, file types)
44+ - Science (elements, units, constants)
45+
46+ ## Installation
1647
17- - 🛠️ [ Powerful Build Process] ( https://github.com/oven-sh/bun ) - via Bun
18- - 💪🏽 [ Fully Typed APIs] ( https://www.typescriptlang.org/ ) - via TypeScript
19- - 📚 [ Documentation-ready] ( https://vitepress.dev/ ) - via VitePress
20- - ⌘ [ CLI & Binary] ( https://www.npmjs.com/package/bunx ) - via Bun & CAC
21- - 🧪 [ Built With Testing In Mind] ( https://bun.sh/docs/cli/test ) - pre-configured unit-testing powered by [ Bun] ( https://bun.sh/docs/cli/test )
22- - 🤖 [ Renovate] ( https://renovatebot.com/ ) - optimized & automated PR dependency updates
23- - 🎨 [ ESLint] ( https://eslint.org/ ) - for code linting _ (and formatting)_
24- - 📦️ [ pkg.pr.new] ( https://pkg.pr.new ) - Continuous (Preview) Releases for your libraries
25- - 🐙 [ GitHub Actions] ( https://github.com/features/actions ) - runs your CI _ (fixes code style issues, tags releases & creates its changelogs, runs the test suite, etc.)_
48+ ``` bash
49+ # npm
50+ npm install nanofaker
2651
27- ## Get Started
52+ # pnpm
53+ pnpm add nanofaker
2854
29- It's rather simple to get your package development started:
55+ # bun
56+ bun add nanofaker
3057
31- ``` bash
32- # you may use this GitHub template or the following command:
33- bunx degit stacksjs/ts-starter my-pkg
34- cd my-pkg
58+ # yarn
59+ yarn add nanofaker
60+ ```
3561
36- bun i # install all deps
37- bun run build # builds the library for production-ready use
62+ ## Usage
3863
39- # after you have successfully committed, you may create a "release"
40- bun run release # automates git commits, versioning, and changelog generations
64+ ``` typescript
65+ import { faker } from ' nanofaker'
66+
67+ // Generate random data with default locale (English)
68+ const name = faker .person .fullName ()
69+ const email = faker .internet .email ()
70+ const address = faker .address .city ()
71+
72+ console .log (name ) // "John Doe"
73+ console .log (email ) // "john.doe@example.com"
74+ console .log (address ) // "New York"
4175```
4276
43- _ Check out the package.json scripts for more commands._
77+ ### Using Different Locales
78+
79+ ``` typescript
80+ import { faker } from ' nanofaker'
81+
82+ // Set locale globally
83+ faker .locale = ' es' // Spanish
84+ console .log (faker .person .fullName ()) // "María García"
85+
86+ // Or use a specific locale instance
87+ import { es , ja , zh } from ' nanofaker/locales'
88+
89+ const spanishFaker = faker .locale (' es' )
90+ const japaneseFaker = faker .locale (' ja' )
91+ const chineseFaker = faker .locale (' zh' )
92+
93+ console .log (spanishFaker .person .fullName ()) // "Carlos López"
94+ console .log (japaneseFaker .person .fullName ()) // "田中太郎"
95+ console .log (chineseFaker .person .fullName ()) // "王伟"
96+ ```
97+
98+ ### Available Locales
99+
100+ - ` en ` - English
101+ - ` es ` - Spanish
102+ - ` fr ` - French
103+ - ` de ` - German
104+ - ` it ` - Italian
105+ - ` pt ` - Portuguese
106+ - ` ja ` - Japanese
107+ - ` tl ` - Filipino
108+ - ` zh ` - Chinese
109+
110+ ### API Examples
111+
112+ ``` typescript
113+ import { faker } from ' nanofaker'
114+
115+ // Person
116+ faker .person .firstName () // Random first name
117+ faker .person .lastName () // Random last name
118+ faker .person .fullName () // Random full name
119+ faker .person .gender () // Random gender
120+ faker .person .jobTitle () // Random job title
121+ faker .person .prefix () // Random prefix (Mr., Mrs., etc.)
122+ faker .person .suffix () // Random suffix (Jr., Sr., etc.)
123+
124+ // Address
125+ faker .address .street () // Random street name
126+ faker .address .city () // Random city
127+ faker .address .state () // Random state/province
128+ faker .address .country () // Random country
129+ faker .address .zipCode () // Random ZIP/postal code
130+ faker .address .direction () // Random direction (North, South, etc.)
131+
132+ // Company
133+ faker .company .name () // Random company name
134+ faker .company .industry () // Random industry
135+ faker .company .buzzword () // Random business buzzword
136+
137+ // Internet
138+ faker .internet .email () // Random email address
139+ faker .internet .domainName () // Random domain name
140+ faker .internet .url () // Random URL
141+
142+ // Phone
143+ faker .phone .number () // Random phone number
144+
145+ // And many more...
146+ ```
44147
45148## Testing
46149
47150``` bash
48151bun test
49152```
50153
154+ ## Development
155+
156+ ``` bash
157+ # Install dependencies
158+ bun install
159+
160+ # Run tests
161+ bun test
162+
163+ # Build the library
164+ bun run build
165+
166+ # Lint code
167+ bun run lint
168+ ```
169+
51170## Changelog
52171
53- Please see our [ releases] ( https://github.com/stackjs/bun-ts-starter /releases ) page for more information on what has changed recently.
172+ Please see our [ releases] ( https://github.com/stacksjs/nanofaker /releases ) page for more information on what has changed recently.
54173
55174## Contributing
56175
57- Please see [ CONTRIBUTING] ( .github/CONTRIBUTING.md ) for details.
176+ We welcome contributions! Please see [ CONTRIBUTING] ( .github/CONTRIBUTING.md ) for details.
58177
59178## Community
60179
61180For help, discussion about best practices, or any other conversation that would benefit from being searchable:
62181
63- [ Discussions on GitHub] ( https://github.com/stacksjs/ts-starter /discussions )
182+ [ Discussions on GitHub] ( https://github.com/stacksjs/nanofaker /discussions )
64183
65184For casual chit-chat with others using this package:
66185
@@ -86,10 +205,10 @@ The MIT License (MIT). Please see [LICENSE](LICENSE.md) for more information.
86205Made with 💙
87206
88207<!-- Badges -->
89- [ npm-version-src ] : https://img.shields.io/npm/v/bun-ts-starter ?style=flat-square
90- [ npm-version-href ] : https://npmjs.com/package/bun-ts-starter
91- [ github-actions-src ] : https://img.shields.io/github/actions/workflow/status/stacksjs/ts-starter /ci.yml?style=flat-square&branch=main
92- [ github-actions-href ] : https://github.com/stacksjs/ts-starter /actions?query=workflow%3Aci
208+ [ npm-version-src ] : https://img.shields.io/npm/v/nanofaker ?style=flat-square
209+ [ npm-version-href ] : https://npmjs.com/package/nanofaker
210+ [ github-actions-src ] : https://img.shields.io/github/actions/workflow/status/stacksjs/nanofaker /ci.yml?style=flat-square&branch=main
211+ [ github-actions-href ] : https://github.com/stacksjs/nanofaker /actions?query=workflow%3Aci
93212
94- <!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/ts-starter /main?style=flat-square
95- [codecov-href]: https://codecov.io/gh/stacksjs/ts-starter -->
213+ <!-- [codecov-src]: https://img.shields.io/codecov/c/gh/stacksjs/nanofaker /main?style=flat-square
214+ [codecov-href]: https://codecov.io/gh/stacksjs/nanofaker -->
0 commit comments