From a6e61043be6ce6608995fc215fbe60a284bd8c1d Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Wed, 29 Mar 2023 09:39:27 +0200 Subject: [PATCH 1/9] docs: unwrap nested named union and literal types (#1965) --- scripts/apidoc/signature.ts | 12 ++- .../__snapshots__/signature.spec.ts.snap | 80 +++++++++++++------ test/scripts/apidoc/signature.example.ts | 17 +++- 3 files changed, 82 insertions(+), 27 deletions(-) diff --git a/scripts/apidoc/signature.ts b/scripts/apidoc/signature.ts index 109cd55d0ff..c41b758ce31 100644 --- a/scripts/apidoc/signature.ts +++ b/scripts/apidoc/signature.ts @@ -304,7 +304,17 @@ function typeToText(type_?: Type, short = false): string { case 'reference': if (!type.typeArguments || !type.typeArguments.length) { - return type.name; + const reflection = type.reflection as DeclarationReflection | undefined; + const reflectionType = reflection?.type; + if ( + (reflectionType?.type === 'literal' || + reflectionType?.type === 'union') && + !type.name.match(/Char$/) + ) { + return typeToText(reflectionType, short); + } else { + return type.name; + } } else if (type.name === 'LiteralUnion') { return [ typeToText(type.typeArguments[0], short), diff --git a/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap b/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap index 533d13daec0..f93bcd497e9 100644 --- a/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap +++ b/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap @@ -44,7 +44,7 @@ exports[`signature > analyzeSignature() > complexArrayParameter 1`] = ` "returns": "T", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L330", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L343", "title": "Complex Array Parameter", } `; @@ -70,7 +70,7 @@ exports[`signature > analyzeSignature() > defaultBooleanParamMethod 1`] = ` "returns": "number", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L99", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L101", "title": "Default Boolean Param Method", } `; @@ -120,7 +120,7 @@ exports[`signature > analyzeSignature() > functionParamMethod 1`] = ` "returns": "number", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L119", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L121", "title": "Function Param Method", } `; @@ -130,7 +130,7 @@ exports[`signature > analyzeSignature() > literalUnionParamMethod 1`] = ` "deprecated": undefined, "description": "

Test with LiteralUnion.

", - "examples": "
ts
faker.literalUnionParamMethod(value: 'a' | 'b' | string, namedValue: AB | string, array: readonly Array<'a' | 'b' | string>, namedArray: readonly Array<AB | string>, mixed: 'a' | 'b' | string | readonly Array<'a' | 'b' | string>, namedMixed: AB | string | readonly Array<AB | string>): string
+  "examples": "
ts
faker.literalUnionParamMethod(value: 'a' | 'b' | string, namedValue: 'a' | 'b' | string, array: readonly Array<'a' | 'b' | string>, namedArray: readonly Array<'a' | 'b' | string>, mixed: 'a' | 'b' | string | readonly Array<'a' | 'b' | string>, namedMixed: 'a' | 'b' | string | readonly Array<'a' | 'b' | string>): string
 
", "name": "literalUnionParamMethod", @@ -147,7 +147,7 @@ exports[`signature > analyzeSignature() > literalUnionParamMethod 1`] = ` "description": "

'a' or 'b'.

", "name": "namedValue", - "type": "AB | string", + "type": "'a' | 'b' | string", }, { "default": undefined, @@ -161,7 +161,7 @@ exports[`signature > analyzeSignature() > literalUnionParamMethod 1`] = ` "description": "

Array of 'a' or 'b'.

", "name": "namedArray", - "type": "Array", + "type": "Array<'a' | 'b' | string>", }, { "default": undefined, @@ -175,13 +175,13 @@ exports[`signature > analyzeSignature() > literalUnionParamMethod 1`] = ` "description": "

Value 'a' or 'b' or an array thereof.

", "name": "namedMixed", - "type": "AB | string | Array", + "type": "'a' | 'b' | string | Array<'a' | 'b' | string>", }, ], "returns": "string", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L142", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L155", "title": "Literal Union Param Method", } `; @@ -202,7 +202,7 @@ exports[`signature > analyzeSignature() > methodWithDeprecated 1`] = ` "test.apidoc.methodWithExample()", ], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L260", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L273", "title": "Method With Deprecated", } `; @@ -255,7 +255,7 @@ exports[`signature > analyzeSignature() > methodWithDeprecatedOption 1`] = ` "returns": "number", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L272", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L285", "title": "Method With Deprecated Option", } `; @@ -274,7 +274,7 @@ exports[`signature > analyzeSignature() > methodWithExample 1`] = ` "returns": "number", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L249", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L262", "title": "Method With Example", } `; @@ -295,7 +295,7 @@ exports[`signature > analyzeSignature() > methodWithMultipleSeeMarkers 1`] = ` "test.apidoc.methodWithDeprecated()", ], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L299", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L312", "title": "Method With Multiple See Markers", } `; @@ -316,7 +316,7 @@ exports[`signature > analyzeSignature() > methodWithMultipleSeeMarkersAndBacktic "test.apidoc.methodWithDeprecated() with parameter bar and baz.", ], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L309", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L322", "title": "Method With Multiple See Markers And Backticks", } `; @@ -334,7 +334,7 @@ exports[`signature > analyzeSignature() > methodWithSinceMarker 1`] = ` "returns": "number", "seeAlsos": [], "since": "1.0.0", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L318", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L331", "title": "Method With Since Marker", } `; @@ -374,7 +374,7 @@ exports[`signature > analyzeSignature() > multiParamMethod 1`] = ` "returns": "number", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L110", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L112", "title": "Multi Param Method", } `; @@ -392,7 +392,7 @@ exports[`signature > analyzeSignature() > noParamMethod 1`] = ` "returns": "number", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L72", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L74", "title": "No Param Method", } `; @@ -418,7 +418,7 @@ exports[`signature > analyzeSignature() > optionalStringParamMethod 1`] = ` "returns": "number", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L90", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L92", "title": "Optional String Param Method", } `; @@ -487,7 +487,7 @@ It also has a more complex description.

"returns": "number", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L199", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L212", "title": "Options Inline Param Method With Defaults", } `; @@ -527,7 +527,7 @@ exports[`signature > analyzeSignature() > optionsInterfaceParamMethodWithDefault "returns": "number", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L235", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L248", "title": "Options Interface Param Method With Defaults", } `; @@ -594,7 +594,7 @@ exports[`signature > analyzeSignature() > optionsParamMethod 1`] = ` "returns": "number", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L169", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L182", "title": "Options Param Method", } `; @@ -634,7 +634,7 @@ exports[`signature > analyzeSignature() > optionsTypeParamMethodWithDefaults 1`] "returns": "number", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L217", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L230", "title": "Options Type Param Method With Defaults", } `; @@ -660,7 +660,7 @@ exports[`signature > analyzeSignature() > requiredNumberParamMethod 1`] = ` "returns": "number", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L81", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L83", "title": "Required Number Param Method", } `; @@ -670,7 +670,11 @@ exports[`signature > analyzeSignature() > stringUnionParamMethod 1`] = ` "deprecated": undefined, "description": "

Test with string union.

", - "examples": "
ts
faker.stringUnionParamMethod(value: 'a' | 'b'): string
+  "examples": "
ts
faker.stringUnionParamMethod(value: 'a' | 'b', options?: {
+  casing: 'lower' | 'mixed' | 'upper',
+  excludes: readonly AlphaNumericChar[],
+  format: 'binary' | 'css' | 'decimal' | 'hex'
+}): string
 
", "name": "stringUnionParamMethod", @@ -682,11 +686,39 @@ exports[`signature > analyzeSignature() > stringUnionParamMethod 1`] = ` "name": "value", "type": "'a' | 'b'", }, + { + "default": undefined, + "description": "

The options parameter.

+", + "name": "options?", + "type": "{ ... }", + }, + { + "default": undefined, + "description": "

The casing parameter.

+", + "name": "options.casing?", + "type": "'lower' | 'mixed' | 'upper'", + }, + { + "default": undefined, + "description": "

The excludes parameter.

+", + "name": "options.excludes?", + "type": "readonly AlphaNumericChar[]", + }, + { + "default": undefined, + "description": "

The format parameter.

+", + "name": "options.format?", + "type": "'binary' | 'css' | 'decimal' | 'hex'", + }, ], "returns": "string", "seeAlsos": [], "since": "", - "sourcePath": "test/scripts/apidoc/signature.example.ts#L128", + "sourcePath": "test/scripts/apidoc/signature.example.ts#L134", "title": "String Union Param Method", } `; diff --git a/test/scripts/apidoc/signature.example.ts b/test/scripts/apidoc/signature.example.ts index 1013365f4eb..87bc331e07a 100644 --- a/test/scripts/apidoc/signature.example.ts +++ b/test/scripts/apidoc/signature.example.ts @@ -1,3 +1,5 @@ +import type { Casing, ColorFormat } from '../../../src'; +import type { AlphaNumericChar } from '../../../src/modules/string'; import type { LiteralUnion } from '../../../src/utils/types'; /** @@ -124,9 +126,20 @@ export class SignatureTest { * Test with string union. * * @param value `'a'` or `'b'`. + * @param options The options parameter. + * @param options.casing The casing parameter. + * @param options.format The format parameter. + * @param options.excludes The excludes parameter. */ - stringUnionParamMethod(value: 'a' | 'b'): string { - return value; + stringUnionParamMethod( + value: 'a' | 'b', + options?: { + casing?: Casing; + format?: 'hex' | ColorFormat; + excludes?: ReadonlyArray; + } + ): string { + return value + options.format; } /** From de47aaa56892621a0088ac63386cfaf06c560f16 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 29 Mar 2023 07:53:27 +0000 Subject: [PATCH 2/9] chore(deps): update dependency prettier to v2.8.7 (#1954) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Shinigami92 --- .editorconfig | 1 - package.json | 2 +- pnpm-lock.yaml | 20 ++++++++++---------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.editorconfig b/.editorconfig index 2731d1029ce..4a7ea3036a2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,5 +9,4 @@ trim_trailing_whitespace = true insert_final_newline = true [*.md] -max_line_length = off trim_trailing_whitespace = false diff --git a/package.json b/package.json index 5fba1a1bfc9..d74ed3b967d 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "glob": "~9.3.2", "npm-run-all": "~4.1.5", "picocolors": "~1.0.0", - "prettier": "2.8.4", + "prettier": "2.8.7", "prettier-plugin-organize-imports": "~3.2.2", "react": "~18.2.0", "react-dom": "~18.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eb701ead3b5..7fe2db34400 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -30,7 +30,7 @@ specifiers: glob: ~9.3.2 npm-run-all: ~4.1.5 picocolors: ~1.0.0 - prettier: 2.8.4 + prettier: 2.8.7 prettier-plugin-organize-imports: ~3.2.2 react: ~18.2.0 react-dom: ~18.2.0 @@ -74,12 +74,12 @@ devDependencies: eslint-gitignore: 0.1.0_eslint@8.36.0 eslint-plugin-deprecation: 1.3.3_vgl77cfdswitgr47lm5swmv43m eslint-plugin-jsdoc: 40.1.0_eslint@8.36.0 - eslint-plugin-prettier: 4.2.1_7sb2khnpunhlasziblb2dlqwge + eslint-plugin-prettier: 4.2.1_ywlv3zveqg2kxfq44lflihh5mm glob: 9.3.2 npm-run-all: 4.1.5 picocolors: 1.0.0 - prettier: 2.8.4 - prettier-plugin-organize-imports: 3.2.2_silln3pw57har7jydmecgzoypa + prettier: 2.8.7 + prettier-plugin-organize-imports: 3.2.2_erhqnhond52bpeyvirmp3gjrp4 react: 18.2.0 react-dom: 18.2.0_react@18.2.0 rimraf: 4.4.1 @@ -2347,7 +2347,7 @@ packages: - supports-color dev: true - /eslint-plugin-prettier/4.2.1_7sb2khnpunhlasziblb2dlqwge: + /eslint-plugin-prettier/4.2.1_ywlv3zveqg2kxfq44lflihh5mm: resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==} engines: {node: '>=12.0.0'} peerDependencies: @@ -2360,7 +2360,7 @@ packages: dependencies: eslint: 8.36.0 eslint-config-prettier: 8.8.0_eslint@8.36.0 - prettier: 2.8.4 + prettier: 2.8.7 prettier-linter-helpers: 1.0.0 dev: true @@ -3966,7 +3966,7 @@ packages: fast-diff: 1.2.0 dev: true - /prettier-plugin-organize-imports/3.2.2_silln3pw57har7jydmecgzoypa: + /prettier-plugin-organize-imports/3.2.2_erhqnhond52bpeyvirmp3gjrp4: resolution: {integrity: sha512-e97lE6odGSiHonHJMTYC0q0iLXQyw0u5z/PJpvP/3vRy6/Zi9kLBwFAbEGjDzIowpjQv8b+J04PDamoUSQbzGA==} peerDependencies: '@volar/vue-language-plugin-pug': ^1.0.4 @@ -3979,12 +3979,12 @@ packages: '@volar/vue-typescript': optional: true dependencies: - prettier: 2.8.4 + prettier: 2.8.7 typescript: 4.9.5 dev: true - /prettier/2.8.4: - resolution: {integrity: sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==} + /prettier/2.8.7: + resolution: {integrity: sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==} engines: {node: '>=10.13.0'} hasBin: true dev: true From f890d627164c5436e2b2a3ac05239a1a1634015e Mon Sep 17 00:00:00 2001 From: Shinigami Date: Wed, 29 Mar 2023 10:22:57 +0200 Subject: [PATCH 3/9] feat: add base locale (#1748) --- docs/guide/localization.md | 13 +++++++++-- docs/guide/upgrading.md | 4 ++-- scripts/generateLocales.ts | 20 +++++++++++----- src/locale/af_ZA.ts | 3 ++- src/locale/ar.ts | 3 ++- src/locale/az.ts | 3 ++- src/locale/base.ts | 11 +++++++++ src/locale/cz.ts | 3 ++- src/locale/de.ts | 3 ++- src/locale/de_AT.ts | 3 ++- src/locale/de_CH.ts | 3 ++- src/locale/dv.ts | 3 ++- src/locale/el.ts | 3 ++- src/locale/en.ts | 3 ++- src/locale/en_AU.ts | 3 ++- src/locale/en_AU_ocker.ts | 3 ++- src/locale/en_BORK.ts | 3 ++- src/locale/en_CA.ts | 3 ++- src/locale/en_GB.ts | 3 ++- src/locale/en_GH.ts | 3 ++- src/locale/en_IE.ts | 3 ++- src/locale/en_IN.ts | 3 ++- src/locale/en_NG.ts | 3 ++- src/locale/en_US.ts | 3 ++- src/locale/en_ZA.ts | 3 ++- src/locale/es.ts | 3 ++- src/locale/es_MX.ts | 3 ++- src/locale/fa.ts | 3 ++- src/locale/fi.ts | 3 ++- src/locale/fr.ts | 3 ++- src/locale/fr_BE.ts | 3 ++- src/locale/fr_CA.ts | 3 ++- src/locale/fr_CH.ts | 3 ++- src/locale/fr_LU.ts | 3 ++- src/locale/ge.ts | 3 ++- src/locale/global.ts | 11 +++++++++ src/locale/he.ts | 3 ++- src/locale/hr.ts | 3 ++- src/locale/hu.ts | 3 ++- src/locale/hy.ts | 3 ++- src/locale/id_ID.ts | 3 ++- src/locale/index.ts | 3 +++ src/locale/it.ts | 3 ++- src/locale/ja.ts | 3 ++- src/locale/ko.ts | 3 ++- src/locale/lv.ts | 3 ++- src/locale/mk.ts | 3 ++- src/locale/nb_NO.ts | 3 ++- src/locale/ne.ts | 3 ++- src/locale/nl.ts | 3 ++- src/locale/nl_BE.ts | 3 ++- src/locale/pl.ts | 3 ++- src/locale/pt_BR.ts | 3 ++- src/locale/pt_PT.ts | 3 ++- src/locale/ro.ts | 3 ++- src/locale/ru.ts | 3 ++- src/locale/sk.ts | 3 ++- src/locale/sr_RS_latin.ts | 3 ++- src/locale/sv.ts | 3 ++- src/locale/tr.ts | 3 ++- src/locale/uk.ts | 3 ++- src/locale/ur.ts | 3 ++- src/locale/vi.ts | 3 ++- src/locale/zh_CN.ts | 3 ++- src/locale/zh_TW.ts | 3 ++- src/locale/zu_ZA.ts | 3 ++- src/locales/base/color/index.ts | 12 ++++++++++ src/locales/{en => base}/color/space.ts | 0 .../{en => base}/database/collation.ts | 0 src/locales/{en => base}/database/engine.ts | 0 src/locales/base/database/index.ts | 16 +++++++++++++ src/locales/{en => base}/database/type.ts | 0 .../{en => base}/hacker/abbreviation.ts | 0 src/locales/base/hacker/index.ts | 12 ++++++++++ src/locales/base/index.ts | 23 +++++++++++++++++++ src/locales/{en => base}/internet/emoji.ts | 0 .../{en => base}/internet/http_status_code.ts | 0 src/locales/base/internet/index.ts | 14 +++++++++++ .../{en => base}/location/country_code.ts | 0 src/locales/base/location/index.ts | 14 +++++++++++ .../{en => base}/location/time_zone.ts | 0 .../{en => base}/system/directoryPaths.ts | 0 src/locales/{en => base}/system/index.ts | 0 src/locales/{en => base}/system/mimeTypes.ts | 0 src/locales/en/color/index.ts | 2 -- src/locales/en/database/index.ts | 6 ----- src/locales/en/hacker/index.ts | 2 -- src/locales/en/index.ts | 2 -- src/locales/en/internet/index.ts | 4 ---- src/locales/en/location/index.ts | 4 ---- src/locales/index.ts | 1 + test/all_functional.spec.ts | 10 ++++++++ test/internet.spec.ts | 6 ++++- 93 files changed, 279 insertions(+), 91 deletions(-) create mode 100644 src/locale/base.ts create mode 100644 src/locale/global.ts create mode 100644 src/locales/base/color/index.ts rename src/locales/{en => base}/color/space.ts (100%) rename src/locales/{en => base}/database/collation.ts (100%) rename src/locales/{en => base}/database/engine.ts (100%) create mode 100644 src/locales/base/database/index.ts rename src/locales/{en => base}/database/type.ts (100%) rename src/locales/{en => base}/hacker/abbreviation.ts (100%) create mode 100644 src/locales/base/hacker/index.ts create mode 100644 src/locales/base/index.ts rename src/locales/{en => base}/internet/emoji.ts (100%) rename src/locales/{en => base}/internet/http_status_code.ts (100%) create mode 100644 src/locales/base/internet/index.ts rename src/locales/{en => base}/location/country_code.ts (100%) create mode 100644 src/locales/base/location/index.ts rename src/locales/{en => base}/location/time_zone.ts (100%) rename src/locales/{en => base}/system/directoryPaths.ts (100%) rename src/locales/{en => base}/system/index.ts (100%) rename src/locales/{en => base}/system/mimeTypes.ts (100%) diff --git a/docs/guide/localization.md b/docs/guide/localization.md index c563b25cf7f..4b0738dc1ed 100644 --- a/docs/guide/localization.md +++ b/docs/guide/localization.md @@ -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 } from '@faker-js/faker'; +import { Faker, de_CH, de, en, base } from '@faker-js/faker'; const customLocale: LocaleDefinition = { title: 'My custom locale', @@ -54,10 +54,18 @@ const customLocale: LocaleDefinition = { }; export const customFaker = new Faker({ - locale: [customLocale, de_CH, de, en, global], + locale: [customLocale, de_CH, de, en, base], }); ``` +In this example there are 5 locales. Each of these is checked in order, and the first locale which contains the requested data will be used: + +- `customLocale` is your custom locale definition which will override all other fallback definitions. +- `de_CH` is a specific locale definition that overrides some German definitions with `CH` (Switzerland) data. +- `de` is a generic `de` (German) locale definition. +- `en` is a generic `en` (English) locale definition. This is our most complete locale, so we add it to fill some gaps. Depending on your needs, you might want or not want to have it as a fallback. +- `base` is the base locale definition which contains definitions that can be used in every language (e.g. emojis). + ## Available locales @@ -69,6 +77,7 @@ export const customFaker = new Faker({ | `af_ZA` | Afrikaans | `fakerAF_ZA` | | `ar` | Arabic | `fakerAR` | | `az` | Azerbaijani | `fakerAZ` | +| `base` | Base | `fakerBASE` | | `cz` | Czech | `fakerCZ` | | `de` | German | `fakerDE` | | `de_AT` | German (Austria) | `fakerDE_AT` | diff --git a/docs/guide/upgrading.md b/docs/guide/upgrading.md index 82bfd2ac18b..1fa392f8f11 100644 --- a/docs/guide/upgrading.md +++ b/docs/guide/upgrading.md @@ -60,12 +60,12 @@ const b = customFaker.internet.emoji(); **New** ```ts -import { Faker, de_CH, de, en, global } from '@faker-js/faker'; +import { Faker, de_CH, de, en, base } from '@faker-js/faker'; // same as fakerDE_CH export const customFaker = new Faker({ // Now multiple fallbacks are supported - locale: [de_CH, de, en, global], + locale: [de_CH, de, en, base], }); const a = customFaker.internet.email(); const b = customFaker.internet.emoji(); diff --git a/scripts/generateLocales.ts b/scripts/generateLocales.ts index d8fa1be13a2..7a8aa299481 100644 --- a/scripts/generateLocales.ts +++ b/scripts/generateLocales.ts @@ -125,10 +125,15 @@ function generateLocaleFile(locale: string): void { } } - if (locales[locales.length - 1] !== 'en') { + // TODO christopher 2023-03-07: Remove 'en' fallback in a separate PR + if (locales[locales.length - 1] !== 'en' && locale !== 'base') { locales.push('en'); } + if (locales[locales.length - 1] !== 'base') { + locales.push('base'); + } + let content = ` ${autoGeneratedCommentHeader} @@ -148,8 +153,10 @@ function generateLocaleFile(locale: string): void { writeFileSync(resolve(pathLocale, `${locale}.ts`), content); } -function tryLoadLocalesMainIndexFile(pathModules: string): LocaleDefinition { - let localeDef: LocaleDefinition; +function tryLoadLocalesMainIndexFile( + pathModules: string +): LocaleDefinition | undefined { + let localeDef: LocaleDefinition | undefined; // This call might fail, if the module setup is broken. // Unfortunately, we try to fix it with this script // Thats why have a fallback logic here, we only need the title anyway @@ -165,9 +172,10 @@ function tryLoadLocalesMainIndexFile(pathModules: string): LocaleDefinition { resolve(pathModules, 'index.ts'), 'utf-8' ); - localeDef = { - title: localeIndex.match(/title: '(.*)',/)[1], - }; + const title = localeIndex.match(/title: '(.*)',/)?.[1]; + if (title) { + localeDef = { title }; + } } catch { console.error(`Failed to load ${pathModules} or manually parse it.`, e); } diff --git a/src/locale/af_ZA.ts b/src/locale/af_ZA.ts index 17e0a692a28..61dc3819ad0 100644 --- a/src/locale/af_ZA.ts +++ b/src/locale/af_ZA.ts @@ -5,8 +5,9 @@ import { Faker } from '../faker'; import af_ZA from '../locales/af_ZA'; +import base from '../locales/base'; import en from '../locales/en'; export const faker = new Faker({ - locale: [af_ZA, en], + locale: [af_ZA, en, base], }); diff --git a/src/locale/ar.ts b/src/locale/ar.ts index 2874a6fb69d..343d2e19bde 100644 --- a/src/locale/ar.ts +++ b/src/locale/ar.ts @@ -5,8 +5,9 @@ import { Faker } from '../faker'; import ar from '../locales/ar'; +import base from '../locales/base'; import en from '../locales/en'; export const faker = new Faker({ - locale: [ar, en], + locale: [ar, en, base], }); diff --git a/src/locale/az.ts b/src/locale/az.ts index 7b11a6a90e8..6366b82896c 100644 --- a/src/locale/az.ts +++ b/src/locale/az.ts @@ -5,8 +5,9 @@ import { Faker } from '../faker'; import az from '../locales/az'; +import base from '../locales/base'; import en from '../locales/en'; export const faker = new Faker({ - locale: [az, en], + locale: [az, en, base], }); diff --git a/src/locale/base.ts b/src/locale/base.ts new file mode 100644 index 00000000000..67db0218531 --- /dev/null +++ b/src/locale/base.ts @@ -0,0 +1,11 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ + +import { Faker } from '../faker'; +import base from '../locales/base'; + +export const faker = new Faker({ + locale: base, +}); diff --git a/src/locale/cz.ts b/src/locale/cz.ts index c2f85800d7c..19b35d71f91 100644 --- a/src/locale/cz.ts +++ b/src/locale/cz.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import cz from '../locales/cz'; import en from '../locales/en'; export const faker = new Faker({ - locale: [cz, en], + locale: [cz, en, base], }); diff --git a/src/locale/de.ts b/src/locale/de.ts index 09ff3bfa986..67801f85572 100644 --- a/src/locale/de.ts +++ b/src/locale/de.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import de from '../locales/de'; import en from '../locales/en'; export const faker = new Faker({ - locale: [de, en], + locale: [de, en, base], }); diff --git a/src/locale/de_AT.ts b/src/locale/de_AT.ts index b02b50cb559..a964ee7e05d 100644 --- a/src/locale/de_AT.ts +++ b/src/locale/de_AT.ts @@ -4,10 +4,11 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import de from '../locales/de'; import de_AT from '../locales/de_AT'; import en from '../locales/en'; export const faker = new Faker({ - locale: [de_AT, de, en], + locale: [de_AT, de, en, base], }); diff --git a/src/locale/de_CH.ts b/src/locale/de_CH.ts index 5b866437292..b3d0937a401 100644 --- a/src/locale/de_CH.ts +++ b/src/locale/de_CH.ts @@ -4,10 +4,11 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import de from '../locales/de'; import de_CH from '../locales/de_CH'; import en from '../locales/en'; export const faker = new Faker({ - locale: [de_CH, de, en], + locale: [de_CH, de, en, base], }); diff --git a/src/locale/dv.ts b/src/locale/dv.ts index 3d996cc14b6..dcf8bf4d34c 100644 --- a/src/locale/dv.ts +++ b/src/locale/dv.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import dv from '../locales/dv'; import en from '../locales/en'; export const faker = new Faker({ - locale: [dv, en], + locale: [dv, en, base], }); diff --git a/src/locale/el.ts b/src/locale/el.ts index 119403b622c..c687598970a 100644 --- a/src/locale/el.ts +++ b/src/locale/el.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import el from '../locales/el'; import en from '../locales/en'; export const faker = new Faker({ - locale: [el, en], + locale: [el, en, base], }); diff --git a/src/locale/en.ts b/src/locale/en.ts index 1d7db9f5061..fc5abe42161 100644 --- a/src/locale/en.ts +++ b/src/locale/en.ts @@ -4,8 +4,9 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; export const faker = new Faker({ - locale: en, + locale: [en, base], }); diff --git a/src/locale/en_AU.ts b/src/locale/en_AU.ts index 01ad19ad394..10c90dbe419 100644 --- a/src/locale/en_AU.ts +++ b/src/locale/en_AU.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import en_AU from '../locales/en_AU'; export const faker = new Faker({ - locale: [en_AU, en], + locale: [en_AU, en, base], }); diff --git a/src/locale/en_AU_ocker.ts b/src/locale/en_AU_ocker.ts index 22c9ae3254e..1b30265487c 100644 --- a/src/locale/en_AU_ocker.ts +++ b/src/locale/en_AU_ocker.ts @@ -4,10 +4,11 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import en_AU from '../locales/en_AU'; import en_AU_ocker from '../locales/en_AU_ocker'; export const faker = new Faker({ - locale: [en_AU_ocker, en_AU, en], + locale: [en_AU_ocker, en_AU, en, base], }); diff --git a/src/locale/en_BORK.ts b/src/locale/en_BORK.ts index d8776851a06..5f357c685ad 100644 --- a/src/locale/en_BORK.ts +++ b/src/locale/en_BORK.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import en_BORK from '../locales/en_BORK'; export const faker = new Faker({ - locale: [en_BORK, en], + locale: [en_BORK, en, base], }); diff --git a/src/locale/en_CA.ts b/src/locale/en_CA.ts index a1c2d158443..40c86fcee89 100644 --- a/src/locale/en_CA.ts +++ b/src/locale/en_CA.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import en_CA from '../locales/en_CA'; export const faker = new Faker({ - locale: [en_CA, en], + locale: [en_CA, en, base], }); diff --git a/src/locale/en_GB.ts b/src/locale/en_GB.ts index 411c08234e2..4551d568d1f 100644 --- a/src/locale/en_GB.ts +++ b/src/locale/en_GB.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import en_GB from '../locales/en_GB'; export const faker = new Faker({ - locale: [en_GB, en], + locale: [en_GB, en, base], }); diff --git a/src/locale/en_GH.ts b/src/locale/en_GH.ts index a131a786f03..8c81794fe91 100644 --- a/src/locale/en_GH.ts +++ b/src/locale/en_GH.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import en_GH from '../locales/en_GH'; export const faker = new Faker({ - locale: [en_GH, en], + locale: [en_GH, en, base], }); diff --git a/src/locale/en_IE.ts b/src/locale/en_IE.ts index b66c6a45529..96ed78a9d2e 100644 --- a/src/locale/en_IE.ts +++ b/src/locale/en_IE.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import en_IE from '../locales/en_IE'; export const faker = new Faker({ - locale: [en_IE, en], + locale: [en_IE, en, base], }); diff --git a/src/locale/en_IN.ts b/src/locale/en_IN.ts index 28eb2333257..75112107b7c 100644 --- a/src/locale/en_IN.ts +++ b/src/locale/en_IN.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import en_IN from '../locales/en_IN'; export const faker = new Faker({ - locale: [en_IN, en], + locale: [en_IN, en, base], }); diff --git a/src/locale/en_NG.ts b/src/locale/en_NG.ts index a5a9b5b1cf7..6e9a5dc01fb 100644 --- a/src/locale/en_NG.ts +++ b/src/locale/en_NG.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import en_NG from '../locales/en_NG'; export const faker = new Faker({ - locale: [en_NG, en], + locale: [en_NG, en, base], }); diff --git a/src/locale/en_US.ts b/src/locale/en_US.ts index 8077c573a56..d54d8e497bc 100644 --- a/src/locale/en_US.ts +++ b/src/locale/en_US.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import en_US from '../locales/en_US'; export const faker = new Faker({ - locale: [en_US, en], + locale: [en_US, en, base], }); diff --git a/src/locale/en_ZA.ts b/src/locale/en_ZA.ts index 3e5b31634ed..a5de8756b86 100644 --- a/src/locale/en_ZA.ts +++ b/src/locale/en_ZA.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import en_ZA from '../locales/en_ZA'; export const faker = new Faker({ - locale: [en_ZA, en], + locale: [en_ZA, en, base], }); diff --git a/src/locale/es.ts b/src/locale/es.ts index 0f5116f2120..f206bec081d 100644 --- a/src/locale/es.ts +++ b/src/locale/es.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import es from '../locales/es'; export const faker = new Faker({ - locale: [es, en], + locale: [es, en, base], }); diff --git a/src/locale/es_MX.ts b/src/locale/es_MX.ts index 5a80a0f0028..d59a239b27d 100644 --- a/src/locale/es_MX.ts +++ b/src/locale/es_MX.ts @@ -4,10 +4,11 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import es from '../locales/es'; import es_MX from '../locales/es_MX'; export const faker = new Faker({ - locale: [es_MX, es, en], + locale: [es_MX, es, en, base], }); diff --git a/src/locale/fa.ts b/src/locale/fa.ts index 9a8c12de9ad..9d3325270bb 100644 --- a/src/locale/fa.ts +++ b/src/locale/fa.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import fa from '../locales/fa'; export const faker = new Faker({ - locale: [fa, en], + locale: [fa, en, base], }); diff --git a/src/locale/fi.ts b/src/locale/fi.ts index 06844df4eea..1125d54bf4f 100644 --- a/src/locale/fi.ts +++ b/src/locale/fi.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import fi from '../locales/fi'; export const faker = new Faker({ - locale: [fi, en], + locale: [fi, en, base], }); diff --git a/src/locale/fr.ts b/src/locale/fr.ts index f9360a7e30c..f9a76f46453 100644 --- a/src/locale/fr.ts +++ b/src/locale/fr.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import fr from '../locales/fr'; export const faker = new Faker({ - locale: [fr, en], + locale: [fr, en, base], }); diff --git a/src/locale/fr_BE.ts b/src/locale/fr_BE.ts index 41e2554de14..d0a6536f4c6 100644 --- a/src/locale/fr_BE.ts +++ b/src/locale/fr_BE.ts @@ -4,10 +4,11 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import fr from '../locales/fr'; import fr_BE from '../locales/fr_BE'; export const faker = new Faker({ - locale: [fr_BE, fr, en], + locale: [fr_BE, fr, en, base], }); diff --git a/src/locale/fr_CA.ts b/src/locale/fr_CA.ts index 77e9a22784e..cb30f751024 100644 --- a/src/locale/fr_CA.ts +++ b/src/locale/fr_CA.ts @@ -4,10 +4,11 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import fr from '../locales/fr'; import fr_CA from '../locales/fr_CA'; export const faker = new Faker({ - locale: [fr_CA, fr, en], + locale: [fr_CA, fr, en, base], }); diff --git a/src/locale/fr_CH.ts b/src/locale/fr_CH.ts index fc61a9f512b..6301439a368 100644 --- a/src/locale/fr_CH.ts +++ b/src/locale/fr_CH.ts @@ -4,10 +4,11 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import fr from '../locales/fr'; import fr_CH from '../locales/fr_CH'; export const faker = new Faker({ - locale: [fr_CH, fr, en], + locale: [fr_CH, fr, en, base], }); diff --git a/src/locale/fr_LU.ts b/src/locale/fr_LU.ts index c7bee2379c0..b2d5a0e74d9 100644 --- a/src/locale/fr_LU.ts +++ b/src/locale/fr_LU.ts @@ -4,10 +4,11 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import fr from '../locales/fr'; import fr_LU from '../locales/fr_LU'; export const faker = new Faker({ - locale: [fr_LU, fr, en], + locale: [fr_LU, fr, en, base], }); diff --git a/src/locale/ge.ts b/src/locale/ge.ts index f33a614acf9..b70b48c606e 100644 --- a/src/locale/ge.ts +++ b/src/locale/ge.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import ge from '../locales/ge'; export const faker = new Faker({ - locale: [ge, en], + locale: [ge, en, base], }); diff --git a/src/locale/global.ts b/src/locale/global.ts new file mode 100644 index 00000000000..67db0218531 --- /dev/null +++ b/src/locale/global.ts @@ -0,0 +1,11 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ + +import { Faker } from '../faker'; +import base from '../locales/base'; + +export const faker = new Faker({ + locale: base, +}); diff --git a/src/locale/he.ts b/src/locale/he.ts index a7dca5f966d..fb8557cc81f 100644 --- a/src/locale/he.ts +++ b/src/locale/he.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import he from '../locales/he'; export const faker = new Faker({ - locale: [he, en], + locale: [he, en, base], }); diff --git a/src/locale/hr.ts b/src/locale/hr.ts index a210046c9ed..b5ed8516319 100644 --- a/src/locale/hr.ts +++ b/src/locale/hr.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import hr from '../locales/hr'; export const faker = new Faker({ - locale: [hr, en], + locale: [hr, en, base], }); diff --git a/src/locale/hu.ts b/src/locale/hu.ts index de5613dc295..72b31b177e9 100644 --- a/src/locale/hu.ts +++ b/src/locale/hu.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import hu from '../locales/hu'; export const faker = new Faker({ - locale: [hu, en], + locale: [hu, en, base], }); diff --git a/src/locale/hy.ts b/src/locale/hy.ts index d7d72c3b8e5..c908e938e8c 100644 --- a/src/locale/hy.ts +++ b/src/locale/hy.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import hy from '../locales/hy'; export const faker = new Faker({ - locale: [hy, en], + locale: [hy, en, base], }); diff --git a/src/locale/id_ID.ts b/src/locale/id_ID.ts index 6f481d831f4..076fe67e67b 100644 --- a/src/locale/id_ID.ts +++ b/src/locale/id_ID.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import id_ID from '../locales/id_ID'; export const faker = new Faker({ - locale: [id_ID, en], + locale: [id_ID, en, base], }); diff --git a/src/locale/index.ts b/src/locale/index.ts index 4b311b94a37..425101b3420 100644 --- a/src/locale/index.ts +++ b/src/locale/index.ts @@ -6,6 +6,7 @@ import { faker as fakerAF_ZA } from './af_ZA'; import { faker as fakerAR } from './ar'; import { faker as fakerAZ } from './az'; +import { faker as fakerBASE } from './base'; import { faker as fakerCZ } from './cz'; import { faker as fakerDE } from './de'; import { faker as fakerDE_AT } from './de_AT'; @@ -68,6 +69,7 @@ export { fakerAF_ZA, fakerAR, fakerAZ, + fakerBASE, fakerCZ, fakerDE, fakerDE_AT, @@ -131,6 +133,7 @@ export const allFakers = { af_ZA: fakerAF_ZA, ar: fakerAR, az: fakerAZ, + base: fakerBASE, cz: fakerCZ, de: fakerDE, de_AT: fakerDE_AT, diff --git a/src/locale/it.ts b/src/locale/it.ts index bff0a521691..4dc16ac1419 100644 --- a/src/locale/it.ts +++ b/src/locale/it.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import it from '../locales/it'; export const faker = new Faker({ - locale: [it, en], + locale: [it, en, base], }); diff --git a/src/locale/ja.ts b/src/locale/ja.ts index 8a9a866c08c..1a204077ff2 100644 --- a/src/locale/ja.ts +++ b/src/locale/ja.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import ja from '../locales/ja'; export const faker = new Faker({ - locale: [ja, en], + locale: [ja, en, base], }); diff --git a/src/locale/ko.ts b/src/locale/ko.ts index eaa9e3ff156..baf5593d98c 100644 --- a/src/locale/ko.ts +++ b/src/locale/ko.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import ko from '../locales/ko'; export const faker = new Faker({ - locale: [ko, en], + locale: [ko, en, base], }); diff --git a/src/locale/lv.ts b/src/locale/lv.ts index dc9f432729c..486d5e16dfb 100644 --- a/src/locale/lv.ts +++ b/src/locale/lv.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import lv from '../locales/lv'; export const faker = new Faker({ - locale: [lv, en], + locale: [lv, en, base], }); diff --git a/src/locale/mk.ts b/src/locale/mk.ts index 18981c46d7c..18c2562b61c 100644 --- a/src/locale/mk.ts +++ b/src/locale/mk.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import mk from '../locales/mk'; export const faker = new Faker({ - locale: [mk, en], + locale: [mk, en, base], }); diff --git a/src/locale/nb_NO.ts b/src/locale/nb_NO.ts index 3dcc5a5cc31..d1d417b6452 100644 --- a/src/locale/nb_NO.ts +++ b/src/locale/nb_NO.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import nb_NO from '../locales/nb_NO'; export const faker = new Faker({ - locale: [nb_NO, en], + locale: [nb_NO, en, base], }); diff --git a/src/locale/ne.ts b/src/locale/ne.ts index e75adb0c0a8..4343180be4a 100644 --- a/src/locale/ne.ts +++ b/src/locale/ne.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import ne from '../locales/ne'; export const faker = new Faker({ - locale: [ne, en], + locale: [ne, en, base], }); diff --git a/src/locale/nl.ts b/src/locale/nl.ts index 3965b754bd8..19768256062 100644 --- a/src/locale/nl.ts +++ b/src/locale/nl.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import nl from '../locales/nl'; export const faker = new Faker({ - locale: [nl, en], + locale: [nl, en, base], }); diff --git a/src/locale/nl_BE.ts b/src/locale/nl_BE.ts index 4b6cb7aac83..55c24d0a256 100644 --- a/src/locale/nl_BE.ts +++ b/src/locale/nl_BE.ts @@ -4,10 +4,11 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import nl from '../locales/nl'; import nl_BE from '../locales/nl_BE'; export const faker = new Faker({ - locale: [nl_BE, nl, en], + locale: [nl_BE, nl, en, base], }); diff --git a/src/locale/pl.ts b/src/locale/pl.ts index 875ac5ec9d9..86cec2e83e3 100644 --- a/src/locale/pl.ts +++ b/src/locale/pl.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import pl from '../locales/pl'; export const faker = new Faker({ - locale: [pl, en], + locale: [pl, en, base], }); diff --git a/src/locale/pt_BR.ts b/src/locale/pt_BR.ts index 5a4725d4881..31617b6cc59 100644 --- a/src/locale/pt_BR.ts +++ b/src/locale/pt_BR.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import pt_BR from '../locales/pt_BR'; export const faker = new Faker({ - locale: [pt_BR, en], + locale: [pt_BR, en, base], }); diff --git a/src/locale/pt_PT.ts b/src/locale/pt_PT.ts index 675e9adaf29..b8a1298b6de 100644 --- a/src/locale/pt_PT.ts +++ b/src/locale/pt_PT.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import pt_PT from '../locales/pt_PT'; export const faker = new Faker({ - locale: [pt_PT, en], + locale: [pt_PT, en, base], }); diff --git a/src/locale/ro.ts b/src/locale/ro.ts index b9b36836bac..94d593ed03c 100644 --- a/src/locale/ro.ts +++ b/src/locale/ro.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import ro from '../locales/ro'; export const faker = new Faker({ - locale: [ro, en], + locale: [ro, en, base], }); diff --git a/src/locale/ru.ts b/src/locale/ru.ts index 3e3602554de..f97df2216c9 100644 --- a/src/locale/ru.ts +++ b/src/locale/ru.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import ru from '../locales/ru'; export const faker = new Faker({ - locale: [ru, en], + locale: [ru, en, base], }); diff --git a/src/locale/sk.ts b/src/locale/sk.ts index 8f6573a9a6d..59271d5a7a4 100644 --- a/src/locale/sk.ts +++ b/src/locale/sk.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import sk from '../locales/sk'; export const faker = new Faker({ - locale: [sk, en], + locale: [sk, en, base], }); diff --git a/src/locale/sr_RS_latin.ts b/src/locale/sr_RS_latin.ts index 582c1b845a4..692928f83be 100644 --- a/src/locale/sr_RS_latin.ts +++ b/src/locale/sr_RS_latin.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import sr_RS_latin from '../locales/sr_RS_latin'; export const faker = new Faker({ - locale: [sr_RS_latin, en], + locale: [sr_RS_latin, en, base], }); diff --git a/src/locale/sv.ts b/src/locale/sv.ts index b459b35d91b..1df3eb173c6 100644 --- a/src/locale/sv.ts +++ b/src/locale/sv.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import sv from '../locales/sv'; export const faker = new Faker({ - locale: [sv, en], + locale: [sv, en, base], }); diff --git a/src/locale/tr.ts b/src/locale/tr.ts index 303089520fe..ee359ae5260 100644 --- a/src/locale/tr.ts +++ b/src/locale/tr.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import tr from '../locales/tr'; export const faker = new Faker({ - locale: [tr, en], + locale: [tr, en, base], }); diff --git a/src/locale/uk.ts b/src/locale/uk.ts index fe35122d321..8a6db1f723a 100644 --- a/src/locale/uk.ts +++ b/src/locale/uk.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import uk from '../locales/uk'; export const faker = new Faker({ - locale: [uk, en], + locale: [uk, en, base], }); diff --git a/src/locale/ur.ts b/src/locale/ur.ts index dd853d28afd..f7f5bf20215 100644 --- a/src/locale/ur.ts +++ b/src/locale/ur.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import ur from '../locales/ur'; export const faker = new Faker({ - locale: [ur, en], + locale: [ur, en, base], }); diff --git a/src/locale/vi.ts b/src/locale/vi.ts index 2525260a4df..8ec561a8f26 100644 --- a/src/locale/vi.ts +++ b/src/locale/vi.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import vi from '../locales/vi'; export const faker = new Faker({ - locale: [vi, en], + locale: [vi, en, base], }); diff --git a/src/locale/zh_CN.ts b/src/locale/zh_CN.ts index 11c632652db..8a6a4073f3d 100644 --- a/src/locale/zh_CN.ts +++ b/src/locale/zh_CN.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import zh_CN from '../locales/zh_CN'; export const faker = new Faker({ - locale: [zh_CN, en], + locale: [zh_CN, en, base], }); diff --git a/src/locale/zh_TW.ts b/src/locale/zh_TW.ts index 7eefd1b6e83..00df2c62fdb 100644 --- a/src/locale/zh_TW.ts +++ b/src/locale/zh_TW.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import zh_TW from '../locales/zh_TW'; export const faker = new Faker({ - locale: [zh_TW, en], + locale: [zh_TW, en, base], }); diff --git a/src/locale/zu_ZA.ts b/src/locale/zu_ZA.ts index 145ff94a684..5da3d828b5e 100644 --- a/src/locale/zu_ZA.ts +++ b/src/locale/zu_ZA.ts @@ -4,9 +4,10 @@ */ import { Faker } from '../faker'; +import base from '../locales/base'; import en from '../locales/en'; import zu_ZA from '../locales/zu_ZA'; export const faker = new Faker({ - locale: [zu_ZA, en], + locale: [zu_ZA, en, base], }); diff --git a/src/locales/base/color/index.ts b/src/locales/base/color/index.ts new file mode 100644 index 00000000000..6518bf19557 --- /dev/null +++ b/src/locales/base/color/index.ts @@ -0,0 +1,12 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { ColorDefinitions } from '../../..'; +import space from './space'; + +const color: ColorDefinitions = { + space, +}; + +export default color; diff --git a/src/locales/en/color/space.ts b/src/locales/base/color/space.ts similarity index 100% rename from src/locales/en/color/space.ts rename to src/locales/base/color/space.ts diff --git a/src/locales/en/database/collation.ts b/src/locales/base/database/collation.ts similarity index 100% rename from src/locales/en/database/collation.ts rename to src/locales/base/database/collation.ts diff --git a/src/locales/en/database/engine.ts b/src/locales/base/database/engine.ts similarity index 100% rename from src/locales/en/database/engine.ts rename to src/locales/base/database/engine.ts diff --git a/src/locales/base/database/index.ts b/src/locales/base/database/index.ts new file mode 100644 index 00000000000..3dfe9b32f8d --- /dev/null +++ b/src/locales/base/database/index.ts @@ -0,0 +1,16 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { DatabaseDefinitions } from '../../..'; +import collation from './collation'; +import engine from './engine'; +import type_ from './type'; + +const database: DatabaseDefinitions = { + collation, + engine, + type: type_, +}; + +export default database; diff --git a/src/locales/en/database/type.ts b/src/locales/base/database/type.ts similarity index 100% rename from src/locales/en/database/type.ts rename to src/locales/base/database/type.ts diff --git a/src/locales/en/hacker/abbreviation.ts b/src/locales/base/hacker/abbreviation.ts similarity index 100% rename from src/locales/en/hacker/abbreviation.ts rename to src/locales/base/hacker/abbreviation.ts diff --git a/src/locales/base/hacker/index.ts b/src/locales/base/hacker/index.ts new file mode 100644 index 00000000000..88450a37bea --- /dev/null +++ b/src/locales/base/hacker/index.ts @@ -0,0 +1,12 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { HackerDefinitions } from '../../..'; +import abbreviation from './abbreviation'; + +const hacker: HackerDefinitions = { + abbreviation, +}; + +export default hacker; diff --git a/src/locales/base/index.ts b/src/locales/base/index.ts new file mode 100644 index 00000000000..3f776d53e80 --- /dev/null +++ b/src/locales/base/index.ts @@ -0,0 +1,23 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { LocaleDefinition } from '../..'; +import color from './color'; +import database from './database'; +import hacker from './hacker'; +import internet from './internet'; +import location from './location'; +import system from './system'; + +const base: LocaleDefinition = { + title: 'Base', + color, + database, + hacker, + internet, + location, + system, +}; + +export default base; diff --git a/src/locales/en/internet/emoji.ts b/src/locales/base/internet/emoji.ts similarity index 100% rename from src/locales/en/internet/emoji.ts rename to src/locales/base/internet/emoji.ts diff --git a/src/locales/en/internet/http_status_code.ts b/src/locales/base/internet/http_status_code.ts similarity index 100% rename from src/locales/en/internet/http_status_code.ts rename to src/locales/base/internet/http_status_code.ts diff --git a/src/locales/base/internet/index.ts b/src/locales/base/internet/index.ts new file mode 100644 index 00000000000..94743bc08f2 --- /dev/null +++ b/src/locales/base/internet/index.ts @@ -0,0 +1,14 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { InternetDefinitions } from '../../..'; +import emoji from './emoji'; +import http_status_code from './http_status_code'; + +const internet: InternetDefinitions = { + emoji, + http_status_code, +}; + +export default internet; diff --git a/src/locales/en/location/country_code.ts b/src/locales/base/location/country_code.ts similarity index 100% rename from src/locales/en/location/country_code.ts rename to src/locales/base/location/country_code.ts diff --git a/src/locales/base/location/index.ts b/src/locales/base/location/index.ts new file mode 100644 index 00000000000..93d8f0fc8c0 --- /dev/null +++ b/src/locales/base/location/index.ts @@ -0,0 +1,14 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { LocationDefinitions } from '../../..'; +import country_code from './country_code'; +import time_zone from './time_zone'; + +const location: LocationDefinitions = { + country_code, + time_zone, +}; + +export default location; diff --git a/src/locales/en/location/time_zone.ts b/src/locales/base/location/time_zone.ts similarity index 100% rename from src/locales/en/location/time_zone.ts rename to src/locales/base/location/time_zone.ts diff --git a/src/locales/en/system/directoryPaths.ts b/src/locales/base/system/directoryPaths.ts similarity index 100% rename from src/locales/en/system/directoryPaths.ts rename to src/locales/base/system/directoryPaths.ts diff --git a/src/locales/en/system/index.ts b/src/locales/base/system/index.ts similarity index 100% rename from src/locales/en/system/index.ts rename to src/locales/base/system/index.ts diff --git a/src/locales/en/system/mimeTypes.ts b/src/locales/base/system/mimeTypes.ts similarity index 100% rename from src/locales/en/system/mimeTypes.ts rename to src/locales/base/system/mimeTypes.ts diff --git a/src/locales/en/color/index.ts b/src/locales/en/color/index.ts index 2f84c198438..79cc39f02f3 100644 --- a/src/locales/en/color/index.ts +++ b/src/locales/en/color/index.ts @@ -4,11 +4,9 @@ */ import type { ColorDefinitions } from '../../..'; import human from './human'; -import space from './space'; const color: ColorDefinitions = { human, - space, }; export default color; diff --git a/src/locales/en/database/index.ts b/src/locales/en/database/index.ts index 0fdb916369e..29fa3097938 100644 --- a/src/locales/en/database/index.ts +++ b/src/locales/en/database/index.ts @@ -3,16 +3,10 @@ * Run 'pnpm run generate:locales' to update. */ import type { DatabaseDefinitions } from '../../..'; -import collation from './collation'; import column from './column'; -import engine from './engine'; -import type_ from './type'; const database: DatabaseDefinitions = { - collation, column, - engine, - type: type_, }; export default database; diff --git a/src/locales/en/hacker/index.ts b/src/locales/en/hacker/index.ts index aa45642882b..97e12d5d1f0 100644 --- a/src/locales/en/hacker/index.ts +++ b/src/locales/en/hacker/index.ts @@ -3,7 +3,6 @@ * Run 'pnpm run generate:locales' to update. */ import type { HackerDefinitions } from '../../..'; -import abbreviation from './abbreviation'; import adjective from './adjective'; import ingverb from './ingverb'; import noun from './noun'; @@ -11,7 +10,6 @@ import phrase from './phrase'; import verb from './verb'; const hacker: HackerDefinitions = { - abbreviation, adjective, ingverb, noun, diff --git a/src/locales/en/index.ts b/src/locales/en/index.ts index 2ac4c15d470..3498308af69 100644 --- a/src/locales/en/index.ts +++ b/src/locales/en/index.ts @@ -22,7 +22,6 @@ import music from './music'; import person from './person'; import phone_number from './phone_number'; import science from './science'; -import system from './system'; import team from './team'; import vehicle from './vehicle'; import word from './word'; @@ -48,7 +47,6 @@ const en: LocaleDefinition = { person, phone_number, science, - system, team, vehicle, word, diff --git a/src/locales/en/internet/index.ts b/src/locales/en/internet/index.ts index 6ee266fbb74..7dd7014c7de 100644 --- a/src/locales/en/internet/index.ts +++ b/src/locales/en/internet/index.ts @@ -5,18 +5,14 @@ import type { InternetDefinitions } from '../../..'; import avatar_uri from './avatar_uri'; import domain_suffix from './domain_suffix'; -import emoji from './emoji'; import example_email from './example_email'; import free_email from './free_email'; -import http_status_code from './http_status_code'; const internet: InternetDefinitions = { avatar_uri, domain_suffix, - emoji, example_email, free_email, - http_status_code, }; export default internet; diff --git a/src/locales/en/location/index.ts b/src/locales/en/location/index.ts index e1f68cf9530..397bee86628 100644 --- a/src/locales/en/location/index.ts +++ b/src/locales/en/location/index.ts @@ -9,7 +9,6 @@ import city_name from './city_name'; import city_prefix from './city_prefix'; import city_suffix from './city_suffix'; import country from './country'; -import country_code from './country_code'; import county from './county'; import default_country from './default_country'; import direction from './direction'; @@ -21,7 +20,6 @@ import state_abbr from './state_abbr'; import street from './street'; import street_address from './street_address'; import street_suffix from './street_suffix'; -import time_zone from './time_zone'; const location: LocationDefinitions = { building_number, @@ -30,7 +28,6 @@ const location: LocationDefinitions = { city_prefix, city_suffix, country, - country_code, county, default_country, direction, @@ -42,7 +39,6 @@ const location: LocationDefinitions = { street, street_address, street_suffix, - time_zone, }; export default location; diff --git a/src/locales/index.ts b/src/locales/index.ts index a0259fe004f..c974e419f96 100644 --- a/src/locales/index.ts +++ b/src/locales/index.ts @@ -6,6 +6,7 @@ export { default as af_ZA } from './af_ZA'; export { default as ar } from './ar'; export { default as az } from './az'; +export { default as base } from './base'; export { default as cz } from './cz'; export { default as de } from './de'; export { default as de_AT } from './de_AT'; diff --git a/test/all_functional.spec.ts b/test/all_functional.spec.ts index 542b01ee6b8..872629eaa1b 100644 --- a/test/all_functional.spec.ts +++ b/test/all_functional.spec.ts @@ -109,6 +109,11 @@ describe('BROKEN_LOCALE_METHODS test', () => { describe('functional tests', () => { for (const [locale, faker] of Object.entries(allFakers)) { describe(locale, () => { + if (locale === 'base') { + it.skip('base locale is checked by other tests'); + return; + } + Object.keys(modules).forEach((module) => { describe(module, () => { modules[module].forEach((meth) => { @@ -142,6 +147,11 @@ describe('functional tests', () => { describe('faker.helpers.fake functional tests', () => { for (const [locale, faker] of Object.entries(allFakers)) { describe(locale, () => { + if (locale === 'base') { + it.skip('base locale is checked by other tests'); + return; + } + Object.keys(modules).forEach((module) => { describe(module, () => { modules[module].forEach((meth) => { diff --git a/test/internet.spec.ts b/test/internet.spec.ts index 53c25a8167f..204234c6a80 100644 --- a/test/internet.spec.ts +++ b/test/internet.spec.ts @@ -185,7 +185,11 @@ describe('internet', () => { it.each(Object.entries(allFakers))( 'should return a valid email in %s', - (_, localeFaker) => { + (locale, localeFaker) => { + if (locale === 'base') { + return; + } + const email = localeFaker.internet.email(); expect(email).toBeTruthy(); From bbf65d89a46be9f70c1ae250d62140044404dbcc Mon Sep 17 00:00:00 2001 From: Matt Mayer <152770+matthewmayer@users.noreply.github.com> Date: Wed, 29 Mar 2023 16:12:21 +0700 Subject: [PATCH 4/9] chore(locale): change uk_country to state (#1989) --- src/locales/en_GB/location/index.ts | 4 ++-- src/locales/en_GB/location/{uk_country.ts => state.ts} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename src/locales/en_GB/location/{uk_country.ts => state.ts} (100%) diff --git a/src/locales/en_GB/location/index.ts b/src/locales/en_GB/location/index.ts index 6039d1ae2b8..a4c8822b40e 100644 --- a/src/locales/en_GB/location/index.ts +++ b/src/locales/en_GB/location/index.ts @@ -11,9 +11,9 @@ import city_suffix from './city_suffix'; import county from './county'; import default_country from './default_country'; import postcode from './postcode'; +import state from './state'; import street from './street'; import street_suffix from './street_suffix'; -import uk_country from './uk_country'; const location: LocationDefinitions = { building_number, @@ -24,9 +24,9 @@ const location: LocationDefinitions = { county, default_country, postcode, + state, street, street_suffix, - uk_country, }; export default location; diff --git a/src/locales/en_GB/location/uk_country.ts b/src/locales/en_GB/location/state.ts similarity index 100% rename from src/locales/en_GB/location/uk_country.ts rename to src/locales/en_GB/location/state.ts From 2c9e0b8cfa2fea4f861be019ad23d11ff36613cf Mon Sep 17 00:00:00 2001 From: Matt Mayer <152770+matthewmayer@users.noreply.github.com> Date: Wed, 29 Mar 2023 16:21:02 +0700 Subject: [PATCH 5/9] docs(location): improve documentation for state and county (#1987) --- src/definitions/location.ts | 6 +++--- src/modules/location/index.ts | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/definitions/location.ts b/src/definitions/location.ts index c0f6dfa94a8..6987327dbac 100644 --- a/src/definitions/location.ts +++ b/src/definitions/location.ts @@ -45,17 +45,17 @@ export type LocationDefinitions = LocaleEntry<{ country_code: Array<{ alpha2: string; alpha3: string }>; /** - * The names of this country's states. + * The names of this country's states, or other first-level administrative areas. */ state: string[]; /** - * The abbreviated names of this country's states. + * The abbreviated names of this country's states, or other first-level administrative areas. */ state_abbr: string[]; /** - * The names of counties inside the country or state. + * The names of counties, or other second-level administrative areas, inside the country's states. */ county: string[]; diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts index fb902588eb3..37d8f14f098 100644 --- a/src/modules/location/index.ts +++ b/src/modules/location/index.ts @@ -228,10 +228,10 @@ export class LocationModule { } /** - * Returns a random localized county. + * Returns a random localized county, or other equivalent second-level administrative entity for the locale's country such as a district or department. * * @example - * faker.location.county() // 'Cambridgeshire' + * fakerEN_GB.location.county() // 'Cambridgeshire' * * @since 8.0.0 */ @@ -297,10 +297,12 @@ export class LocationModule { } /** - * Returns a random localized state from this country. + * Returns a random localized state, or other equivalent first-level administrative entity for the locale's country such as a province or region. * * @example - * faker.location.state() // 'Georgia' + * faker.location.state() // 'Mississippi' + * fakerEN_CA.location.state() // 'Saskatchewan' + * fakerDE.location.state() // 'Nordrhein-Westfalen' * * @since 8.0.0 */ From 88e561a5490003a41665eb007c5c28ff0800ae09 Mon Sep 17 00:00:00 2001 From: Matt Mayer <152770+matthewmayer@users.noreply.github.com> Date: Wed, 29 Mar 2023 16:28:56 +0700 Subject: [PATCH 6/9] feat(locale): add fi states (#1986) --- src/locales/fi/index.ts | 2 ++ src/locales/fi/location/index.ts | 12 ++++++++++++ src/locales/fi/location/state.ts | 21 +++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 src/locales/fi/location/index.ts create mode 100644 src/locales/fi/location/state.ts diff --git a/src/locales/fi/index.ts b/src/locales/fi/index.ts index 3aa71040c32..2b14dc0675d 100644 --- a/src/locales/fi/index.ts +++ b/src/locales/fi/index.ts @@ -3,10 +3,12 @@ * Run 'pnpm run generate:locales' to update. */ import type { LocaleDefinition } from '../..'; +import location from './location'; import person from './person'; const fi: LocaleDefinition = { title: 'Finnish', + location, person, }; diff --git a/src/locales/fi/location/index.ts b/src/locales/fi/location/index.ts new file mode 100644 index 00000000000..f6b9a5dd0b6 --- /dev/null +++ b/src/locales/fi/location/index.ts @@ -0,0 +1,12 @@ +/* + * This file is automatically generated. + * Run 'pnpm run generate:locales' to update. + */ +import type { LocationDefinitions } from '../../..'; +import state from './state'; + +const location: LocationDefinitions = { + state, +}; + +export default location; diff --git a/src/locales/fi/location/state.ts b/src/locales/fi/location/state.ts new file mode 100644 index 00000000000..4294fd4758e --- /dev/null +++ b/src/locales/fi/location/state.ts @@ -0,0 +1,21 @@ +export default [ + 'Ahvenanmaa', + 'Etelä-Karjala', + 'Etelä-Pohjanmaa', + 'Etelä-Savo', + 'Kainuu', + 'Kanta-Häme', + 'Keski-Pohjanmaa', + 'Keski-Suomi', + 'Kymenlaakso', + 'Lappi', + 'Päijät-Häme', + 'Pirkanmaa', + 'Pohjanmaa', + 'Pohjois-Karjala', + 'Pohjois-Pohjanmaa', + 'Pohjois-Savo', + 'Satakunta', + 'Uusimaa', + 'Varsinais-Suomi', +]; From 3562e872530b3610d95be71aa6f4f7fdfef7134f Mon Sep 17 00:00:00 2001 From: Matt Mayer <152770+matthewmayer@users.noreply.github.com> Date: Wed, 29 Mar 2023 20:36:46 +0700 Subject: [PATCH 7/9] docs: add overview guides to specific modules (#1929) --- docs/api/ApiIndex.vue | 12 +++++++----- scripts/apidoc/moduleMethods.ts | 4 ++-- scripts/apidoc/signature.ts | 4 ++++ src/modules/airline/index.ts | 16 +++++++++++++++- src/modules/animal/index.ts | 8 ++++++++ src/modules/color/index.ts | 6 ++++++ src/modules/commerce/index.ts | 8 ++++++++ src/modules/company/index.ts | 11 +++++++++++ src/modules/database/index.ts | 6 ++++++ src/modules/datatype/index.ts | 6 ++++++ src/modules/date/index.ts | 12 ++++++++++++ src/modules/finance/index.ts | 12 +++++++++++- src/modules/git/index.ts | 4 ++++ src/modules/hacker/index.ts | 12 ++++++++++++ src/modules/helpers/index.ts | 8 ++++++++ src/modules/image/index.ts | 10 ++++++++++ src/modules/internet/index.ts | 10 ++++++++++ src/modules/location/index.ts | 10 +++++++++- src/modules/lorem/index.ts | 8 ++++++++ src/modules/music/index.ts | 4 ++++ src/modules/number/index.ts | 11 +++++++++++ src/modules/person/index.ts | 19 ++++++++++++++++++- src/modules/phone/index.ts | 4 ++++ src/modules/random/index.ts | 4 ++++ src/modules/science/index.ts | 4 ++++ src/modules/string/index.ts | 13 +++++++++++++ src/modules/vehicle/index.ts | 6 ++++++ 27 files changed, 221 insertions(+), 11 deletions(-) diff --git a/docs/api/ApiIndex.vue b/docs/api/ApiIndex.vue index 0d421775dcf..55efaeca6c6 100644 --- a/docs/api/ApiIndex.vue +++ b/docs/api/ApiIndex.vue @@ -96,7 +96,9 @@ onUnmounted(() => window.removeEventListener('keydown', apiSearchFocusHandler));

{{ section.text }}

-

{{ item.text }}

+

+ {{ item.text }} +