Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This is a shorthand for running the following scripts in order:
- `pnpm run build:clean` - removes artifacts from previous builds
- `pnpm run build:code` - builds the code, both CommonJS and ESM versions
- `pnpm run build:types` - builds the TypeScript type definitions
- `pnpm run test:update-snapshots ` - runs all tests, and updates any snapshots if needed
- `pnpm run test:update-snapshots` - runs all tests, and updates any snapshots if needed
Comment thread
ST-DDT marked this conversation as resolved.
- `pnpm run ts-check` - checks that there are no TypeScript errors in any files

## Good to know
Expand Down
1 change: 1 addition & 0 deletions docs/.vitepress/api-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const apiPages = [
items: [
{ text: 'Airline', link: '/api/airline.html' },
{ text: 'Animal', link: '/api/animal.html' },
{ text: 'Book', link: '/api/book.html' },
{ text: 'Color', link: '/api/color.html' },
{ text: 'Commerce', link: '/api/commerce.html' },
{ text: 'Company', link: '/api/company.html' },
Expand Down
1 change: 1 addition & 0 deletions scripts/generate-locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type DefinitionType = {
const definitionsTypes: DefinitionType = {
airline: 'AirlineDefinition',
animal: 'AnimalDefinition',
book: 'BookDefinition',
color: 'ColorDefinition',
commerce: 'CommerceDefinition',
company: 'CompanyDefinition',
Expand Down
13 changes: 13 additions & 0 deletions src/definitions/book.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { LocaleEntry } from './definitions';

/**
* The possible definitions related to books.
*/
export type BookDefinition = LocaleEntry<{
author: string[];
format: string[];
genre: string[];
series: string[];
title: string[];
publisher: string[];
Comment thread
ST-DDT marked this conversation as resolved.
}>;
2 changes: 2 additions & 0 deletions src/definitions/definitions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { AirlineDefinition } from './airline';
import type { AnimalDefinition } from './animal';
import type { BookDefinition } from './book';
import type { ColorDefinition } from './color';
import type { CommerceDefinition } from './commerce';
import type { CompanyDefinition } from './company';
Expand Down Expand Up @@ -34,6 +35,7 @@ export type LocaleDefinition = {
metadata?: MetadataDefinition;
airline?: AirlineDefinition;
animal?: AnimalDefinition;
book?: BookDefinition;
color?: ColorDefinition;
commerce?: CommerceDefinition;
company?: CompanyDefinition;
Expand Down
1 change: 1 addition & 0 deletions src/definitions/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export type { AirlineDefinition } from './airline';
export type { AnimalDefinition } from './animal';
export type { BookDefinition } from './book';
export type { ColorDefinition } from './color';
export type {
CommerceDefinition,
Expand Down
2 changes: 2 additions & 0 deletions src/faker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { LocaleProxy } from './locale-proxy';
import { createLocaleProxy } from './locale-proxy';
import { AirlineModule } from './modules/airline';
import { AnimalModule } from './modules/animal';
import { BookModule } from './modules/book';
import { ColorModule } from './modules/color';
import { CommerceModule } from './modules/commerce';
import { CompanyModule } from './modules/company';
Expand Down Expand Up @@ -63,6 +64,7 @@ export class Faker extends SimpleFaker {

readonly airline: AirlineModule = new AirlineModule(this);
readonly animal: AnimalModule = new AnimalModule(this);
readonly book: BookModule = new BookModule(this);
readonly color: ColorModule = new ColorModule(this);
readonly commerce: CommerceModule = new CommerceModule(this);
readonly company: CompanyModule = new CompanyModule(this);
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export type {
AirlineDefinition,
AnimalDefinition,
BookDefinition,
ColorDefinition,
CommerceDefinition,
CommerceProductNameDefinition,
Expand Down Expand Up @@ -39,6 +40,7 @@ export * from './locales';
export { Aircraft } from './modules/airline';
export type { AircraftType, AirlineModule } from './modules/airline';
export type { AnimalModule } from './modules/animal';
export type { BookModule } from './modules/book';
export { CssFunction, CssSpace } from './modules/color';
export type {
Casing,
Expand Down
102 changes: 102 additions & 0 deletions src/locales/en/book/author.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
export default [
'Adams, Clifford R. (Clifford Rose)',
'Alcott, Louisa May',
'Austen, Jane',
'Balzac, Honoré de',
'Barrie, J. M. (James Matthew)',
'Baum, L. Frank (Lyman Frank)',
Comment thread
matthewmayer marked this conversation as resolved.
Outdated
'Bhide, Shivaram Parashuram',
'Brock, C. E. (Charles Edmund)',
'Brontë, Charlotte',
'Buckley, Theodore Alois',
'Burnett, Frances Hodgson',
'Burroughs, Edgar Rice',
'Burton, Richard Francis, Sir',
'Butler, Samuel',
'Carroll, Lewis',
'Cervantes Saavedra, Miguel de',
'Chambers, Robert W. (Robert William)',
'Chekhov, Anton Pavlovich',
'Chesterton, G. K. (Gilbert Keith)',
'Christie, Agatha',
'Conrad, Joseph',
'Dante Alighieri',
'Defoe, Daniel',
'Derbyshire, Charles E.',
'Dickens, Charles',
'Doré, Gustave',
'Dostoyevsky, Fyodor',
'Doyle, Arthur Conan',
'Dumas, Alexandre',
'Eliot, George',
'Eliot, T. S. (Thomas Stearns)',
'Fielding, Henry',
'Fitzgerald, F. Scott (Francis Scott)',
'Forster, E. M. (Edward Morgan)',
'Garnett, Constance',
'Gaskell, Elizabeth Cleghorn',
'Gilman, Charlotte Perkins',
'Goethe, Johann Wolfgang von',
'Grimm, Jacob',
'Grimm, Wilhelm',
'Hapgood, Isabel Florence',
'Hardy, Thomas',
'Hawthorne, Nathaniel',
'Homer',
'Hotten, John Camden',
'Howard, Robert E. (Robert Ervin)',
'Hugo, Victor',
'Ibsen, Henrik',
'Indrajit, Bhagavanlal',
'James, Henry',
'Jowett, Benjamin',
'Joyce, James',
'Kafka, Franz',
'Kipling, Rudyard',
'Lang, Andrew',
'Levy, Oscar',
'London, Jack',
'Lovecraft, H. P. (Howard Phillips)',
'Machiavelli, Niccolò',
'Marriott, W. K. (William Kenaz)',
'Marx, Karl',
'Maude, Aylmer',
'Maude, Louise',
'Maupassant, Guy de',
'Melville, Herman',
'Merrill, Frank T.',
'Milne, A. A. (Alan Alexander)',
'Montgomery, L. M. (Lucy Maud)',
'Morley, Henry',
'Nietzsche, Friedrich Wilhelm',
'Ormsby, John',
'Packard, Vance',
'Plato',
'Poe, Edgar Allan',
'Pope, Alexander',
'Potter, Beatrix',
'Rizal, José',
'Russell, Bertrand',
'Schopenhauer, Arthur',
'Scott, Walter',
'Shakespeare, William',
'Shaw, Bernard',
'Shelley, Mary Wollstonecraft',
'Smollett, T. (Tobias)',
'Stevenson, Robert Louis',
'Stoker, Bram',
'Swift, Jonathan',
'Thoreau, Henry David',
'Tolstoy, Leo',
'Twain, Mark',
'Vatsyayana',
'Verne, Jules',
'Von Arnim, Elizabeth',
'Wagner, Richard',
'Ward, Grady',
'Wells, H. G. (Herbert George)',
'Widger, David',
'Wilde, Oscar',
'Wodehouse, P. G. (Pelham Grenville)',
'Wyllie, David',
];
1 change: 1 addition & 0 deletions src/locales/en/book/format.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default ['Audiobook', 'Ebook', 'Hardcover', 'Paperback'];
32 changes: 32 additions & 0 deletions src/locales/en/book/genre.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export default [
Comment thread
matthewmayer marked this conversation as resolved.
'Biography/Autobiography',
Comment thread
matthewmayer marked this conversation as resolved.
Outdated
'Classic',
'Comic/Graphic Novel',
Comment thread
matthewmayer marked this conversation as resolved.
Outdated
'Crime/Detective',
'Essay',
'Fable',
'Fairy tale',
'Fanfiction',
'Fantasy',
'Fiction in verse',
Comment thread
matthewmayer marked this conversation as resolved.
Outdated
'Fiction narrative',
Comment thread
matthewmayer marked this conversation as resolved.
Outdated
'Folklore',
'Historical fiction',
'Horror',
'Humor',
'Legend',
Comment thread
matthewmayer marked this conversation as resolved.
Outdated
'Metafiction',
'Mystery',
'Mythology',
'Mythopoeia',
Comment thread
matthewmayer marked this conversation as resolved.
Outdated
'Narrative nonfiction',
'Realistic fiction',
'Reference book',
'Science fiction',
'Short story',
'Speech',
Comment thread
matthewmayer marked this conversation as resolved.
Outdated
'Suspense/Thriller',
'Tall tale',
Comment thread
matthewmayer marked this conversation as resolved.
Outdated
'Textbook',
'Western',
];
22 changes: 22 additions & 0 deletions src/locales/en/book/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* This file is automatically generated.
* Run 'pnpm run generate:locales' to update.
*/
import type { BookDefinition } from '../../..';
import author from './author';
import format from './format';
import genre from './genre';
import publisher from './publisher';
import series from './series';
import title from './title';

const book: BookDefinition = {
author,
format,
genre,
publisher,
series,
title,
};

export default book;
Loading