Skip to content

Commit

Permalink
Merge branch 'next' into New
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT committed Sep 17, 2023
2 parents 4c74a46 + a7d25fa commit b25920c
Show file tree
Hide file tree
Showing 34 changed files with 1,138 additions and 2,399 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/ci.yml
Expand Up @@ -35,23 +35,23 @@ jobs:
name: 'Build & Unit Test: node-${{ matrix.node_version }}, ${{ matrix.os }}'
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
# Required for docs/versions tests
fetch-depth: 0

- name: Install pnpm (node 14, pnpm 7)
if: matrix.node_version == 14
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0
with:
version: 7

- name: Install pnpm
if: matrix.node_version != 14
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0

- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: ${{ matrix.node_version }}
cache: 'pnpm'
Expand Down Expand Up @@ -90,16 +90,16 @@ jobs:
run: date

- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
# Required for docs/versions tests
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0

- name: Set node version to ${{ matrix.node_version }}
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: ${{ matrix.node_version }}
cache: 'pnpm'
Expand All @@ -122,10 +122,10 @@ jobs:
name: 'E2E Doc Test: node-18, ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0

- name: Install pnpm
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0

- name: Install deps
run: pnpm install
Expand All @@ -143,15 +143,15 @@ jobs:
name: 'Lint: node-18, ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0

- name: Set node version to 18
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: 18
cache: 'pnpm'
Expand All @@ -173,15 +173,15 @@ jobs:
name: 'TS-Check: node-18, ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0

- name: Set node version to 18
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: 18
cache: 'pnpm'
Expand All @@ -200,15 +200,15 @@ jobs:
name: 'Codecov: node-18, ubuntu-latest'
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0

- name: Set node version to 18
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: 18
cache: 'pnpm'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Expand Up @@ -15,15 +15,15 @@ jobs:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4
uses: pnpm/action-setup@d882d12c64e032187b2edb46d3a0d003b7a43598 # v2.4.0

- name: Set node version to 18
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
node-version: 18
cache: 'pnpm'
Expand Down
6 changes: 6 additions & 0 deletions .prettierrc.js
Expand Up @@ -17,5 +17,11 @@ module.exports = {
trailingComma: 'none',
},
},
{
files: '*.md',
options: {
organizeImportsSkipDestructiveCodeActions: true,
},
},
],
};
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -123,7 +123,7 @@ we fall back to English in such a case as this is the most complete and most com
If you don't want that or prefer a different fallback, you can also build your own instances.

```ts
import { Faker, de, de_CH } from '@faker-js/faker';
import { de, de_CH, Faker } from '@faker-js/faker';

export const faker = new Faker({
locale: [de_CH, de],
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/frameworks.md
Expand Up @@ -13,8 +13,8 @@ Simply crop that line out for a Jest integration.
These frameworks work about exactly as you would expect with Faker. Here's a minimal example:

```ts
import { describe, it, expect } from 'vitest';
import { faker } from '@faker-js/faker/locale/en';
import { describe, expect, it } from 'vitest';

describe('reverse array', () => {
it('should reverse the array', () => {
Expand All @@ -36,8 +36,8 @@ These are especially useful in tests that are meant to be deterministic, such as
- [Snapshots in Jest](https://jestjs.io/docs/snapshot-testing)

```ts
import { afterEach, describe, it, expect } from 'vitest';
import { faker } from '@faker-js/faker/locale/en';
import { afterEach, describe, expect, it } from 'vitest';

// We might want other tests to *not* be seeded. This will re-seed our faker instance after each test.
afterEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/localization.md
Expand Up @@ -44,7 +44,7 @@ If our built-in faker instances don't satisfy your needs, you can build your own

```ts
import type { LocaleDefinition } from '@faker-js/faker';
import { Faker, de_CH, de, en, base } from '@faker-js/faker';
import { base, de, de_CH, en, Faker } from '@faker-js/faker';

const customLocale: LocaleDefinition = {
title: 'My custom locale',
Expand Down
22 changes: 19 additions & 3 deletions docs/guide/upgrading.md
Expand Up @@ -58,7 +58,7 @@ const b = customFaker.internet.emoji();
**New**

```ts
import { Faker, de_CH, de, en, base } from '@faker-js/faker';
import { base, de, de_CH, en, Faker } from '@faker-js/faker';

// same as fakerDE_CH
export const customFaker = new Faker({
Expand Down Expand Up @@ -110,7 +110,7 @@ This will also give you detailed information which data are missing.
If you want to check for data you can either use `entry in faker.definitions.category` or use `faker.rawDefinitions.category?.entry` instead.

```ts
import { Faker, fakerES, es } from '@faker-js/faker';
import { es, Faker, fakerES } from '@faker-js/faker';

const fakerES_noFallbacks = new Faker({
locale: [es],
Expand All @@ -125,7 +125,7 @@ fakerES_noFallbacks.music.songName(); // throws a FakerError
This also has an impact on data that aren't applicable to a locale, for example Hong Kong (`en_HK`) doesn't use ZIP codes/postcodes.

```ts
import { fakerEN_US, fakerEN_HK } from '@faker-js/faker';
import { fakerEN_HK, fakerEN_US } from '@faker-js/faker';
fakerEN_US.location.zipCode(); // 90210
fakerEN_HK.location.zipCode(); // throws a FakerError
```
Expand Down Expand Up @@ -312,6 +312,22 @@ If you need an array of useful values, you are better off creating your own one

The `datetime` method previously found in `faker.datatype` has been deprecated, use `faker.date.between` or `faker.date.anytime` instead.

### `faker.helpers.regexpStyleStringParse` deprecated in favor of `faker.helpers.fromRegExp`

The `regexpStyleStringParse` method in `faker.helpers` has been deprecated in Faker 8.1. A likely replacement is the more powerful `faker.helpers.fromRegExp`.

```js
faker.helpers.regexpStyleStringParse('a{3,6}'); // aaaaa
faker.helpers.fromRegExp('a{3,6}'); // aaaaa
```

However, please note that `faker.helpers.fromRegExp` is not an exact replacement for `faker.helpers.regexpStyleStringParse` as `fromRegExp` cannot handle numeric ranges. This will now need to be handled separately.

```js
faker.helpers.regexpStyleStringParse('a{3,6}[1-100]'); // "aaaa53", etc.
faker.helpers.fromRegExp('a{3,6}') + faker.number.int({ min: 1, max: 100 });
```

### `allowLeadingZeros` behavior change in `faker.string.numeric`

The `allowLeadingZeros` boolean parameter in `faker.string.numeric` (in the new `string` module) now defaults to `true`. `faker.string.numeric` will now generate numeric strings that could have leading zeros by default.
Expand Down
22 changes: 11 additions & 11 deletions package.json
Expand Up @@ -90,41 +90,41 @@
"@actions/github": "~5.1.1",
"@algolia/client-search": "~4.19.1",
"@types/markdown-it": "~13.0.1",
"@types/node": "~20.5.9",
"@types/node": "~20.6.0",
"@types/sanitize-html": "~2.9.0",
"@types/semver": "~7.5.1",
"@types/validator": "~13.11.1",
"@typescript-eslint/eslint-plugin": "~6.5.0",
"@typescript-eslint/parser": "~6.5.0",
"@vitest/coverage-v8": "~0.34.3",
"@vitest/ui": "~0.34.3",
"@typescript-eslint/eslint-plugin": "~6.7.0",
"@typescript-eslint/parser": "~6.7.0",
"@vitest/coverage-v8": "~0.34.4",
"@vitest/ui": "~0.34.4",
"@vueuse/core": "~10.4.1",
"conventional-changelog-cli": "~4.0.0",
"conventional-changelog-cli": "~4.1.0",
"cypress": "~13.1.0",
"esbuild": "~0.19.2",
"eslint": "~8.48.0",
"eslint": "~8.49.0",
"eslint-config-prettier": "~9.0.0",
"eslint-define-config": "~1.23.0",
"eslint-gitignore": "~0.1.0",
"eslint-plugin-deprecation": "~1.5.0",
"eslint-plugin-jsdoc": "~46.5.1",
"eslint-plugin-jsdoc": "~46.6.0",
"eslint-plugin-prettier": "~5.0.0",
"eslint-plugin-vitest": "~0.3.1",
"glob": "~10.3.4",
"npm-run-all": "~4.1.5",
"prettier": "3.0.2",
"prettier": "3.0.3",
"prettier-plugin-organize-imports": "~3.2.3",
"rimraf": "~5.0.1",
"sanitize-html": "~2.11.0",
"semver": "~7.5.4",
"standard-version": "~9.5.0",
"tsx": "~3.12.8",
"tsx": "~3.12.9",
"typedoc": "~0.24.8",
"typescript": "~4.9.5",
"validator": "~13.11.0",
"vite": "~4.4.9",
"vitepress": "1.0.0-beta.7",
"vitest": "~0.34.3",
"vitest": "~0.34.4",
"vue": "~3.3.4"
},
"packageManager": "pnpm@8.5.1",
Expand Down

0 comments on commit b25920c

Please sign in to comment.