Skip to content

Commit d691a22

Browse files
authored
Merge branch 'next' into chore/clarify-context-parameter-for-month-and-weekday
2 parents 140531d + 6e1009a commit d691a22

28 files changed

+1002
-433
lines changed

docs/.vitepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const config = defineConfig({
181181
link: '/guide/localization',
182182
},
183183
{
184-
text: 'Upgrading to v7',
184+
text: 'Upgrading to v8',
185185
link: '/guide/upgrading',
186186
},
187187
],

docs/guide/upgrading.md

Lines changed: 81 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,89 @@
1-
# Upgrading to v7
1+
# Upgrading to v8
22

3-
This is the migration guide for upgrading from v6 to v7.
3+
This is the migration guide for upgrading from v7 to v8.
4+
5+
Since v8 has not yet been released, this is a work in progress list of any major and breaking changes in v8.
46

57
::: info
68
Not the version you are looking for?
79

8-
- [v6.fakerjs.dev](https://v6.fakerjs.dev/migration-guide-v5/)
10+
- [Upgrading to v7](https://v7.fakerjs.dev/guide/upgrading.html)
11+
- [Upgrading to v6](https://v6.fakerjs.dev/migration-guide-v5/)
912

1013
:::
1114

12-
## Node 12 no longer supported
13-
14-
You need at least Node 14 to use Faker.
15-
16-
## Default export removed
17-
18-
If you were previously importing faker like this:
19-
20-
```js
21-
import faker from '@faker-js/faker';
22-
```
23-
24-
You must instead use:
25-
26-
```js
27-
import { faker } from '@faker-js/faker';
28-
```
29-
30-
## Deprecated methods changed
31-
32-
Several methods were renamed or moved:
33-
34-
| Old method | New alternative |
35-
| -------------------------- | ------------------------------------------------------ |
36-
| faker.random.number | faker.datatype.number |
37-
| faker.random.float | faker.datatype.float |
38-
| faker.random.arrayElement | faker.helpers.arrayElement |
39-
| faker.random.arrayElements | faker.helpers.arrayElements |
40-
| faker.random.objectElement | faker.helpers.objectKey <br> faker.helpers.objectValue |
41-
| faker.random.uuid | faker.datatype.uuid |
42-
| faker.random.boolean | faker.datatype.boolean |
43-
| faker.random.image | faker.image.image |
44-
| faker.random.hexaDecimal | faker.datatype.hexadecimal |
45-
| faker.helpers.randomize | faker.helpers.arrayElement |
46-
| faker.datatype.hexaDecimal | faker.datatype.hexadecimal |
47-
| faker.name.title | faker.name.jobTitle |
48-
49-
## Deprecated methods removed
50-
51-
Some methods were removed without a direct alternative. If you are using any of these methods you should build an object containing the specific properties you need.
52-
53-
| Removed method |
54-
| ------------------------------- |
55-
| faker.helpers.createCard |
56-
| faker.helpers.contextualCard |
57-
| faker.helpers.userCard |
58-
| faker.time |
59-
| faker.helpers.createTransaction |
15+
## `faker.mersenne` and `faker.helpers.repeatString` removed
16+
17+
`faker.mersenne` and `faker.helpers.repeatString` were only ever intended for internal use, and are no longer available.
18+
19+
## Other deprecated methods replaced
20+
21+
| Old method | New method |
22+
| ------------------------------- | ----------------------------------------------------------------- |
23+
| `faker.unique` | `faker.helpers.unique` |
24+
| `faker.fake` | `faker.helpers.fake` |
25+
| `faker.commerce.color` | `faker.color.human` |
26+
| `faker.company.companyName` | `faker.company.name` |
27+
| `faker.phone.phoneNumber` | `faker.phone.number` |
28+
| `faker.phone.phoneNumberFormat` | No direct replacement, see documentation for `faker.phone.number` |
29+
| `faker.phone.phoneFormats` | No direct replacement, see documentation for `faker.phone.number` |
30+
31+
## `faker.name` changed to `faker.person`
32+
33+
The whole `faker.name` module is now located at `faker.person`, as it contains more information than just names.
34+
The `faker.name.*` methods will continue to work as an alias in v8 and v9, but it is recommended to change to `faker.person.*`
35+
36+
| Old method | New method |
37+
| -------------------------- | ----------------------------------------------- |
38+
| `faker.name.firstName` | `faker.person.firstName` |
39+
| `faker.name.lastName` | `faker.person.lastName` |
40+
| `faker.name.middleName` | `faker.person.middleName` |
41+
| `faker.name.fullName` | `faker.person.fullName` |
42+
| `faker.name.gender` | `faker.person.gender` |
43+
| `faker.name.sex` | `faker.person.sex` |
44+
| `faker.name.sexType` | `faker.person.sexType` |
45+
| `faker.name.prefix` | `faker.person.prefix` |
46+
| `faker.name.suffix` | `faker.person.suffix` |
47+
| `faker.name.jobTitle` | `faker.person.jobTitle` |
48+
| `faker.name.jobDescriptor` | `faker.person.jobDescriptor` |
49+
| `faker.name.jobArea` | `faker.person.jobArea` |
50+
| `faker.name.jobType` | `faker.person.jobType` |
51+
| `faker.name.findName` | _Removed, replace with `faker.person.fullName`_ |
52+
53+
## `faker.address` changed to `faker.location`
54+
55+
The whole `faker.address` module is now located at `faker.location`, as it contains more information than just addresses.
56+
The `faker.address.*` methods will continue to work as an alias in v8 and v9, but it is recommended to change to `faker.location.*`
57+
58+
| Old method | New method |
59+
| ----------------------------------- | ------------------------------------ |
60+
| `faker.address.buildingNumber` | `faker.location.buildingNumber` |
61+
| `faker.address.cardinalDirection` | `faker.location.cardinalDirection` |
62+
| `faker.address.city` | `faker.location.city` |
63+
| `faker.address.cityName` | `faker.location.cityName` |
64+
| `faker.address.country` | `faker.location.country` |
65+
| `faker.address.countryCode` | `faker.location.countryCode` |
66+
| `faker.address.county` | `faker.location.county` |
67+
| `faker.address.direction` | `faker.location.direction` |
68+
| `faker.address.faker` | `faker.location.faker` |
69+
| `faker.address.latitude` | `faker.location.latitude` |
70+
| `faker.address.longitude` | `faker.location.longitude` |
71+
| `faker.address.nearbyGPSCoordinate` | `faker.location.nearbyGPSCoordinate` |
72+
| `faker.address.ordinalDirection` | `faker.location.ordinalDirection` |
73+
| `faker.address.secondaryAddress` | `faker.location.secondaryAddress` |
74+
| `faker.address.state` | `faker.location.state` |
75+
| `faker.address.stateAbbr` | `faker.location.stateAbbr` |
76+
| `faker.address.street` | `faker.location.street` |
77+
| `faker.address.streetAddress` | `faker.location.streetAddress` |
78+
| `faker.address.streetName` | `faker.location.streetName` |
79+
| `faker.address.timeZone` | `faker.location.timeZone` |
80+
| `faker.address.zipCode` | `faker.location.zipCode` |
81+
| `faker.address.zipCodeByState` | `faker.location.zipCodeByState` |
82+
| `faker.address.cityPrefix` | _Removed_ |
83+
| `faker.address.citySuffix` | _Removed_ |
84+
| `faker.address.streetPrefix` | _Removed_ |
85+
| `faker.address.streetSuffix` | _Removed_ |
86+
87+
## Locale renamed
88+
89+
The `en_IND` (English, India) locale was renamed to `en_IN` for consistency with other locales.

docs/guide/usage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ import type { SexType } from '@faker-js/faker';
9191

9292
type SubscriptionTier = 'free' | 'basic' | 'business';
9393

94-
class User {
94+
interface User {
9595
_id: string;
9696
avatar: string;
9797
birthday: Date;
@@ -112,7 +112,7 @@ Let's create our first user factory function:
112112
```ts
113113
import { faker } from '@faker-js/faker';
114114

115-
class User { ... }
115+
interface User { ... }
116116

117117
function createRandomUser(): User {
118118
return {

package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,16 @@
103103
"@types/sanitize-html": "~2.6.2",
104104
"@types/semver": "~7.3.13",
105105
"@types/validator": "~13.7.10",
106-
"@typescript-eslint/eslint-plugin": "~5.42.1",
107-
"@typescript-eslint/parser": "~5.42.1",
108-
"@vitest/coverage-c8": "~0.25.1",
109-
"@vitest/ui": "~0.25.1",
106+
"@typescript-eslint/eslint-plugin": "~5.43.0",
107+
"@typescript-eslint/parser": "~5.43.0",
108+
"@vitest/coverage-c8": "~0.25.2",
109+
"@vitest/ui": "~0.25.2",
110110
"@vueuse/core": "~9.5.0",
111111
"c8": "~7.12.0",
112112
"conventional-changelog-cli": "~2.2.2",
113-
"cypress": "~11.0.1",
114-
"esbuild": "~0.15.13",
115-
"eslint": "~8.27.0",
113+
"cypress": "~11.1.0",
114+
"esbuild": "~0.15.15",
115+
"eslint": "~8.28.0",
116116
"eslint-config-prettier": "~8.5.0",
117117
"eslint-define-config": "~1.12.0",
118118
"eslint-gitignore": "~0.1.0",
@@ -135,14 +135,14 @@
135135
"tsx": "~3.12.1",
136136
"typedoc": "~0.23.21",
137137
"typedoc-plugin-missing-exports": "~1.0.0",
138-
"typescript": "~4.8.4",
138+
"typescript": "~4.9.3",
139139
"validator": "~13.7.0",
140-
"vite": "~3.2.3",
141-
"vitepress": "1.0.0-alpha.28",
142-
"vitest": "~0.25.1",
140+
"vite": "~3.2.4",
141+
"vitepress": "1.0.0-alpha.29",
142+
"vitest": "~0.25.2",
143143
"vue": "~3.2.45"
144144
},
145-
"packageManager": "pnpm@7.15.0",
145+
"packageManager": "pnpm@7.17.0",
146146
"engines": {
147147
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",
148148
"npm": ">=6.14.13"

0 commit comments

Comments
 (0)