Skip to content

Commit

Permalink
Merge branch 'next' into refactor/czech-locale
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewmayer authored Apr 4, 2023
2 parents 2aef297 + cddbb95 commit 98ce3a5
Show file tree
Hide file tree
Showing 76 changed files with 547 additions and 420 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = defineConfig({
'no-useless-escape': 'off',
'deprecation/deprecation': 'error',
eqeqeq: ['error', 'always', { null: 'ignore' }],
'no-else-return': 'error',
'prefer-template': 'error',
'@typescript-eslint/array-type': [
'error',
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/api.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('API Test', () => {

cy.request({
method: 'HEAD',
url: `/api/${link}`,
url: link,
failOnStatusCode: false,
})
.should(({ status }) => {
Expand Down
2 changes: 2 additions & 0 deletions docs/.vitepress/api-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Run 'pnpm run generate:api-docs' to update
export const apiPages = [
{ text: 'Overview', link: '/api/' },
{ text: 'Faker', link: '/api/faker.html' },
{ text: 'Airline', link: '/api/airline.html' },
{ text: 'Animal', link: '/api/animal.html' },
{ text: 'Color', link: '/api/color.html' },
Expand All @@ -28,4 +29,5 @@ export const apiPages = [
{ text: 'System', link: '/api/system.html' },
{ text: 'Vehicle', link: '/api/vehicle.html' },
{ text: 'Word', link: '/api/word.html' },
{ text: 'Utilities', link: '/api/utils.html' },
];
1 change: 0 additions & 1 deletion docs/.vitepress/components/api-docs/method.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export interface Method {
readonly name: string;
readonly title: string;
readonly description: string; // HTML
readonly parameters: MethodParameter[];
readonly returns: string;
Expand Down
3 changes: 3 additions & 0 deletions docs/.vitepress/components/api-docs/method.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const props = defineProps<{ method: Method }>();
function seeAlsoToUrl(see: string): string {
const [, module, method] = see.replace(/\(.*/, '').split('\.');
if (!method) {
return 'faker.html#' + slugify(module);
}
return module + '.html#' + slugify(method);
}
</script>
Expand Down
4 changes: 2 additions & 2 deletions docs/about/announcements/2022-01-14.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ We were closing issues every other hour. Discussing the `FUNDING.yml` was inevit

When we became aware that this project was the most stable fork of Faker with the most community support, we realized that we needed to deal with the `FUNDING.yml` file and take a stance.

:::tip Short version, please
::: tip Short version, please
Jess posted a [concise and thorough writeup](https://github.com/faker-js/faker/discussions/56#discussioncomment-1958057) of the logic behind our actions and decisions.

This was backed by the support of all of the co-maintainers. It's a much less narrative version of this section, so if you want the TLDR and some photos of the transactions, give it a read.
Expand All @@ -123,7 +123,7 @@ Ben said that simply, "The funding is attached to the project, not the current m

Unanimously, we agreed that we **wanted absolutely no ability to touch the existing funding** and created a cut-over plan with the support of Open Collective.

:::tip Legacy collective
::: tip Legacy collective
There is now a [fakerjs-legacy](https://opencollective.com/fakerjs-legacy) collective. Open Collective transferred all funds into the legacy account and invited Marak and the other maintainer, Brian, into the _legacy_ collective so that they could do whatever they wanted with the funds.
:::

Expand Down
6 changes: 2 additions & 4 deletions docs/api/ApiIndex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,11 @@ onUnmounted(() => window.removeEventListener('keydown', apiSearchFocusHandler));
<div class="api-groups">
<div v-for="item of section.items" :key="item.text" class="api-group">
<h3>
<a :href="item.link + '.html'">{{ item.text }}</a>
<a :href="item.link">{{ item.text }}</a>
</h3>
<ul>
<li v-for="h of item.headers" :key="h.anchor">
<a :href="item.link + '.html#' + slugify(h.anchor)">{{
h.text
}}</a>
<a :href="item.link + '#' + slugify(h.anchor)">{{ h.text }}</a>
</li>
</ul>
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/guide/localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ However, we also provide pre-built instances for more than 50 other locales.

See below for a list of available locales.

:::tip Note
::: tip Note
You can also build your own Faker instances, with custom locales/overwrites.
:::

Expand All @@ -33,7 +33,7 @@ The English locales are around 600 KB in size.
All locales together are around 5 MB in size.
:::

:::tip Note
::: tip Note
Some locales have limited coverage and rely more heavily on the English locale as the source for features they currently do not have.
However, in most cases, using a specific locale will be beneficial in the long term as specifying a locale reduces the time necessary for startup, which has a compounding effect on testing frameworks that reload the imports every execution.
:::
Expand Down Expand Up @@ -105,14 +105,14 @@ In this example there are 5 locales. Each of these is checked in order, and the
| `fr_CA` | French (Canada) | `fakerFR_CA` |
| `fr_CH` | French (Switzerland) | `fakerFR_CH` |
| `fr_LU` | French (Luxembourg) | `fakerFR_LU` |
| `ge` | Georgian | `fakerGE` |
| `he` | Hebrew | `fakerHE` |
| `hr` | Croatian | `fakerHR` |
| `hu` | Hungarian | `fakerHU` |
| `hy` | Armenian | `fakerHY` |
| `id_ID` | Indonesian | `fakerID_ID` |
| `it` | Italian | `fakerIT` |
| `ja` | Japanese | `fakerJA` |
| `ka_GE` | Georgian (Georgia) | `fakerKA_GE` |
| `ko` | Korean | `fakerKO` |
| `lv` | Latvian | `fakerLV` |
| `mk` | Macedonian | `fakerMK` |
Expand Down
7 changes: 4 additions & 3 deletions docs/guide/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ This is the migration guide for upgrading from v7 to v8.

Since v8 has not yet been released, this is a work in progress list of any major and breaking changes in v8.

::: info
Not the version you are looking for?
::: info Not the version you are looking for?

- [Upgrading to v7](https://v7.fakerjs.dev/guide/upgrading.html)
- [Upgrading to v6](https://v6.fakerjs.dev/migration-guide-v5/)
Expand All @@ -16,7 +15,7 @@ Not the version you are looking for?

### Removed ability to change the locale on existing `Faker` instances

:::tip NOTE
::: tip Note
If you are using only the default (`en`) locale, then you don't have to change anything.
:::

Expand Down Expand Up @@ -222,3 +221,5 @@ The functions `faker.system.mimeType`, `faker.system.fileType` and `faker.system
The `en_IND` (English, India) locale was renamed to `en_IN` for consistency with other locales.

The `cz` (Czech) locale was renamed to `cs_CZ` to use the standard ISO codes for language and country.

The `ge` (Georgian) locale was renamed to `ka_GE` to use the standard ISO codes for language and country.
6 changes: 3 additions & 3 deletions docs/guide/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ For more information about changing and customizing the locales, please refer to
</script>
```

::: info NOTE
::: info Note
Using the browser is great for experimenting 👍. However, due to all of the strings Faker uses to generate fake data, **Faker is a large package**. It's `> 5 MiB` minified. **Please avoid deploying the full Faker in your web app.**
:::

Expand All @@ -50,7 +50,7 @@ const randomName = faker.person.fullName(); // Willie Bahringer
const randomEmail = faker.internet.email(); // Tomasa_Ferry14@hotmail.com
```

::: info NOTE
::: info Note
It is highly recommended to use version tags when importing libraries in Deno, e.g: `import { faker } from "https://cdn.skypack.dev/@faker-js/faker@v7.4.0"`. Add `?dts` to import with type definitions: `import { faker } from "https://cdn.skypack.dev/@faker-js/faker@v7.4.0?dts"`.
:::

Expand Down Expand Up @@ -104,7 +104,7 @@ const secondRandom = faker.number.int();
console.log(firstRandom === secondRandom);
```

::: info NOTE
::: info Note
When upgrading to a new version of Faker, you may get different values for the same seed, as the underlying data (lists of names, words etc) may have changed.
:::

Expand Down
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"build:code": "tsx ./scripts/bundle.ts",
"build:types": "tsc --emitDeclarationOnly --outDir dist/types",
"build": "run-s build:clean build:code build:types",
"generate": "run-s generate:locales generate:api-docs",
"generate:api-docs": "tsx ./scripts/apidoc.ts",
"generate:locales": "tsx ./scripts/generateLocales.ts",
"docs:build": "run-s docs:prepare docs:build:run",
Expand All @@ -69,6 +70,7 @@
"docs:diff": "tsx ./scripts/diff.ts",
"format": "prettier --cache --write .",
"lint": "eslint --cache --cache-strategy content .",
"ts-check": "run-s ts-check:scripts ts-check:tests",
"ts-check:scripts": "tsc --project tsconfig.check-scripts.json",
"ts-check:tests": "tsc --project tsconfig.check-tests.json",
"test": "vitest",
Expand All @@ -80,23 +82,23 @@
"docs:test:e2e:open": "run-p --race docs:serve \"cypress open\"",
"release": "standard-version",
"prepublishOnly": "pnpm run clean && pnpm install && pnpm run build",
"preflight": "pnpm install && run-s generate:* format lint build test:update-snapshots"
"preflight": "pnpm install && run-s generate format lint build test:update-snapshots ts-check"
},
"devDependencies": {
"@actions/github": "~5.1.1",
"@algolia/client-search": "~4.16.0",
"@algolia/client-search": "~4.17.0",
"@types/glob": "~8.1.0",
"@types/markdown-it": "~12.2.3",
"@types/node": "~18.15.11",
"@types/prettier": "~2.7.2",
"@types/react": "~18.0.29",
"@types/react": "~18.0.32",
"@types/sanitize-html": "~2.9.0",
"@types/semver": "~7.3.13",
"@types/validator": "~13.7.14",
"@typescript-eslint/eslint-plugin": "~5.56.0",
"@typescript-eslint/parser": "~5.56.0",
"@vitest/coverage-c8": "~0.29.7",
"@vitest/ui": "~0.29.7",
"@typescript-eslint/eslint-plugin": "~5.57.1",
"@typescript-eslint/parser": "~5.57.1",
"@vitest/coverage-c8": "~0.29.8",
"@vitest/ui": "~0.29.8",
"@vueuse/core": "~9.13.0",
"c8": "~7.13.0",
"conventional-changelog-cli": "~2.2.2",
Expand Down Expand Up @@ -126,11 +128,11 @@
"typescript": "~4.9.5",
"validator": "~13.9.0",
"vite": "~4.2.1",
"vitepress": "1.0.0-alpha.63",
"vitest": "~0.29.7",
"vitepress": "1.0.0-alpha.64",
"vitest": "~0.29.8",
"vue": "~3.2.47"
},
"packageManager": "pnpm@7.30.3",
"packageManager": "pnpm@7.30.5",
"engines": {
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",
"npm": ">=6.14.13"
Expand Down
Loading

0 comments on commit 98ce3a5

Please sign in to comment.