Skip to content

Commit

Permalink
Merge branch 'next' into fix-birthdate-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed Nov 12, 2023
2 parents 1e8f65a + ef965da commit e700a61
Show file tree
Hide file tree
Showing 15 changed files with 430 additions and 36 deletions.
57 changes: 31 additions & 26 deletions docs/.vitepress/api-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,37 @@ export const apiPages = [
{ text: 'Overview', link: '/api/' },
{ text: 'Faker', link: '/api/faker.html' },
{ text: 'SimpleFaker', link: '/api/simpleFaker.html' },
{ text: 'Airline', link: '/api/airline.html' },
{ text: 'Animal', link: '/api/animal.html' },
{ text: 'Color', link: '/api/color.html' },
{ text: 'Commerce', link: '/api/commerce.html' },
{ text: 'Company', link: '/api/company.html' },
{ text: 'Database', link: '/api/database.html' },
{ text: 'Datatype', link: '/api/datatype.html' },
{ text: 'Date', link: '/api/date.html' },
{ text: 'Finance', link: '/api/finance.html' },
{ text: 'Git', link: '/api/git.html' },
{ text: 'Hacker', link: '/api/hacker.html' },
{ text: 'Helpers', link: '/api/helpers.html' },
{ text: 'Image', link: '/api/image.html' },
{ text: 'Internet', link: '/api/internet.html' },
{ text: 'Location', link: '/api/location.html' },
{ text: 'Lorem', link: '/api/lorem.html' },
{ text: 'Music', link: '/api/music.html' },
{ text: 'Number', link: '/api/number.html' },
{ text: 'Person', link: '/api/person.html' },
{ text: 'Phone', link: '/api/phone.html' },
{ text: 'Random', link: '/api/random.html' },
{ text: 'Science', link: '/api/science.html' },
{ text: 'String', link: '/api/string.html' },
{ text: 'System', link: '/api/system.html' },
{ text: 'Vehicle', link: '/api/vehicle.html' },
{ text: 'Word', link: '/api/word.html' },
{ text: 'Randomizer', link: '/api/randomizer.html' },
{ text: 'Utilities', link: '/api/utils.html' },
{
text: 'Modules',
items: [
{ text: 'Airline', link: '/api/airline.html' },
{ text: 'Animal', link: '/api/animal.html' },
{ text: 'Color', link: '/api/color.html' },
{ text: 'Commerce', link: '/api/commerce.html' },
{ text: 'Company', link: '/api/company.html' },
{ text: 'Database', link: '/api/database.html' },
{ text: 'Datatype', link: '/api/datatype.html' },
{ text: 'Date', link: '/api/date.html' },
{ text: 'Finance', link: '/api/finance.html' },
{ text: 'Git', link: '/api/git.html' },
{ text: 'Hacker', link: '/api/hacker.html' },
{ text: 'Helpers', link: '/api/helpers.html' },
{ text: 'Image', link: '/api/image.html' },
{ text: 'Internet', link: '/api/internet.html' },
{ text: 'Location', link: '/api/location.html' },
{ text: 'Lorem', link: '/api/lorem.html' },
{ text: 'Music', link: '/api/music.html' },
{ text: 'Number', link: '/api/number.html' },
{ text: 'Person', link: '/api/person.html' },
{ text: 'Phone', link: '/api/phone.html' },
{ text: 'Random', link: '/api/random.html' },
{ text: 'Science', link: '/api/science.html' },
{ text: 'String', link: '/api/string.html' },
{ text: 'System', link: '/api/system.html' },
{ text: 'Vehicle', link: '/api/vehicle.html' },
{ text: 'Word', link: '/api/word.html' },
],
},
];
3 changes: 2 additions & 1 deletion scripts/apidoc/faker-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ async function processClass(
comment,
examples,
deprecated,
methods
methods,
''
);
}

Expand Down
3 changes: 2 additions & 1 deletion scripts/apidoc/faker-utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ async function processUtilities(
comment,
undefined,
undefined,
methods
methods,
''
);
}
8 changes: 5 additions & 3 deletions scripts/apidoc/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ export async function generate(): Promise<void> {

const pages = [
...(await processFakerClasses(project)),
await processFakerRandomizer(project),
await processFakerUtilities(project),
...(await processModules(project)).sort((a, b) =>
a.text.localeCompare(b.text)
),
await processFakerRandomizer(project),
await processFakerUtilities(project),
];
await writeApiPagesIndex(pages.map(({ text, link }) => ({ text, link })));
await writeApiPagesIndex(
pages.map(({ text, link, category }) => ({ text, link, category }))
);
writeApiDiffIndex(
Object.fromEntries(pages.map(({ text, diff }) => [text, diff]))
);
Expand Down
3 changes: 2 additions & 1 deletion scripts/apidoc/module-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ async function processModule(
comment,
examples,
deprecated,
methods
methods,
'Modules'
);
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/apidoc/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Method } from '../../docs/.vitepress/components/api-docs/method';

// Types

export type Page = { text: string; link: string };
export type Page = { text: string; link: string; category: string };

export type ModuleSummary = Page & {
methods: Method[];
Expand Down
21 changes: 18 additions & 3 deletions scripts/apidoc/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { writeFileSync } from 'node:fs';
import { resolve } from 'node:path';
import type { ProjectReflection } from 'typedoc';
import { ReflectionKind } from 'typedoc';
import type { DefaultTheme } from 'vitepress';
import type { Method } from '../../docs/.vitepress/components/api-docs/method';
import type { APIGroup } from '../../docs/api/api-types';
import { groupBy } from '../../src/internal/group-by';
import { formatMarkdown, formatTypescript } from './format';
import { extractSourceBaseUrl } from './typedoc';
import type { DocsApiDiffIndex, ModuleSummary, Page } from './utils';
Expand Down Expand Up @@ -40,14 +42,16 @@ editLink: false
* @param examples The example code.
* @param deprecated The deprecation message.
* @param methods The methods of the module.
* @param category The category of the module.
*/
export async function writeApiDocsModule(
moduleName: string,
lowerModuleName: string,
comment: string,
examples: string | undefined,
deprecated: string | undefined,
methods: Method[]
methods: Method[],
category: string
): Promise<ModuleSummary> {
await writeApiDocsModulePage(
moduleName,
Expand All @@ -63,6 +67,7 @@ export async function writeApiDocsModule(
text: moduleName,
link: `/api/${lowerModuleName}.html`,
methods,
category,
diff: {
moduleHash: diffHash({
name: moduleName,
Expand Down Expand Up @@ -164,13 +169,23 @@ function writeApiDocsModuleData(
* @param pages The pages to write into the index.
*/
export async function writeApiPagesIndex(pages: Page[]): Promise<void> {
const pagesByCategory = groupBy(pages, (page) => page.category);
const pageTree = Object.entries(pagesByCategory).flatMap(
([category, items]): DefaultTheme.SidebarItem[] => {
const cleanedItems = items.map(({ text, link }) => ({ text, link }));
return category
? [{ text: category, items: cleanedItems }]
: cleanedItems;
}
);

// Write api-pages.ts
console.log('Updating api-pages.ts');
pages.splice(0, 0, { text: 'Overview', link: '/api/' });
pageTree.splice(0, 0, { text: 'Overview', link: '/api/' });
let apiPagesContent = `
// This file is automatically generated.
// Run '${scriptCommand}' to update
export const apiPages = ${JSON.stringify(pages)};
export const apiPages = ${JSON.stringify(pageTree)};
`.replace(/\n +/, '\n');

apiPagesContent = await formatTypescript(apiPagesContent);
Expand Down
2 changes: 2 additions & 0 deletions src/locales/fr_SN/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import type { LocaleDefinition } from '../..';
import internet from './internet';
import location from './location';
import metadata from './metadata';
import person from './person';

const fr_SN: LocaleDefinition = {
internet,
location,
metadata,
person,
};

export default fr_SN;
81 changes: 81 additions & 0 deletions src/locales/fr_SN/person/female_first_name.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
export default [
'Abibatou',
'Aby',
'Adama',
'Alima',
'Ami',
'Amie',
'Amina',
'Aminata',
'Amy',
'Anna',
'Arame',
'Asta',
'Astou',
'Atta',
'Awa',
'Aïcha',
'Aïda',
'Aïssa',
'Aïssata',
'Aïssatou',
'Banna',
'Bineta',
'Binta',
'Bintou',
'Coumba',
'Dado',
'Diarra',
'Dieynaba',
'Dior',
'Elisabeth',
'Elène',
'Fanta',
'Fatim',
'Fatima',
'Fatimata',
'Fatma',
'Fatou',
'Fatoumata',
'Fily',
'Haby',
'Hawa',
'Jeanne',
'Josephine',
'Kadiatou',
'Khadidiatou',
'Khady',
'Khoudia',
'Kiné',
'Lala',
'Madeleine',
'Maguette',
'Mariama',
'Marie',
'Marième',
'Mary',
'Marème',
'Maï',
'Maïmouna',
'Néné',
'Oumou',
'Paulette',
'Penda',
'Rama',
'Ramata',
'Ramatoulaye',
'Rokhaya',
'Rose',
'Safiatou',
'Safiétou',
'Salimata',
'Salimatou',
'Saly',
'Seynabou',
'Soda',
'Sokhna',
'Sophie',
'Thérèse',
'Yacine',
'Yaya',
];
5 changes: 5 additions & 0 deletions src/locales/fr_SN/person/first_name.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { mergeArrays } from './../../../internal/merge';
import female_first_name from './female_first_name';
import male_first_name from './male_first_name';

export default mergeArrays(female_first_name, male_first_name);
22 changes: 22 additions & 0 deletions src/locales/fr_SN/person/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 { PersonDefinition } from '../../..';
import female_first_name from './female_first_name';
import first_name from './first_name';
import last_name from './last_name';
import last_name_pattern from './last_name_pattern';
import male_first_name from './male_first_name';
import name_ from './name';

const person: PersonDefinition = {
female_first_name,
first_name,
last_name,
last_name_pattern,
male_first_name,
name: name_,
};

export default person;

0 comments on commit e700a61

Please sign in to comment.