Skip to content

Commit eba83ad

Browse files
authored
Merge branch 'next' into refactor/address/lat-long-return-type
2 parents 0ec99ab + 20f2236 commit eba83ad

File tree

648 files changed

+1662
-3019
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

648 files changed

+1662
-3019
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
uses: actions/checkout@v3
3434

3535
- name: Install pnpm
36-
uses: pnpm/[email protected].2
36+
uses: pnpm/[email protected].3
3737
with:
3838
version: 7
3939

@@ -62,7 +62,7 @@ jobs:
6262
uses: actions/checkout@v3
6363

6464
- name: Install pnpm
65-
uses: pnpm/[email protected].2
65+
uses: pnpm/[email protected].3
6666
with:
6767
version: 7
6868

@@ -90,7 +90,7 @@ jobs:
9090
fetch-depth: 0
9191

9292
- name: Install pnpm
93-
uses: pnpm/[email protected].2
93+
uses: pnpm/[email protected].3
9494
with:
9595
version: 7
9696

@@ -121,7 +121,7 @@ jobs:
121121
fetch-depth: 0
122122

123123
- name: Install pnpm
124-
uses: pnpm/[email protected].2
124+
uses: pnpm/[email protected].3
125125
with:
126126
version: 7
127127

@@ -149,7 +149,7 @@ jobs:
149149
fetch-depth: 0
150150

151151
- name: Install pnpm
152-
uses: pnpm/[email protected].2
152+
uses: pnpm/[email protected].3
153153
with:
154154
version: 7
155155

@@ -177,7 +177,7 @@ jobs:
177177
fetch-depth: 0
178178

179179
- name: Install pnpm
180-
uses: pnpm/[email protected].2
180+
uses: pnpm/[email protected].3
181181
with:
182182
version: 7
183183

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
fetch-depth: 0
2020

2121
- name: Install pnpm
22-
uses: pnpm/[email protected].2
22+
uses: pnpm/[email protected].3
2323
with:
2424
version: 7
2525

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,11 @@ This rule improves the comments readability by grouping equivalent tags and maki
321321

322322
```ts
323323
/**
324-
* This is a bad JSDoc block, because it has no linebreaks between sections.
324+
* This is a good JSDoc block, because it follows the Faker preferences.
325+
*
325326
* @param bar The first argument.
326327
* @param baz The second argument.
328+
*
327329
* @example foo(1, 1) // [1, 1]
328330
* @example foo(13, 56) // [13, 56]
329331
*/
@@ -337,11 +339,9 @@ function foo(bar: number, baz: number): [number, number] {
337339

338340
```ts
339341
/**
340-
* This is a good JSDoc block, because it follows the Faker preferences.
341-
*
342+
* This is a bad JSDoc block, because it has no linebreaks between sections.
342343
* @param bar The first argument.
343344
* @param baz The second argument.
344-
*
345345
* @example foo(1, 1) // [1, 1]
346346
* @example foo(13, 56) // [13, 56]
347347
*/

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ The API covers the following modules:
8888
| Internet | `faker.internet.domainName()` | muddy-neuropathologist.net |
8989
| Lorem | `faker.lorem.paragraph()` | Porro nulla id vero perspiciatis nulla nihil. ... |
9090
| Music | `faker.music.genre()` | R&B |
91-
| Name | `faker.name.firstName()` | Cameron |
91+
| Person | `faker.person.firstName()` | Cameron |
9292
| Phone | `faker.phone.phoneNumber()` | +1 291-299-0192 |
9393
| Random | `faker.random.locale()` | fr_CA |
9494
| Science | `faker.science.unit()` | `{ name: 'meter', symbol: 'm' }` |
@@ -103,7 +103,7 @@ Faker contains a generator method `faker.helpers.fake` for combining faker API m
103103
```ts
104104
console.log(
105105
faker.helpers.fake(
106-
'Hello {{name.prefix}} {{name.lastName}}, how are you today?'
106+
'Hello {{person.prefix}} {{person.lastName}}, how are you today?'
107107
)
108108
);
109109
```

docs/.vitepress/api-pages.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,19 @@ export const apiPages = [
1010
{ text: 'Database', link: '/api/database.html' },
1111
{ text: 'Datatype', link: '/api/datatype.html' },
1212
{ text: 'Date', link: '/api/date.html' },
13-
{ text: 'Fake', link: '/api/fake.html' },
1413
{ text: 'Finance', link: '/api/finance.html' },
1514
{ text: 'Git', link: '/api/git.html' },
1615
{ text: 'Hacker', link: '/api/hacker.html' },
1716
{ text: 'Helpers', link: '/api/helpers.html' },
1817
{ text: 'Image', link: '/api/image.html' },
1918
{ text: 'Internet', link: '/api/internet.html' },
2019
{ text: 'Lorem', link: '/api/lorem.html' },
21-
{ text: 'Mersenne', link: '/api/mersenne.html' },
2220
{ text: 'Music', link: '/api/music.html' },
23-
{ text: 'Name', link: '/api/name.html' },
21+
{ text: 'Person', link: '/api/person.html' },
2422
{ text: 'Phone', link: '/api/phone.html' },
2523
{ text: 'Random', link: '/api/random.html' },
2624
{ text: 'Science', link: '/api/science.html' },
2725
{ text: 'System', link: '/api/system.html' },
28-
{ text: 'Unique', link: '/api/unique.html' },
2926
{ text: 'Vehicle', link: '/api/vehicle.html' },
3027
{ text: 'Word', link: '/api/word.html' },
3128
];

docs/guide/localization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ All locales together are around 5 MB in size.
5252
| en_GB | English (Great Britain) |
5353
| en_GH | English (Ghana) |
5454
| en_IE | English (Ireland) |
55-
| en_IND | English (India) |
55+
| en_IN | English (India) |
5656
| en_NG | Nigeria (English) |
5757
| en_US | English (United States) |
5858
| en_ZA | English (South Africa) |

docs/guide/usage.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Using Faker is as easy as importing it from `@faker-js/faker`.
77
```js
88
import { faker } from '@faker-js/faker';
99

10-
const randomName = faker.name.fullName(); // Rowan Nikolaus
10+
const randomName = faker.person.fullName(); // Rowan Nikolaus
1111
const randomEmail = faker.internet.email(); // [email protected]
1212
```
1313

@@ -16,7 +16,7 @@ Or if you using CommonJS
1616
```js
1717
const { faker } = require('@faker-js/faker');
1818

19-
const randomName = faker.name.fullName(); // Rowan Nikolaus
19+
const randomName = faker.person.fullName(); // Rowan Nikolaus
2020
const randomEmail = faker.internet.email(); // [email protected]
2121
```
2222

@@ -27,7 +27,7 @@ const randomEmail = faker.internet.email(); // [email protected]
2727
import { faker } from 'https://cdn.skypack.dev/@faker-js/faker';
2828
2929
// Caitlyn Kerluke
30-
const randomName = faker.name.fullName();
30+
const randomName = faker.person.fullName();
3131
3232
3333
const randomEmail = faker.internet.email();
@@ -43,7 +43,7 @@ Using the browser is great for experimenting 👍. However, due to all of the st
4343
```js
4444
import { faker } from 'https://cdn.skypack.dev/@faker-js/faker';
4545

46-
const randomName = faker.name.findName(); // Willie Bahringer
46+
const randomName = faker.person.findName(); // Willie Bahringer
4747
const randomEmail = faker.internet.email(); // [email protected]
4848
```
4949

@@ -120,9 +120,9 @@ function createRandomUser(): User {
120120
avatar: faker.image.avatar(),
121121
birthday: faker.date.birthdate(),
122122
email: faker.internet.email(),
123-
firstName: faker.name.firstName(),
124-
lastName: faker.name.lastName(),
125-
sex: faker.name.sexType(),
123+
firstName: faker.person.firstName(),
124+
lastName: faker.person.lastName(),
125+
sex: faker.person.sexType(),
126126
subscriptionTier: faker.helpers.arrayElement(['free', 'basic', 'business']),
127127
};
128128
}
@@ -142,9 +142,9 @@ Let's refactor our current code:
142142
import { faker } from '@faker-js/faker';
143143

144144
function createRandomUser(): User {
145-
const sex = this.faker.name.sexType();
146-
const firstName = faker.name.firstName(sex);
147-
const lastName = faker.name.lastName();
145+
const sex = this.faker.person.sexType();
146+
const firstName = faker.person.firstName(sex);
147+
const lastName = faker.person.lastName();
148148
const email = faker.internet.email(firstName, lastName);
149149

150150
return {
@@ -179,9 +179,9 @@ Faker has your back, with another helper method:
179179
import { faker } from '@faker-js/faker';
180180

181181
function createRandomUser(): User {
182-
const sex = this.faker.name.sexType();
183-
const firstName = faker.name.firstName(sex);
184-
const lastName = faker.name.lastName();
182+
const sex = this.faker.person.sexType();
183+
const firstName = faker.person.firstName(sex);
184+
const lastName = faker.person.lastName();
185185
const email = faker.helpers.unique(faker.internet.email, [
186186
firstName,
187187
lastName,

scripts/apidoc.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
writeApiPagesIndex,
44
writeApiSearchIndex,
55
} from './apidoc/apiDocsWriter';
6-
import { processDirectMethods } from './apidoc/directMethods';
76
import { processModuleMethods } from './apidoc/moduleMethods';
87
import { initMarkdownRenderer } from './apidoc/signature';
98
import type { PageIndex } from './apidoc/utils';
@@ -35,7 +34,6 @@ async function build(): Promise<void> {
3534

3635
const modulesPages: PageIndex = [];
3736
modulesPages.push(...processModuleMethods(project));
38-
modulesPages.push(...processDirectMethods(project));
3937
writeApiPagesIndex(modulesPages);
4038

4139
writeApiSearchIndex(project);

scripts/apidoc/apiDocsWriter.ts

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type { ProjectReflection } from 'typedoc';
44
import { ReflectionKind } from 'typedoc';
55
import type { Method } from '../../docs/.vitepress/components/api-docs/method';
66
import type { APIGroup, APIItem } from '../../docs/api/api-types';
7-
import { selectDirectMethods } from './directMethods';
87
import { extractModuleName, selectApiModules } from './moduleMethods';
98
import type { PageIndex } from './utils';
109
import {
@@ -78,37 +77,6 @@ export function writeApiDocsModulePage(
7877
writeFileSync(resolve(pathOutputDir, `${lowerModuleName}.md`), content);
7978
}
8079

81-
/**
82-
* Writes the api page for the given method to the correct location.
83-
*
84-
* @param methodName The name of the method to write the docs for.
85-
* @param capitalizedMethodName The capitalized name of the method.
86-
*/
87-
export function writeApiDocsDirectPage(
88-
methodName: string,
89-
capitalizedMethodName: string
90-
): void {
91-
let content = `
92-
<script setup>
93-
import ApiDocsMethod from '../.vitepress/components/api-docs/method.vue';
94-
import ${methodName} from './${methodName}.json';
95-
</script>
96-
97-
<!-- This file is automatically generated. -->
98-
<!-- Run '${scriptCommand}' to update -->
99-
100-
# ${capitalizedMethodName}
101-
102-
## ${methodName}
103-
104-
<ApiDocsMethod :method="${methodName}.${methodName}" v-once />
105-
`.replace(/\n +/g, '\n');
106-
107-
content = vitePressInFileOptions + formatMarkdown(content);
108-
109-
writeFileSync(resolve(pathOutputDir, `${methodName}.md`), content);
110-
}
111-
11280
/**
11381
* Writes the api docs data to correct location.
11482
*
@@ -164,9 +132,8 @@ export function writeApiSearchIndex(project: ProjectReflection): void {
164132
apiIndex.push(moduleApiSection);
165133

166134
const apiModules = selectApiModules(project);
167-
const directMethods = selectDirectMethods(project);
168135

169-
moduleApiSection.items = [...apiModules, ...directMethods]
136+
moduleApiSection.items = apiModules
170137
.map((module) => {
171138
const moduleName = extractModuleName(module);
172139
const apiSection: APIItem = {

scripts/apidoc/directMethods.ts

Lines changed: 0 additions & 68 deletions
This file was deleted.

scripts/apidoc/moduleMethods.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ export function selectApiModules(
1717
): DeclarationReflection[] {
1818
return project
1919
.getChildrenByKind(ReflectionKind.Class)
20-
.filter((module) => faker[extractModuleFieldName(module)] != null)
21-
.filter(
22-
(module) => module.name !== 'FakeModule' && module.name !== 'UniqueModule'
23-
);
20+
.filter((module) => faker[extractModuleFieldName(module)] != null);
2421
}
2522

2623
/**
@@ -41,7 +38,13 @@ export function processModuleMethods(project: ProjectReflection): PageIndex {
4138
}
4239

4340
export function extractModuleName(module: DeclarationReflection): string {
44-
return module.name.replace(/Module$/, '');
41+
const { name } = module;
42+
// TODO @ST-DDT 2022-10-16: Remove in v10.
43+
// Typedoc prefers the name of the module that is exported first.
44+
if (name === 'NameModule') {
45+
return 'Person';
46+
}
47+
return name.replace(/Module$/, '');
4548
}
4649

4750
function extractModuleFieldName(module: DeclarationReflection): string {

scripts/generateLocales.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const definitionsTypes: DefinitionsType = {
5757
internet: 'InternetDefinitions',
5858
lorem: 'LoremDefinitions',
5959
music: 'MusicDefinitions',
60-
name: 'NameDefinitions',
60+
person: 'PersonDefinitions',
6161
phone_number: 'PhoneNumberDefinitions',
6262
science: 'ScienceDefinitions',
6363
system: 'SystemDefinitions',

0 commit comments

Comments
 (0)