From 7d51a4dd2901e49190becc8f1ba72822a86edd10 Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Tue, 3 May 2022 09:21:27 +0200 Subject: [PATCH 1/9] refactor: reorganize src folder --- src/faker.ts | 2 +- src/{ => modules}/address.ts | 2 +- src/{ => modules}/animal.ts | 0 src/{ => modules}/commerce.ts | 0 src/{ => modules}/company.ts | 0 src/{ => modules}/database.ts | 0 src/{ => modules}/datatype.ts | 0 src/{ => modules}/date.ts | 0 src/{ => modules}/fake.ts | 0 src/{ => modules}/finance.ts | 0 src/{ => modules}/git.ts | 0 src/{ => modules}/hacker.ts | 0 src/{ => modules}/helpers.ts | 0 src/{ => modules}/image.ts | 0 src/{ => modules}/internet.ts | 0 src/{ => modules}/lorem.ts | 0 src/{ => modules}/mersenne.ts | 0 src/{ => modules}/music.ts | 0 src/{ => modules}/name.ts | 0 src/{ => modules}/phone.ts | 0 src/{ => modules}/random.ts | 0 src/{ => modules}/system.ts | 0 src/{ => modules}/time.ts | 0 src/{ => modules}/unique.ts | 0 src/{ => modules}/vehicle.ts | 0 src/{ => modules}/word.ts | 0 26 files changed, 2 insertions(+), 2 deletions(-) rename src/{ => modules}/address.ts (99%) rename src/{ => modules}/animal.ts (100%) rename src/{ => modules}/commerce.ts (100%) rename src/{ => modules}/company.ts (100%) rename src/{ => modules}/database.ts (100%) rename src/{ => modules}/datatype.ts (100%) rename src/{ => modules}/date.ts (100%) rename src/{ => modules}/fake.ts (100%) rename src/{ => modules}/finance.ts (100%) rename src/{ => modules}/git.ts (100%) rename src/{ => modules}/hacker.ts (100%) rename src/{ => modules}/helpers.ts (100%) rename src/{ => modules}/image.ts (100%) rename src/{ => modules}/internet.ts (100%) rename src/{ => modules}/lorem.ts (100%) rename src/{ => modules}/mersenne.ts (100%) rename src/{ => modules}/music.ts (100%) rename src/{ => modules}/name.ts (100%) rename src/{ => modules}/phone.ts (100%) rename src/{ => modules}/random.ts (100%) rename src/{ => modules}/system.ts (100%) rename src/{ => modules}/time.ts (100%) rename src/{ => modules}/unique.ts (100%) rename src/{ => modules}/vehicle.ts (100%) rename src/{ => modules}/word.ts (100%) diff --git a/src/faker.ts b/src/faker.ts index 5ae0bd9c4a3..e62e961776d 100644 --- a/src/faker.ts +++ b/src/faker.ts @@ -1,4 +1,3 @@ -import { Address } from './address'; import { Animal } from './animal'; import { Commerce } from './commerce'; import { Company } from './company'; @@ -19,6 +18,7 @@ import { Internet } from './internet'; import type { KnownLocale } from './locales'; import { Lorem } from './lorem'; import { Mersenne } from './mersenne'; +import { Address } from './modules/address'; import { Music } from './music'; import { Name } from './name'; import { Phone } from './phone'; diff --git a/src/address.ts b/src/modules/address.ts similarity index 99% rename from src/address.ts rename to src/modules/address.ts index e077acaa127..2e35f36f7de 100644 --- a/src/address.ts +++ b/src/modules/address.ts @@ -1,4 +1,4 @@ -import type { Faker } from '.'; +import type { Faker } from '..'; /** * Module to generate addresses and locations. diff --git a/src/animal.ts b/src/modules/animal.ts similarity index 100% rename from src/animal.ts rename to src/modules/animal.ts diff --git a/src/commerce.ts b/src/modules/commerce.ts similarity index 100% rename from src/commerce.ts rename to src/modules/commerce.ts diff --git a/src/company.ts b/src/modules/company.ts similarity index 100% rename from src/company.ts rename to src/modules/company.ts diff --git a/src/database.ts b/src/modules/database.ts similarity index 100% rename from src/database.ts rename to src/modules/database.ts diff --git a/src/datatype.ts b/src/modules/datatype.ts similarity index 100% rename from src/datatype.ts rename to src/modules/datatype.ts diff --git a/src/date.ts b/src/modules/date.ts similarity index 100% rename from src/date.ts rename to src/modules/date.ts diff --git a/src/fake.ts b/src/modules/fake.ts similarity index 100% rename from src/fake.ts rename to src/modules/fake.ts diff --git a/src/finance.ts b/src/modules/finance.ts similarity index 100% rename from src/finance.ts rename to src/modules/finance.ts diff --git a/src/git.ts b/src/modules/git.ts similarity index 100% rename from src/git.ts rename to src/modules/git.ts diff --git a/src/hacker.ts b/src/modules/hacker.ts similarity index 100% rename from src/hacker.ts rename to src/modules/hacker.ts diff --git a/src/helpers.ts b/src/modules/helpers.ts similarity index 100% rename from src/helpers.ts rename to src/modules/helpers.ts diff --git a/src/image.ts b/src/modules/image.ts similarity index 100% rename from src/image.ts rename to src/modules/image.ts diff --git a/src/internet.ts b/src/modules/internet.ts similarity index 100% rename from src/internet.ts rename to src/modules/internet.ts diff --git a/src/lorem.ts b/src/modules/lorem.ts similarity index 100% rename from src/lorem.ts rename to src/modules/lorem.ts diff --git a/src/mersenne.ts b/src/modules/mersenne.ts similarity index 100% rename from src/mersenne.ts rename to src/modules/mersenne.ts diff --git a/src/music.ts b/src/modules/music.ts similarity index 100% rename from src/music.ts rename to src/modules/music.ts diff --git a/src/name.ts b/src/modules/name.ts similarity index 100% rename from src/name.ts rename to src/modules/name.ts diff --git a/src/phone.ts b/src/modules/phone.ts similarity index 100% rename from src/phone.ts rename to src/modules/phone.ts diff --git a/src/random.ts b/src/modules/random.ts similarity index 100% rename from src/random.ts rename to src/modules/random.ts diff --git a/src/system.ts b/src/modules/system.ts similarity index 100% rename from src/system.ts rename to src/modules/system.ts diff --git a/src/time.ts b/src/modules/time.ts similarity index 100% rename from src/time.ts rename to src/modules/time.ts diff --git a/src/unique.ts b/src/modules/unique.ts similarity index 100% rename from src/unique.ts rename to src/modules/unique.ts diff --git a/src/vehicle.ts b/src/modules/vehicle.ts similarity index 100% rename from src/vehicle.ts rename to src/modules/vehicle.ts diff --git a/src/word.ts b/src/modules/word.ts similarity index 100% rename from src/word.ts rename to src/modules/word.ts From ee161ef6c8064085e02d59b192b9a5f859d74791 Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Tue, 3 May 2022 09:31:29 +0200 Subject: [PATCH 2/9] refactor: fix src imports --- scripts/bundle.ts | 4 ++-- src/definitions/internet.ts | 2 +- src/faker.ts | 48 ++++++++++++++++++------------------- src/index.ts | 4 ++-- src/modules/animal.ts | 2 +- src/modules/commerce.ts | 2 +- src/modules/company.ts | 2 +- src/modules/database.ts | 2 +- src/modules/datatype.ts | 6 ++--- src/modules/date.ts | 4 ++-- src/modules/fake.ts | 4 ++-- src/modules/finance.ts | 6 ++--- src/modules/git.ts | 2 +- src/modules/hacker.ts | 2 +- src/modules/helpers.ts | 4 ++-- src/modules/image.ts | 10 ++++---- src/modules/internet.ts | 4 ++-- src/modules/lorem.ts | 2 +- src/modules/mersenne.ts | 4 ++-- src/modules/music.ts | 2 +- src/modules/name.ts | 4 ++-- src/modules/phone.ts | 2 +- src/modules/random.ts | 6 ++--- src/modules/system.ts | 2 +- src/modules/time.ts | 4 ++-- src/modules/unique.ts | 6 ++--- src/modules/vehicle.ts | 2 +- src/modules/word.ts | 2 +- 28 files changed, 72 insertions(+), 72 deletions(-) diff --git a/scripts/bundle.ts b/scripts/bundle.ts index e831601a675..57b26807b41 100644 --- a/scripts/bundle.ts +++ b/scripts/bundle.ts @@ -25,7 +25,7 @@ buildSync({ // entryPoints: [ // './src/index.ts', // ...Object.keys(locales).map((locale) => `./src/locale/${locale}.ts`), - // './src/mersenne.ts', + // './src/modules/mersenne.ts', // ], outdir: './dist/cjs', bundle: false, // Creates 390MiB bundle ... @@ -42,7 +42,7 @@ buildSync({ entryPoints: [ './src/index.ts', ...Object.keys(locales).map((locale) => `./src/locale/${locale}.ts`), - './src/mersenne.ts', + './src/modules/mersenne.ts', ], outdir: './dist/esm', bundle: true, diff --git a/src/definitions/internet.ts b/src/definitions/internet.ts index 562f77e9e8c..f57df2421e3 100644 --- a/src/definitions/internet.ts +++ b/src/definitions/internet.ts @@ -1,4 +1,4 @@ -import type { EmojiType } from '../internet'; +import type { EmojiType } from '../modules/internet'; import { allOf } from './utils'; /** diff --git a/src/faker.ts b/src/faker.ts index e62e961776d..a6881944834 100644 --- a/src/faker.ts +++ b/src/faker.ts @@ -1,33 +1,33 @@ -import { Animal } from './animal'; -import { Commerce } from './commerce'; -import { Company } from './company'; -import { Database } from './database'; -import { Datatype } from './datatype'; -import { _Date } from './date'; import type { LocaleDefinition } from './definitions'; import { DEFINITIONS } from './definitions'; import { FakerError } from './errors/faker-error'; -import { Fake } from './fake'; -import { Finance } from './finance'; -import { Git } from './git'; -import { Hacker } from './hacker'; -import { Helpers } from './helpers'; -import { Image } from './image'; import { deprecated } from './internal/deprecated'; -import { Internet } from './internet'; import type { KnownLocale } from './locales'; -import { Lorem } from './lorem'; -import { Mersenne } from './mersenne'; import { Address } from './modules/address'; -import { Music } from './music'; -import { Name } from './name'; -import { Phone } from './phone'; -import { Random } from './random'; -import { System } from './system'; -import { Time } from './time'; -import { Unique } from './unique'; -import { Vehicle } from './vehicle'; -import { Word } from './word'; +import { Animal } from './modules/animal'; +import { Commerce } from './modules/commerce'; +import { Company } from './modules/company'; +import { Database } from './modules/database'; +import { Datatype } from './modules/datatype'; +import { _Date } from './modules/date'; +import { Fake } from './modules/fake'; +import { Finance } from './modules/finance'; +import { Git } from './modules/git'; +import { Hacker } from './modules/hacker'; +import { Helpers } from './modules/helpers'; +import { Image } from './modules/image'; +import { Internet } from './modules/internet'; +import { Lorem } from './modules/lorem'; +import { Mersenne } from './modules/mersenne'; +import { Music } from './modules/music'; +import { Name } from './modules/name'; +import { Phone } from './modules/phone'; +import { Random } from './modules/random'; +import { System } from './modules/system'; +import { Time } from './modules/time'; +import { Unique } from './modules/unique'; +import { Vehicle } from './modules/vehicle'; +import { Word } from './modules/word'; // https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609 export type LiteralUnion = diff --git a/src/index.ts b/src/index.ts index 984833f5625..8a1d415e46b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -28,8 +28,8 @@ export type { } from './definitions'; export { FakerError } from './errors/faker-error'; export type { FakerOptions, UsableLocale, UsedLocales } from './faker'; -export { Gender } from './name'; -export type { GenderType } from './name'; +export { Gender } from './modules/name'; +export type { GenderType } from './modules/name'; export { Faker }; // since we are requiring the top level of faker, load all locales by default diff --git a/src/modules/animal.ts b/src/modules/animal.ts index 6a1d10a214d..edd96c7e838 100644 --- a/src/modules/animal.ts +++ b/src/modules/animal.ts @@ -1,4 +1,4 @@ -import type { Faker } from '.'; +import type { Faker } from '..'; /** * Module to generate animal related entries. diff --git a/src/modules/commerce.ts b/src/modules/commerce.ts index 754fe73a510..d8e5297e314 100644 --- a/src/modules/commerce.ts +++ b/src/modules/commerce.ts @@ -1,4 +1,4 @@ -import type { Faker } from '.'; +import type { Faker } from '..'; /** * Module to generate commerce and product related entries. diff --git a/src/modules/company.ts b/src/modules/company.ts index c2d72260d78..a81a4669b2b 100644 --- a/src/modules/company.ts +++ b/src/modules/company.ts @@ -1,4 +1,4 @@ -import type { Faker } from '.'; +import type { Faker } from '..'; /** * Module to generate company related entries. diff --git a/src/modules/database.ts b/src/modules/database.ts index 770b4b04dd7..c90796722d6 100644 --- a/src/modules/database.ts +++ b/src/modules/database.ts @@ -1,4 +1,4 @@ -import type { Faker } from '.'; +import type { Faker } from '..'; /** * Module to generate database related entries. diff --git a/src/modules/datatype.ts b/src/modules/datatype.ts index 0984779b4b0..4d801d948b4 100644 --- a/src/modules/datatype.ts +++ b/src/modules/datatype.ts @@ -1,6 +1,6 @@ -import type { Faker } from '.'; -import { FakerError } from './errors/faker-error'; -import { deprecated } from './internal/deprecated'; +import type { Faker } from '..'; +import { FakerError } from '../errors/faker-error'; +import { deprecated } from '../internal/deprecated'; /** * Module to generate various primitive values and data types. diff --git a/src/modules/date.ts b/src/modules/date.ts index bb65ce4ee42..9c8437bd71a 100644 --- a/src/modules/date.ts +++ b/src/modules/date.ts @@ -1,5 +1,5 @@ -import type { Faker } from '.'; -import type { DateEntryDefinition } from './definitions'; +import type { Faker } from '..'; +import type { DateEntryDefinition } from '../definitions'; /** * Converts date passed as a string, number or Date to a Date object. diff --git a/src/modules/fake.ts b/src/modules/fake.ts index 4b6bc788b1d..dc7463d7a24 100644 --- a/src/modules/fake.ts +++ b/src/modules/fake.ts @@ -1,5 +1,5 @@ -import type { Faker } from '.'; -import { FakerError } from './errors/faker-error'; +import type { Faker } from '..'; +import { FakerError } from '../errors/faker-error'; /** * Generator method for combining faker methods based on string input. diff --git a/src/modules/finance.ts b/src/modules/finance.ts index 48ce550c9ec..656f11af33f 100644 --- a/src/modules/finance.ts +++ b/src/modules/finance.ts @@ -1,6 +1,6 @@ -import type { Faker } from '.'; -import { FakerError } from './errors/faker-error'; -import iban from './utils/iban'; +import type { Faker } from '..'; +import { FakerError } from '../errors/faker-error'; +import iban from '../utils/iban'; /** * Module to generate finance related entries. diff --git a/src/modules/git.ts b/src/modules/git.ts index c0c9806234e..9aac79c660c 100644 --- a/src/modules/git.ts +++ b/src/modules/git.ts @@ -1,4 +1,4 @@ -import type { Faker } from '.'; +import type { Faker } from '..'; /** * Module to generate git related entries. diff --git a/src/modules/hacker.ts b/src/modules/hacker.ts index 49c636026c3..4ae05b6959e 100644 --- a/src/modules/hacker.ts +++ b/src/modules/hacker.ts @@ -1,4 +1,4 @@ -import type { Faker } from '.'; +import type { Faker } from '..'; /** * Module to generate hacker/IT words and phrases. diff --git a/src/modules/helpers.ts b/src/modules/helpers.ts index 0d8ce5b0899..e1f96ab30fc 100644 --- a/src/modules/helpers.ts +++ b/src/modules/helpers.ts @@ -1,5 +1,5 @@ -import type { Faker } from '.'; -import { deprecated } from './internal/deprecated'; +import type { Faker } from '..'; +import { deprecated } from '../internal/deprecated'; /** * A full card with various details. diff --git a/src/modules/image.ts b/src/modules/image.ts index fc6a2a96042..eeb7a9a6856 100644 --- a/src/modules/image.ts +++ b/src/modules/image.ts @@ -1,8 +1,8 @@ -import type { Faker } from '.'; -import { LoremPicsum } from './image_providers/lorempicsum'; -import { Lorempixel } from './image_providers/lorempixel'; -import { Unsplash } from './image_providers/unsplash'; -import type { MethodsOf } from './utils/types'; +import type { Faker } from '..'; +import { LoremPicsum } from '../image_providers/lorempicsum'; +import { Lorempixel } from '../image_providers/lorempixel'; +import { Unsplash } from '../image_providers/unsplash'; +import type { MethodsOf } from '../utils/types'; /** * Module to generate placeholder images. diff --git a/src/modules/internet.ts b/src/modules/internet.ts index 6d018dc3cca..b504b140321 100644 --- a/src/modules/internet.ts +++ b/src/modules/internet.ts @@ -1,5 +1,5 @@ -import type { Faker } from '.'; -import * as random_ua from './utils/user-agent'; +import type { Faker } from '..'; +import * as random_ua from '../utils/user-agent'; export type EmojiType = | 'smiley' diff --git a/src/modules/lorem.ts b/src/modules/lorem.ts index a7a1b4d39f5..7797230f927 100644 --- a/src/modules/lorem.ts +++ b/src/modules/lorem.ts @@ -1,4 +1,4 @@ -import type { Faker } from '.'; +import type { Faker } from '..'; /** * Module to generate random texts and words. diff --git a/src/modules/mersenne.ts b/src/modules/mersenne.ts index c8f531f2872..41d3337aa65 100644 --- a/src/modules/mersenne.ts +++ b/src/modules/mersenne.ts @@ -1,5 +1,5 @@ -import { FakerError } from './errors/faker-error'; -import Gen from './utils/mersenne'; +import { FakerError } from '../errors/faker-error'; +import Gen from '../utils/mersenne'; /** * Module to generate seed based random numbers. diff --git a/src/modules/music.ts b/src/modules/music.ts index d0e0a1a7f4d..6f4b0e7dc42 100644 --- a/src/modules/music.ts +++ b/src/modules/music.ts @@ -1,4 +1,4 @@ -import type { Faker } from '.'; +import type { Faker } from '..'; /** * Module to generate music related entries. diff --git a/src/modules/name.ts b/src/modules/name.ts index 280e4b098a5..9d309d011b6 100644 --- a/src/modules/name.ts +++ b/src/modules/name.ts @@ -1,5 +1,5 @@ -import type { Faker } from '.'; -import { deprecated } from './internal/deprecated'; +import type { Faker } from '..'; +import { deprecated } from '../internal/deprecated'; export enum Gender { female = 'female', diff --git a/src/modules/phone.ts b/src/modules/phone.ts index c8a1902ddaa..e3f8d14775f 100644 --- a/src/modules/phone.ts +++ b/src/modules/phone.ts @@ -1,4 +1,4 @@ -import type { Faker } from '.'; +import type { Faker } from '..'; /** * Module to generate phone-related data. diff --git a/src/modules/random.ts b/src/modules/random.ts index 879768281ab..a39ad716e7a 100644 --- a/src/modules/random.ts +++ b/src/modules/random.ts @@ -1,6 +1,6 @@ -import type { Faker } from '.'; -import { FakerError } from './errors/faker-error'; -import { deprecated } from './internal/deprecated'; +import type { Faker } from '..'; +import { FakerError } from '../errors/faker-error'; +import { deprecated } from '../internal/deprecated'; /** * Method to reduce array of characters. diff --git a/src/modules/system.ts b/src/modules/system.ts index 90e56d55900..e28aec229cf 100644 --- a/src/modules/system.ts +++ b/src/modules/system.ts @@ -1,4 +1,4 @@ -import type { Faker } from '.'; +import type { Faker } from '..'; const commonFileTypes = ['video', 'audio', 'image', 'text', 'application']; diff --git a/src/modules/time.ts b/src/modules/time.ts index c33638a743f..eea7a81c502 100644 --- a/src/modules/time.ts +++ b/src/modules/time.ts @@ -1,5 +1,5 @@ -import type { LiteralUnion } from './faker'; -import { deprecated } from './internal/deprecated'; +import type { LiteralUnion } from '../faker'; +import { deprecated } from '../internal/deprecated'; /** * Module to generate time of dates in various formats. diff --git a/src/modules/unique.ts b/src/modules/unique.ts index 188a2e63973..cf8796c6fc3 100644 --- a/src/modules/unique.ts +++ b/src/modules/unique.ts @@ -1,6 +1,6 @@ -import { deprecated } from './internal/deprecated'; -import type { RecordKey } from './utils/unique'; -import * as uniqueExec from './utils/unique'; +import { deprecated } from '../internal/deprecated'; +import type { RecordKey } from '../utils/unique'; +import * as uniqueExec from '../utils/unique'; /** * Module to generate unique entries. diff --git a/src/modules/vehicle.ts b/src/modules/vehicle.ts index ca0d11f2f46..1d8200a154f 100644 --- a/src/modules/vehicle.ts +++ b/src/modules/vehicle.ts @@ -1,4 +1,4 @@ -import type { Faker } from '.'; +import type { Faker } from '..'; /** * Module to generate vehicle related entries. diff --git a/src/modules/word.ts b/src/modules/word.ts index b586c0d03a0..6762f7cf42d 100644 --- a/src/modules/word.ts +++ b/src/modules/word.ts @@ -1,4 +1,4 @@ -import type { Faker } from '.'; +import type { Faker } from '..'; /** * Filters a string array for values with a specific length. From c2d1b0b569ff4c33e6081c9d7f253e340932c467 Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Tue, 3 May 2022 09:35:10 +0200 Subject: [PATCH 3/9] refactor: move image_providers to modules --- src/modules/image.ts | 6 +++--- src/{ => modules}/image_providers/lorempicsum.ts | 2 +- src/{ => modules}/image_providers/lorempixel.ts | 4 ++-- src/{ => modules}/image_providers/unsplash.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) rename src/{ => modules}/image_providers/lorempicsum.ts (99%) rename src/{ => modules}/image_providers/lorempixel.ts (98%) rename src/{ => modules}/image_providers/unsplash.ts (99%) diff --git a/src/modules/image.ts b/src/modules/image.ts index eeb7a9a6856..6b0a6a463cf 100644 --- a/src/modules/image.ts +++ b/src/modules/image.ts @@ -1,8 +1,8 @@ import type { Faker } from '..'; -import { LoremPicsum } from '../image_providers/lorempicsum'; -import { Lorempixel } from '../image_providers/lorempixel'; -import { Unsplash } from '../image_providers/unsplash'; import type { MethodsOf } from '../utils/types'; +import { LoremPicsum } from './image_providers/lorempicsum'; +import { Lorempixel } from './image_providers/lorempixel'; +import { Unsplash } from './image_providers/unsplash'; /** * Module to generate placeholder images. diff --git a/src/image_providers/lorempicsum.ts b/src/modules/image_providers/lorempicsum.ts similarity index 99% rename from src/image_providers/lorempicsum.ts rename to src/modules/image_providers/lorempicsum.ts index f28b1e8f41d..af9a3c2b7ac 100644 --- a/src/image_providers/lorempicsum.ts +++ b/src/modules/image_providers/lorempicsum.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Module to generate links to random images on `https://picsum.photos/`. diff --git a/src/image_providers/lorempixel.ts b/src/modules/image_providers/lorempixel.ts similarity index 98% rename from src/image_providers/lorempixel.ts rename to src/modules/image_providers/lorempixel.ts index 17cbc2f59df..3f4cf3f5a39 100644 --- a/src/image_providers/lorempixel.ts +++ b/src/modules/image_providers/lorempixel.ts @@ -1,5 +1,5 @@ -import type { Faker } from '..'; -import type { MethodsOf } from '../utils/types'; +import type { Faker } from '../..'; +import type { MethodsOf } from '../../utils/types'; /** * Module to generate links to random images on `https://lorempixel.com/`. diff --git a/src/image_providers/unsplash.ts b/src/modules/image_providers/unsplash.ts similarity index 99% rename from src/image_providers/unsplash.ts rename to src/modules/image_providers/unsplash.ts index 994b2a047b2..34a23051017 100644 --- a/src/image_providers/unsplash.ts +++ b/src/modules/image_providers/unsplash.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Module to generate links to random images on `https://source.unsplash.com/`. From 477a0408d0cd412f3f907aec945654c657e4505b Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Tue, 3 May 2022 09:42:21 +0200 Subject: [PATCH 4/9] refactor: move test files --- test/{ => modules}/address.spec.ts | 4 ++-- test/{ => modules}/animal.spec.ts | 2 +- test/{ => modules}/commerce.spec.ts | 2 +- test/{ => modules}/company.spec.ts | 2 +- test/{ => modules}/database.spec.ts | 2 +- test/{ => modules}/datatype.spec.ts | 2 +- test/{ => modules}/date.spec.ts | 2 +- test/{ => modules}/fake.spec.ts | 4 ++-- test/{ => modules}/finance.spec.ts | 8 ++++---- test/{ => modules}/git.spec.ts | 2 +- test/{ => modules}/hacker.spec.ts | 2 +- test/{ => modules}/helpers.spec.ts | 4 ++-- test/{ => modules}/image.spec.ts | 2 +- test/{ => modules}/internet.spec.ts | 4 ++-- test/{ => modules}/lorem.spec.ts | 4 ++-- test/{ => modules}/mersenne.spec.ts | 4 ++-- test/{ => modules}/music.spec.ts | 2 +- test/{ => modules}/name.spec.ts | 2 +- test/{ => modules}/phone.spec.ts | 4 ++-- test/{ => modules}/random.spec.ts | 4 ++-- test/{ => modules}/system.spec.ts | 2 +- test/{ => modules}/time.spec.ts | 2 +- test/{ => modules}/unique.spec.ts | 4 ++-- test/{ => modules}/vehicle.spec.ts | 2 +- test/{ => modules}/word.spec.ts | 2 +- test/{finance_iban.spec.ts => utils/iban.spec.ts} | 6 +++--- 26 files changed, 40 insertions(+), 40 deletions(-) rename test/{ => modules}/address.spec.ts (99%) rename test/{ => modules}/animal.spec.ts (98%) rename test/{ => modules}/commerce.spec.ts (99%) rename test/{ => modules}/company.spec.ts (99%) rename test/{ => modules}/database.spec.ts (98%) rename test/{ => modules}/datatype.spec.ts (99%) rename test/{ => modules}/date.spec.ts (99%) rename test/{ => modules}/fake.spec.ts (96%) rename test/{ => modules}/finance.spec.ts (98%) rename test/{ => modules}/git.spec.ts (99%) rename test/{ => modules}/hacker.spec.ts (99%) rename test/{ => modules}/helpers.spec.ts (99%) rename test/{ => modules}/image.spec.ts (99%) rename test/{ => modules}/internet.spec.ts (99%) rename test/{ => modules}/lorem.spec.ts (99%) rename test/{ => modules}/mersenne.spec.ts (97%) rename test/{ => modules}/music.spec.ts (97%) rename test/{ => modules}/name.spec.ts (99%) rename test/{ => modules}/phone.spec.ts (97%) rename test/{ => modules}/random.spec.ts (99%) rename test/{ => modules}/system.spec.ts (99%) rename test/{ => modules}/time.spec.ts (98%) rename test/{ => modules}/unique.spec.ts (98%) rename test/{ => modules}/vehicle.spec.ts (99%) rename test/{ => modules}/word.spec.ts (99%) rename test/{finance_iban.spec.ts => utils/iban.spec.ts} (99%) diff --git a/test/address.spec.ts b/test/modules/address.spec.ts similarity index 99% rename from test/address.spec.ts rename to test/modules/address.spec.ts index 6965abe80c7..09ae1c20310 100644 --- a/test/address.spec.ts +++ b/test/modules/address.spec.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; -import { times } from './support/times'; +import { faker } from '../../src'; +import { times } from './../support/times'; function degreesToRadians(degrees: number) { return degrees * (Math.PI / 180.0); diff --git a/test/animal.spec.ts b/test/modules/animal.spec.ts similarity index 98% rename from test/animal.spec.ts rename to test/modules/animal.spec.ts index a3ad1af6d42..c85b965df02 100644 --- a/test/animal.spec.ts +++ b/test/modules/animal.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/commerce.spec.ts b/test/modules/commerce.spec.ts similarity index 99% rename from test/commerce.spec.ts rename to test/modules/commerce.spec.ts index 87385aa7903..fcee151f81a 100644 --- a/test/commerce.spec.ts +++ b/test/modules/commerce.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/company.spec.ts b/test/modules/company.spec.ts similarity index 99% rename from test/company.spec.ts rename to test/modules/company.spec.ts index 6ef8b551aab..8b2d43ff10e 100644 --- a/test/company.spec.ts +++ b/test/modules/company.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/database.spec.ts b/test/modules/database.spec.ts similarity index 98% rename from test/database.spec.ts rename to test/modules/database.spec.ts index 75fe6ac36ba..f9dbdb1730d 100644 --- a/test/database.spec.ts +++ b/test/modules/database.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/datatype.spec.ts b/test/modules/datatype.spec.ts similarity index 99% rename from test/datatype.spec.ts rename to test/modules/datatype.spec.ts index 54504e02d33..c6e479ecc0e 100644 --- a/test/datatype.spec.ts +++ b/test/modules/datatype.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/date.spec.ts b/test/modules/date.spec.ts similarity index 99% rename from test/date.spec.ts rename to test/modules/date.spec.ts index 4b3350a45a4..a1a76525dee 100644 --- a/test/date.spec.ts +++ b/test/modules/date.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/fake.spec.ts b/test/modules/fake.spec.ts similarity index 96% rename from test/fake.spec.ts rename to test/modules/fake.spec.ts index 2846b9ee9c0..e622837063e 100644 --- a/test/fake.spec.ts +++ b/test/modules/fake.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { faker } from '../src'; -import { FakerError } from '../src/errors/faker-error'; +import { faker } from '../../src'; +import { FakerError } from '../../src/errors/faker-error'; describe('fake', () => { describe('fake()', () => { diff --git a/test/finance.spec.ts b/test/modules/finance.spec.ts similarity index 98% rename from test/finance.spec.ts rename to test/modules/finance.spec.ts index 4656e1dea82..06d506ff214 100644 --- a/test/finance.spec.ts +++ b/test/modules/finance.spec.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; -import { FakerError } from '../src/errors/faker-error'; -import ibanLib from '../src/utils/iban'; -import { luhnCheck } from './support/luhnCheck'; +import { faker } from '../../src'; +import { FakerError } from '../../src/errors/faker-error'; +import ibanLib from '../../src/utils/iban'; +import { luhnCheck } from './../support/luhnCheck'; const seedRuns = [ { diff --git a/test/git.spec.ts b/test/modules/git.spec.ts similarity index 99% rename from test/git.spec.ts rename to test/modules/git.spec.ts index 30c00e8d98b..e43fafde8c9 100644 --- a/test/git.spec.ts +++ b/test/modules/git.spec.ts @@ -1,6 +1,6 @@ import validator from 'validator'; import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/hacker.spec.ts b/test/modules/hacker.spec.ts similarity index 99% rename from test/hacker.spec.ts rename to test/modules/hacker.spec.ts index d0311f724a3..29410e3b6cc 100644 --- a/test/hacker.spec.ts +++ b/test/modules/hacker.spec.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/helpers.spec.ts b/test/modules/helpers.spec.ts similarity index 99% rename from test/helpers.spec.ts rename to test/modules/helpers.spec.ts index e436e6dc3e7..5df84c6fd21 100644 --- a/test/helpers.spec.ts +++ b/test/modules/helpers.spec.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it, vi } from 'vitest'; -import { faker } from '../src'; -import { luhnCheck } from './support/luhnCheck'; +import { faker } from '../../src'; +import { luhnCheck } from './../support/luhnCheck'; const seededRuns = [ { diff --git a/test/image.spec.ts b/test/modules/image.spec.ts similarity index 99% rename from test/image.spec.ts rename to test/modules/image.spec.ts index bbb99ffaaab..8ef91daefc0 100644 --- a/test/image.spec.ts +++ b/test/modules/image.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; describe('image', () => { describe('lorempicsum', () => { diff --git a/test/internet.spec.ts b/test/modules/internet.spec.ts similarity index 99% rename from test/internet.spec.ts rename to test/modules/internet.spec.ts index c12284e221d..c950b4ac417 100644 --- a/test/internet.spec.ts +++ b/test/modules/internet.spec.ts @@ -1,7 +1,7 @@ import validator from 'validator'; import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; -import { times } from './support/times'; +import { faker } from '../../src'; +import { times } from './../support/times'; const seededRuns = [ { diff --git a/test/lorem.spec.ts b/test/modules/lorem.spec.ts similarity index 99% rename from test/lorem.spec.ts rename to test/modules/lorem.spec.ts index 1338e366502..58fa090f353 100644 --- a/test/lorem.spec.ts +++ b/test/modules/lorem.spec.ts @@ -1,7 +1,7 @@ import validator from 'validator'; import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; -import { times } from './support/times'; +import { faker } from '../../src'; +import { times } from './../support/times'; const seededRuns = [ { diff --git a/test/mersenne.spec.ts b/test/modules/mersenne.spec.ts similarity index 97% rename from test/mersenne.spec.ts rename to test/modules/mersenne.spec.ts index 642731b2488..527c5f6d80a 100644 --- a/test/mersenne.spec.ts +++ b/test/modules/mersenne.spec.ts @@ -1,6 +1,6 @@ import { beforeAll, beforeEach, describe, expect, it } from 'vitest'; -import { FakerError } from '../src/errors/faker-error'; -import { Mersenne } from '../src/mersenne'; +import { FakerError } from '../../src/errors/faker-error'; +import { Mersenne } from '../../src/modules/mersenne'; type SeededRun = { seed: number | number[]; diff --git a/test/music.spec.ts b/test/modules/music.spec.ts similarity index 97% rename from test/music.spec.ts rename to test/modules/music.spec.ts index 3fa51b8eaeb..7a291b749a7 100644 --- a/test/music.spec.ts +++ b/test/modules/music.spec.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/name.spec.ts b/test/modules/name.spec.ts similarity index 99% rename from test/name.spec.ts rename to test/modules/name.spec.ts index a182f5f0856..34c1469f6e8 100644 --- a/test/name.spec.ts +++ b/test/modules/name.spec.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/phone.spec.ts b/test/modules/phone.spec.ts similarity index 97% rename from test/phone.spec.ts rename to test/modules/phone.spec.ts index 17180156008..022c19e6a41 100644 --- a/test/phone.spec.ts +++ b/test/modules/phone.spec.ts @@ -1,6 +1,6 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; -import { luhnCheck } from './support/luhnCheck'; +import { faker } from '../../src'; +import { luhnCheck } from './../support/luhnCheck'; const seededRuns = [ { diff --git a/test/random.spec.ts b/test/modules/random.spec.ts similarity index 99% rename from test/random.spec.ts rename to test/modules/random.spec.ts index bf081b5c4cc..e8312fb1f10 100644 --- a/test/random.spec.ts +++ b/test/modules/random.spec.ts @@ -1,6 +1,6 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { faker, FakerError } from '../src'; -import { times } from './support/times'; +import { faker, FakerError } from '../../src'; +import { times } from './../support/times'; const seededRuns = [ { diff --git a/test/system.spec.ts b/test/modules/system.spec.ts similarity index 99% rename from test/system.spec.ts rename to test/modules/system.spec.ts index dc584ee6fde..90ffc70d0cc 100644 --- a/test/system.spec.ts +++ b/test/modules/system.spec.ts @@ -1,6 +1,6 @@ import validator from 'validator'; import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/time.spec.ts b/test/modules/time.spec.ts similarity index 98% rename from test/time.spec.ts rename to test/modules/time.spec.ts index c9b7068df99..2a1f5ed8198 100644 --- a/test/time.spec.ts +++ b/test/modules/time.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/unique.spec.ts b/test/modules/unique.spec.ts similarity index 98% rename from test/unique.spec.ts rename to test/modules/unique.spec.ts index 909b26a4329..5b0d16cd638 100644 --- a/test/unique.spec.ts +++ b/test/modules/unique.spec.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; -import { FakerError } from '../src/errors/faker-error'; +import { faker } from '../../src'; +import { FakerError } from '../../src/errors/faker-error'; const seededRuns = [ { diff --git a/test/vehicle.spec.ts b/test/modules/vehicle.spec.ts similarity index 99% rename from test/vehicle.spec.ts rename to test/modules/vehicle.spec.ts index d6440814bb7..7e48dcb2ca9 100644 --- a/test/vehicle.spec.ts +++ b/test/modules/vehicle.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/word.spec.ts b/test/modules/word.spec.ts similarity index 99% rename from test/word.spec.ts rename to test/modules/word.spec.ts index f3ef451c202..dd53ac18bec 100644 --- a/test/word.spec.ts +++ b/test/modules/word.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../src'; +import { faker } from '../../src'; const seededRuns = [ { diff --git a/test/finance_iban.spec.ts b/test/utils/iban.spec.ts similarity index 99% rename from test/finance_iban.spec.ts rename to test/utils/iban.spec.ts index a5936fafa0e..c397ebfb950 100644 --- a/test/finance_iban.spec.ts +++ b/test/utils/iban.spec.ts @@ -1,11 +1,11 @@ import validator from 'validator'; import { describe, expect, it } from 'vitest'; -import { faker } from '../src'; -import ibanLib from '../src/utils/iban'; +import { faker } from '../../src'; +import ibanLib from '../../src/utils/iban'; const NON_SEEDED_BASED_RUN = 25; -describe('finance_iban', () => { +describe('iban', () => { describe('generic IBAN country checks', () => { it.each(ibanLib.formats.map((entry) => entry.country))('%s', (country) => { expect(country).toMatch(/^[A-Z]{2}$/); From 18a00996ebd8e14bd2589118508803b769a4f0e1 Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Tue, 3 May 2022 12:07:48 +0200 Subject: [PATCH 5/9] refactor: create some module sub folders --- scripts/bundle.ts | 2 -- src/{utils => modules/finance}/iban.ts | 0 src/modules/{finance.ts => finance/index.ts} | 6 +++--- src/modules/{image.ts => image/index.ts} | 10 +++++----- .../providers}/lorempicsum.ts | 2 +- .../{image_providers => image/providers}/lorempixel.ts | 4 ++-- .../{image_providers => image/providers}/unsplash.ts | 2 +- src/modules/{internet.ts => internet/index.ts} | 4 ++-- src/{utils => modules/internet}/user-agent.ts | 2 +- src/modules/{mersenne.ts => mersenne/index.ts} | 4 ++-- src/{utils => modules/mersenne}/mersenne.ts | 0 src/modules/{unique.ts => unique/index.ts} | 6 +++--- src/{utils => modules/unique}/unique.ts | 2 +- test/modules/finance.spec.ts | 2 +- test/utils/iban.spec.ts | 2 +- 15 files changed, 23 insertions(+), 25 deletions(-) rename src/{utils => modules/finance}/iban.ts (100%) rename src/modules/{finance.ts => finance/index.ts} (99%) rename src/modules/{image.ts => image/index.ts} (98%) rename src/modules/{image_providers => image/providers}/lorempicsum.ts (98%) rename src/modules/{image_providers => image/providers}/lorempixel.ts (98%) rename src/modules/{image_providers => image/providers}/unsplash.ts (99%) rename src/modules/{internet.ts => internet/index.ts} (99%) rename src/{utils => modules/internet}/user-agent.ts (99%) rename src/modules/{mersenne.ts => mersenne/index.ts} (94%) rename src/{utils => modules/mersenne}/mersenne.ts (100%) rename src/modules/{unique.ts => unique/index.ts} (96%) rename src/{utils => modules/unique}/unique.ts (98%) diff --git a/scripts/bundle.ts b/scripts/bundle.ts index 57b26807b41..29a3f2a0d40 100644 --- a/scripts/bundle.ts +++ b/scripts/bundle.ts @@ -25,7 +25,6 @@ buildSync({ // entryPoints: [ // './src/index.ts', // ...Object.keys(locales).map((locale) => `./src/locale/${locale}.ts`), - // './src/modules/mersenne.ts', // ], outdir: './dist/cjs', bundle: false, // Creates 390MiB bundle ... @@ -42,7 +41,6 @@ buildSync({ entryPoints: [ './src/index.ts', ...Object.keys(locales).map((locale) => `./src/locale/${locale}.ts`), - './src/modules/mersenne.ts', ], outdir: './dist/esm', bundle: true, diff --git a/src/utils/iban.ts b/src/modules/finance/iban.ts similarity index 100% rename from src/utils/iban.ts rename to src/modules/finance/iban.ts diff --git a/src/modules/finance.ts b/src/modules/finance/index.ts similarity index 99% rename from src/modules/finance.ts rename to src/modules/finance/index.ts index 656f11af33f..a74dceba4da 100644 --- a/src/modules/finance.ts +++ b/src/modules/finance/index.ts @@ -1,6 +1,6 @@ -import type { Faker } from '..'; -import { FakerError } from '../errors/faker-error'; -import iban from '../utils/iban'; +import type { Faker } from '../..'; +import { FakerError } from '../../errors/faker-error'; +import iban from './iban'; /** * Module to generate finance related entries. diff --git a/src/modules/image.ts b/src/modules/image/index.ts similarity index 98% rename from src/modules/image.ts rename to src/modules/image/index.ts index 6b0a6a463cf..9e8e1879b34 100644 --- a/src/modules/image.ts +++ b/src/modules/image/index.ts @@ -1,8 +1,8 @@ -import type { Faker } from '..'; -import type { MethodsOf } from '../utils/types'; -import { LoremPicsum } from './image_providers/lorempicsum'; -import { Lorempixel } from './image_providers/lorempixel'; -import { Unsplash } from './image_providers/unsplash'; +import type { Faker } from '../..'; +import type { MethodsOf } from '../../utils/types'; +import { LoremPicsum } from './providers/lorempicsum'; +import { Lorempixel } from './providers/lorempixel'; +import { Unsplash } from './providers/unsplash'; /** * Module to generate placeholder images. diff --git a/src/modules/image_providers/lorempicsum.ts b/src/modules/image/providers/lorempicsum.ts similarity index 98% rename from src/modules/image_providers/lorempicsum.ts rename to src/modules/image/providers/lorempicsum.ts index af9a3c2b7ac..2586920513e 100644 --- a/src/modules/image_providers/lorempicsum.ts +++ b/src/modules/image/providers/lorempicsum.ts @@ -1,4 +1,4 @@ -import type { Faker } from '../..'; +import type { Faker } from '../../..'; /** * Module to generate links to random images on `https://picsum.photos/`. diff --git a/src/modules/image_providers/lorempixel.ts b/src/modules/image/providers/lorempixel.ts similarity index 98% rename from src/modules/image_providers/lorempixel.ts rename to src/modules/image/providers/lorempixel.ts index 3f4cf3f5a39..f1ab384bc1d 100644 --- a/src/modules/image_providers/lorempixel.ts +++ b/src/modules/image/providers/lorempixel.ts @@ -1,5 +1,5 @@ -import type { Faker } from '../..'; -import type { MethodsOf } from '../../utils/types'; +import type { Faker } from '../../..'; +import type { MethodsOf } from '../../../utils/types'; /** * Module to generate links to random images on `https://lorempixel.com/`. diff --git a/src/modules/image_providers/unsplash.ts b/src/modules/image/providers/unsplash.ts similarity index 99% rename from src/modules/image_providers/unsplash.ts rename to src/modules/image/providers/unsplash.ts index 34a23051017..45bd815cd40 100644 --- a/src/modules/image_providers/unsplash.ts +++ b/src/modules/image/providers/unsplash.ts @@ -1,4 +1,4 @@ -import type { Faker } from '../..'; +import type { Faker } from '../../..'; /** * Module to generate links to random images on `https://source.unsplash.com/`. diff --git a/src/modules/internet.ts b/src/modules/internet/index.ts similarity index 99% rename from src/modules/internet.ts rename to src/modules/internet/index.ts index b504b140321..bcc5daf3cda 100644 --- a/src/modules/internet.ts +++ b/src/modules/internet/index.ts @@ -1,5 +1,5 @@ -import type { Faker } from '..'; -import * as random_ua from '../utils/user-agent'; +import type { Faker } from '../..'; +import * as random_ua from './user-agent'; export type EmojiType = | 'smiley' diff --git a/src/utils/user-agent.ts b/src/modules/internet/user-agent.ts similarity index 99% rename from src/utils/user-agent.ts rename to src/modules/internet/user-agent.ts index b3438cbd20f..046758d4821 100644 --- a/src/utils/user-agent.ts +++ b/src/modules/internet/user-agent.ts @@ -42,7 +42,7 @@ * this stuff is worth it, you can buy me a beer in return. Luka Pusic */ -import type { Faker } from '..'; +import type { Faker } from '../..'; export type Arch = 'lin' | 'mac' | 'win'; diff --git a/src/modules/mersenne.ts b/src/modules/mersenne/index.ts similarity index 94% rename from src/modules/mersenne.ts rename to src/modules/mersenne/index.ts index 41d3337aa65..3354edd770e 100644 --- a/src/modules/mersenne.ts +++ b/src/modules/mersenne/index.ts @@ -1,5 +1,5 @@ -import { FakerError } from '../errors/faker-error'; -import Gen from '../utils/mersenne'; +import { FakerError } from '../../errors/faker-error'; +import Gen from './mersenne'; /** * Module to generate seed based random numbers. diff --git a/src/utils/mersenne.ts b/src/modules/mersenne/mersenne.ts similarity index 100% rename from src/utils/mersenne.ts rename to src/modules/mersenne/mersenne.ts diff --git a/src/modules/unique.ts b/src/modules/unique/index.ts similarity index 96% rename from src/modules/unique.ts rename to src/modules/unique/index.ts index cf8796c6fc3..798fc29e51f 100644 --- a/src/modules/unique.ts +++ b/src/modules/unique/index.ts @@ -1,6 +1,6 @@ -import { deprecated } from '../internal/deprecated'; -import type { RecordKey } from '../utils/unique'; -import * as uniqueExec from '../utils/unique'; +import { deprecated } from '../../internal/deprecated'; +import type { RecordKey } from './unique'; +import * as uniqueExec from './unique'; /** * Module to generate unique entries. diff --git a/src/utils/unique.ts b/src/modules/unique/unique.ts similarity index 98% rename from src/utils/unique.ts rename to src/modules/unique/unique.ts index df1b827ecf8..70408faf1c5 100644 --- a/src/utils/unique.ts +++ b/src/modules/unique/unique.ts @@ -1,4 +1,4 @@ -import { FakerError } from '../errors/faker-error'; +import { FakerError } from '../../errors/faker-error'; export type RecordKey = string | number | symbol; diff --git a/test/modules/finance.spec.ts b/test/modules/finance.spec.ts index 06d506ff214..730d452390d 100644 --- a/test/modules/finance.spec.ts +++ b/test/modules/finance.spec.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it } from 'vitest'; import { faker } from '../../src'; import { FakerError } from '../../src/errors/faker-error'; -import ibanLib from '../../src/utils/iban'; +import ibanLib from '../../src/modules/finance/iban'; import { luhnCheck } from './../support/luhnCheck'; const seedRuns = [ diff --git a/test/utils/iban.spec.ts b/test/utils/iban.spec.ts index c397ebfb950..153f46075ab 100644 --- a/test/utils/iban.spec.ts +++ b/test/utils/iban.spec.ts @@ -1,7 +1,7 @@ import validator from 'validator'; import { describe, expect, it } from 'vitest'; import { faker } from '../../src'; -import ibanLib from '../../src/utils/iban'; +import ibanLib from '../../src/modules/finance/iban'; const NON_SEEDED_BASED_RUN = 25; From be55fefe15bcaa46dd6aa3c99c9be97c30ee17ec Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Tue, 3 May 2022 12:20:03 +0200 Subject: [PATCH 6/9] refactor: move all modules into subfolders --- src/modules/{address.ts => address/index.ts} | 2 +- src/modules/{animal.ts => animal/index.ts} | 2 +- src/modules/{commerce.ts => commerce/index.ts} | 2 +- src/modules/{company.ts => company/index.ts} | 2 +- src/modules/{database.ts => database/index.ts} | 2 +- src/modules/{datatype.ts => datatype/index.ts} | 6 +++--- src/modules/{date.ts => date/index.ts} | 4 ++-- src/modules/{fake.ts => fake/index.ts} | 4 ++-- src/modules/{git.ts => git/index.ts} | 2 +- src/modules/{hacker.ts => hacker/index.ts} | 2 +- src/modules/{helpers.ts => helpers/index.ts} | 4 ++-- src/modules/{lorem.ts => lorem/index.ts} | 2 +- src/modules/{music.ts => music/index.ts} | 2 +- src/modules/{name.ts => name/index.ts} | 4 ++-- src/modules/{phone.ts => phone/index.ts} | 2 +- src/modules/{random.ts => random/index.ts} | 6 +++--- src/modules/{system.ts => system/index.ts} | 2 +- src/modules/{time.ts => time/index.ts} | 4 ++-- src/modules/{vehicle.ts => vehicle/index.ts} | 2 +- src/modules/{word.ts => word/index.ts} | 2 +- 20 files changed, 29 insertions(+), 29 deletions(-) rename src/modules/{address.ts => address/index.ts} (99%) rename src/modules/{animal.ts => animal/index.ts} (98%) rename src/modules/{commerce.ts => commerce/index.ts} (98%) rename src/modules/{company.ts => company/index.ts} (99%) rename src/modules/{database.ts => database/index.ts} (97%) rename src/modules/{datatype.ts => datatype/index.ts} (98%) rename src/modules/{date.ts => date/index.ts} (98%) rename src/modules/{fake.ts => fake/index.ts} (98%) rename src/modules/{git.ts => git/index.ts} (98%) rename src/modules/{hacker.ts => hacker/index.ts} (98%) rename src/modules/{helpers.ts => helpers/index.ts} (99%) rename src/modules/{lorem.ts => lorem/index.ts} (99%) rename src/modules/{music.ts => music/index.ts} (94%) rename src/modules/{name.ts => name/index.ts} (98%) rename src/modules/{phone.ts => phone/index.ts} (98%) rename src/modules/{random.ts => random/index.ts} (99%) rename src/modules/{system.ts => system/index.ts} (99%) rename src/modules/{time.ts => time/index.ts} (93%) rename src/modules/{vehicle.ts => vehicle/index.ts} (98%) rename src/modules/{word.ts => word/index.ts} (99%) diff --git a/src/modules/address.ts b/src/modules/address/index.ts similarity index 99% rename from src/modules/address.ts rename to src/modules/address/index.ts index 2e35f36f7de..db82e01eb4d 100644 --- a/src/modules/address.ts +++ b/src/modules/address/index.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Module to generate addresses and locations. diff --git a/src/modules/animal.ts b/src/modules/animal/index.ts similarity index 98% rename from src/modules/animal.ts rename to src/modules/animal/index.ts index edd96c7e838..416fe533a2a 100644 --- a/src/modules/animal.ts +++ b/src/modules/animal/index.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Module to generate animal related entries. diff --git a/src/modules/commerce.ts b/src/modules/commerce/index.ts similarity index 98% rename from src/modules/commerce.ts rename to src/modules/commerce/index.ts index d8e5297e314..71ce96d6155 100644 --- a/src/modules/commerce.ts +++ b/src/modules/commerce/index.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Module to generate commerce and product related entries. diff --git a/src/modules/company.ts b/src/modules/company/index.ts similarity index 99% rename from src/modules/company.ts rename to src/modules/company/index.ts index a81a4669b2b..fb5f2e666e1 100644 --- a/src/modules/company.ts +++ b/src/modules/company/index.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Module to generate company related entries. diff --git a/src/modules/database.ts b/src/modules/database/index.ts similarity index 97% rename from src/modules/database.ts rename to src/modules/database/index.ts index c90796722d6..073d3f8a1dd 100644 --- a/src/modules/database.ts +++ b/src/modules/database/index.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Module to generate database related entries. diff --git a/src/modules/datatype.ts b/src/modules/datatype/index.ts similarity index 98% rename from src/modules/datatype.ts rename to src/modules/datatype/index.ts index 4d801d948b4..653d4d3fe95 100644 --- a/src/modules/datatype.ts +++ b/src/modules/datatype/index.ts @@ -1,6 +1,6 @@ -import type { Faker } from '..'; -import { FakerError } from '../errors/faker-error'; -import { deprecated } from '../internal/deprecated'; +import type { Faker } from '../..'; +import { FakerError } from '../../errors/faker-error'; +import { deprecated } from '../../internal/deprecated'; /** * Module to generate various primitive values and data types. diff --git a/src/modules/date.ts b/src/modules/date/index.ts similarity index 98% rename from src/modules/date.ts rename to src/modules/date/index.ts index 9c8437bd71a..09f608f0490 100644 --- a/src/modules/date.ts +++ b/src/modules/date/index.ts @@ -1,5 +1,5 @@ -import type { Faker } from '..'; -import type { DateEntryDefinition } from '../definitions'; +import type { Faker } from '../..'; +import type { DateEntryDefinition } from '../../definitions'; /** * Converts date passed as a string, number or Date to a Date object. diff --git a/src/modules/fake.ts b/src/modules/fake/index.ts similarity index 98% rename from src/modules/fake.ts rename to src/modules/fake/index.ts index dc7463d7a24..a9f2a22a173 100644 --- a/src/modules/fake.ts +++ b/src/modules/fake/index.ts @@ -1,5 +1,5 @@ -import type { Faker } from '..'; -import { FakerError } from '../errors/faker-error'; +import type { Faker } from '../..'; +import { FakerError } from '../../errors/faker-error'; /** * Generator method for combining faker methods based on string input. diff --git a/src/modules/git.ts b/src/modules/git/index.ts similarity index 98% rename from src/modules/git.ts rename to src/modules/git/index.ts index 9aac79c660c..e86f66488d7 100644 --- a/src/modules/git.ts +++ b/src/modules/git/index.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Module to generate git related entries. diff --git a/src/modules/hacker.ts b/src/modules/hacker/index.ts similarity index 98% rename from src/modules/hacker.ts rename to src/modules/hacker/index.ts index 4ae05b6959e..ee1bbc5c32e 100644 --- a/src/modules/hacker.ts +++ b/src/modules/hacker/index.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Module to generate hacker/IT words and phrases. diff --git a/src/modules/helpers.ts b/src/modules/helpers/index.ts similarity index 99% rename from src/modules/helpers.ts rename to src/modules/helpers/index.ts index e1f96ab30fc..1b28ddfac34 100644 --- a/src/modules/helpers.ts +++ b/src/modules/helpers/index.ts @@ -1,5 +1,5 @@ -import type { Faker } from '..'; -import { deprecated } from '../internal/deprecated'; +import type { Faker } from '../..'; +import { deprecated } from '../../internal/deprecated'; /** * A full card with various details. diff --git a/src/modules/lorem.ts b/src/modules/lorem/index.ts similarity index 99% rename from src/modules/lorem.ts rename to src/modules/lorem/index.ts index 7797230f927..5df39146bd0 100644 --- a/src/modules/lorem.ts +++ b/src/modules/lorem/index.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Module to generate random texts and words. diff --git a/src/modules/music.ts b/src/modules/music/index.ts similarity index 94% rename from src/modules/music.ts rename to src/modules/music/index.ts index 6f4b0e7dc42..a34a4bb8356 100644 --- a/src/modules/music.ts +++ b/src/modules/music/index.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Module to generate music related entries. diff --git a/src/modules/name.ts b/src/modules/name/index.ts similarity index 98% rename from src/modules/name.ts rename to src/modules/name/index.ts index 9d309d011b6..c1ac22a75eb 100644 --- a/src/modules/name.ts +++ b/src/modules/name/index.ts @@ -1,5 +1,5 @@ -import type { Faker } from '..'; -import { deprecated } from '../internal/deprecated'; +import type { Faker } from '../..'; +import { deprecated } from '../../internal/deprecated'; export enum Gender { female = 'female', diff --git a/src/modules/phone.ts b/src/modules/phone/index.ts similarity index 98% rename from src/modules/phone.ts rename to src/modules/phone/index.ts index e3f8d14775f..7e85915cf13 100644 --- a/src/modules/phone.ts +++ b/src/modules/phone/index.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Module to generate phone-related data. diff --git a/src/modules/random.ts b/src/modules/random/index.ts similarity index 99% rename from src/modules/random.ts rename to src/modules/random/index.ts index a39ad716e7a..7939b298d53 100644 --- a/src/modules/random.ts +++ b/src/modules/random/index.ts @@ -1,6 +1,6 @@ -import type { Faker } from '..'; -import { FakerError } from '../errors/faker-error'; -import { deprecated } from '../internal/deprecated'; +import type { Faker } from '../..'; +import { FakerError } from '../../errors/faker-error'; +import { deprecated } from '../../internal/deprecated'; /** * Method to reduce array of characters. diff --git a/src/modules/system.ts b/src/modules/system/index.ts similarity index 99% rename from src/modules/system.ts rename to src/modules/system/index.ts index e28aec229cf..250f1fb83c2 100644 --- a/src/modules/system.ts +++ b/src/modules/system/index.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; const commonFileTypes = ['video', 'audio', 'image', 'text', 'application']; diff --git a/src/modules/time.ts b/src/modules/time/index.ts similarity index 93% rename from src/modules/time.ts rename to src/modules/time/index.ts index eea7a81c502..51db0fb0404 100644 --- a/src/modules/time.ts +++ b/src/modules/time/index.ts @@ -1,5 +1,5 @@ -import type { LiteralUnion } from '../faker'; -import { deprecated } from '../internal/deprecated'; +import type { LiteralUnion } from '../../faker'; +import { deprecated } from '../../internal/deprecated'; /** * Module to generate time of dates in various formats. diff --git a/src/modules/vehicle.ts b/src/modules/vehicle/index.ts similarity index 98% rename from src/modules/vehicle.ts rename to src/modules/vehicle/index.ts index 1d8200a154f..ec010af9838 100644 --- a/src/modules/vehicle.ts +++ b/src/modules/vehicle/index.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Module to generate vehicle related entries. diff --git a/src/modules/word.ts b/src/modules/word/index.ts similarity index 99% rename from src/modules/word.ts rename to src/modules/word/index.ts index 6762f7cf42d..5968d225b3b 100644 --- a/src/modules/word.ts +++ b/src/modules/word/index.ts @@ -1,4 +1,4 @@ -import type { Faker } from '..'; +import type { Faker } from '../..'; /** * Filters a string array for values with a specific length. From 6eed56960e20dd64ab20c5a50a71ee0196457288 Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Tue, 3 May 2022 12:26:27 +0200 Subject: [PATCH 7/9] chore: move LiteralUnion to utils/types --- src/faker.ts | 6 +----- src/modules/time/index.ts | 2 +- src/utils/types.ts | 9 +++++++++ test/scripts/apidoc/signature.example.ts | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/faker.ts b/src/faker.ts index 3a1818125c9..e9fa978e5e3 100644 --- a/src/faker.ts +++ b/src/faker.ts @@ -27,11 +27,7 @@ import { Time } from './modules/time'; import { Unique } from './modules/unique'; import { Vehicle } from './modules/vehicle'; import { Word } from './modules/word'; - -// https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609 -export type LiteralUnion = - | T - | (U & { zz_IGNORE_ME?: never }); +import type { LiteralUnion } from './utils/types'; export type UsableLocale = LiteralUnion; export type UsedLocales = Partial>; diff --git a/src/modules/time/index.ts b/src/modules/time/index.ts index 51db0fb0404..021d75c8b64 100644 --- a/src/modules/time/index.ts +++ b/src/modules/time/index.ts @@ -1,5 +1,5 @@ -import type { LiteralUnion } from '../../faker'; import { deprecated } from '../../internal/deprecated'; +import type { LiteralUnion } from '../../utils/types'; /** * Module to generate time of dates in various formats. diff --git a/src/utils/types.ts b/src/utils/types.ts index 705d02d11e2..65c87ebf1cc 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -1,3 +1,12 @@ +/** + * Type that provides auto-suggestions but also any string. + * + * @see https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609 + */ +export type LiteralUnion = + | T + | (U & { zz_IGNORE_ME?: never }); + /** * Type that represents a single method/function name of the given type. */ diff --git a/test/scripts/apidoc/signature.example.ts b/test/scripts/apidoc/signature.example.ts index 9c9b483e5f5..f709100e3ed 100644 --- a/test/scripts/apidoc/signature.example.ts +++ b/test/scripts/apidoc/signature.example.ts @@ -1,4 +1,4 @@ -import type { LiteralUnion } from '../../../src/faker'; +import type { LiteralUnion } from '../../../src/utils/types'; /** * Parameter options type with default from signature. From 7e6ee6ea2227d2f68e2ead149ba14c9ee9f51f7d Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Tue, 3 May 2022 14:07:52 +0200 Subject: [PATCH 8/9] chore: rename file to twister --- src/modules/mersenne/index.ts | 2 +- src/modules/mersenne/{mersenne.ts => twister.ts} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/modules/mersenne/{mersenne.ts => twister.ts} (100%) diff --git a/src/modules/mersenne/index.ts b/src/modules/mersenne/index.ts index 3354edd770e..33e610f84d9 100644 --- a/src/modules/mersenne/index.ts +++ b/src/modules/mersenne/index.ts @@ -1,5 +1,5 @@ import { FakerError } from '../../errors/faker-error'; -import Gen from './mersenne'; +import Gen from './twister'; /** * Module to generate seed based random numbers. diff --git a/src/modules/mersenne/mersenne.ts b/src/modules/mersenne/twister.ts similarity index 100% rename from src/modules/mersenne/mersenne.ts rename to src/modules/mersenne/twister.ts From e493433622df475fe80f068510edec78aae60589 Mon Sep 17 00:00:00 2001 From: Shinigami92 Date: Tue, 3 May 2022 15:38:44 +0200 Subject: [PATCH 9/9] chore: move tests back to there initial position --- test/{modules => }/address.spec.ts | 4 ++-- test/{modules => }/animal.spec.ts | 2 +- test/{modules => }/commerce.spec.ts | 2 +- test/{modules => }/company.spec.ts | 2 +- test/{modules => }/database.spec.ts | 2 +- test/{modules => }/datatype.spec.ts | 2 +- test/{modules => }/date.spec.ts | 2 +- test/{modules => }/fake.spec.ts | 4 ++-- test/{modules => }/finance.spec.ts | 8 ++++---- test/{utils/iban.spec.ts => finance_iban.spec.ts} | 6 +++--- test/{modules => }/git.spec.ts | 2 +- test/{modules => }/hacker.spec.ts | 2 +- test/{modules => }/helpers.spec.ts | 4 ++-- test/{modules => }/image.spec.ts | 2 +- test/{modules => }/internet.spec.ts | 4 ++-- test/{modules => }/lorem.spec.ts | 4 ++-- test/{modules => }/mersenne.spec.ts | 4 ++-- test/{modules => }/music.spec.ts | 2 +- test/{modules => }/name.spec.ts | 2 +- test/{modules => }/phone.spec.ts | 4 ++-- test/{modules => }/random.spec.ts | 4 ++-- test/{modules => }/system.spec.ts | 2 +- test/{modules => }/time.spec.ts | 2 +- test/{modules => }/unique.spec.ts | 4 ++-- test/{modules => }/vehicle.spec.ts | 2 +- test/{modules => }/word.spec.ts | 2 +- 26 files changed, 40 insertions(+), 40 deletions(-) rename test/{modules => }/address.spec.ts (99%) rename test/{modules => }/animal.spec.ts (98%) rename test/{modules => }/commerce.spec.ts (99%) rename test/{modules => }/company.spec.ts (99%) rename test/{modules => }/database.spec.ts (98%) rename test/{modules => }/datatype.spec.ts (99%) rename test/{modules => }/date.spec.ts (99%) rename test/{modules => }/fake.spec.ts (96%) rename test/{modules => }/finance.spec.ts (98%) rename test/{utils/iban.spec.ts => finance_iban.spec.ts} (98%) rename test/{modules => }/git.spec.ts (99%) rename test/{modules => }/hacker.spec.ts (99%) rename test/{modules => }/helpers.spec.ts (99%) rename test/{modules => }/image.spec.ts (99%) rename test/{modules => }/internet.spec.ts (99%) rename test/{modules => }/lorem.spec.ts (99%) rename test/{modules => }/mersenne.spec.ts (97%) rename test/{modules => }/music.spec.ts (97%) rename test/{modules => }/name.spec.ts (99%) rename test/{modules => }/phone.spec.ts (97%) rename test/{modules => }/random.spec.ts (99%) rename test/{modules => }/system.spec.ts (99%) rename test/{modules => }/time.spec.ts (98%) rename test/{modules => }/unique.spec.ts (98%) rename test/{modules => }/vehicle.spec.ts (99%) rename test/{modules => }/word.spec.ts (99%) diff --git a/test/modules/address.spec.ts b/test/address.spec.ts similarity index 99% rename from test/modules/address.spec.ts rename to test/address.spec.ts index 09ae1c20310..6965abe80c7 100644 --- a/test/modules/address.spec.ts +++ b/test/address.spec.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; -import { times } from './../support/times'; +import { faker } from '../src'; +import { times } from './support/times'; function degreesToRadians(degrees: number) { return degrees * (Math.PI / 180.0); diff --git a/test/modules/animal.spec.ts b/test/animal.spec.ts similarity index 98% rename from test/modules/animal.spec.ts rename to test/animal.spec.ts index c85b965df02..a3ad1af6d42 100644 --- a/test/modules/animal.spec.ts +++ b/test/animal.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ { diff --git a/test/modules/commerce.spec.ts b/test/commerce.spec.ts similarity index 99% rename from test/modules/commerce.spec.ts rename to test/commerce.spec.ts index fcee151f81a..87385aa7903 100644 --- a/test/modules/commerce.spec.ts +++ b/test/commerce.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ { diff --git a/test/modules/company.spec.ts b/test/company.spec.ts similarity index 99% rename from test/modules/company.spec.ts rename to test/company.spec.ts index 8b2d43ff10e..6ef8b551aab 100644 --- a/test/modules/company.spec.ts +++ b/test/company.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ { diff --git a/test/modules/database.spec.ts b/test/database.spec.ts similarity index 98% rename from test/modules/database.spec.ts rename to test/database.spec.ts index f9dbdb1730d..75fe6ac36ba 100644 --- a/test/modules/database.spec.ts +++ b/test/database.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ { diff --git a/test/modules/datatype.spec.ts b/test/datatype.spec.ts similarity index 99% rename from test/modules/datatype.spec.ts rename to test/datatype.spec.ts index c6e479ecc0e..54504e02d33 100644 --- a/test/modules/datatype.spec.ts +++ b/test/datatype.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ { diff --git a/test/modules/date.spec.ts b/test/date.spec.ts similarity index 99% rename from test/modules/date.spec.ts rename to test/date.spec.ts index a1a76525dee..4b3350a45a4 100644 --- a/test/modules/date.spec.ts +++ b/test/date.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ { diff --git a/test/modules/fake.spec.ts b/test/fake.spec.ts similarity index 96% rename from test/modules/fake.spec.ts rename to test/fake.spec.ts index e622837063e..2846b9ee9c0 100644 --- a/test/modules/fake.spec.ts +++ b/test/fake.spec.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { faker } from '../../src'; -import { FakerError } from '../../src/errors/faker-error'; +import { faker } from '../src'; +import { FakerError } from '../src/errors/faker-error'; describe('fake', () => { describe('fake()', () => { diff --git a/test/modules/finance.spec.ts b/test/finance.spec.ts similarity index 98% rename from test/modules/finance.spec.ts rename to test/finance.spec.ts index 730d452390d..0a110870e73 100644 --- a/test/modules/finance.spec.ts +++ b/test/finance.spec.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; -import { FakerError } from '../../src/errors/faker-error'; -import ibanLib from '../../src/modules/finance/iban'; -import { luhnCheck } from './../support/luhnCheck'; +import { faker } from '../src'; +import { FakerError } from '../src/errors/faker-error'; +import ibanLib from '../src/modules/finance/iban'; +import { luhnCheck } from './support/luhnCheck'; const seedRuns = [ { diff --git a/test/utils/iban.spec.ts b/test/finance_iban.spec.ts similarity index 98% rename from test/utils/iban.spec.ts rename to test/finance_iban.spec.ts index 153f46075ab..9384c885c6a 100644 --- a/test/utils/iban.spec.ts +++ b/test/finance_iban.spec.ts @@ -1,11 +1,11 @@ import validator from 'validator'; import { describe, expect, it } from 'vitest'; -import { faker } from '../../src'; -import ibanLib from '../../src/modules/finance/iban'; +import { faker } from '../src'; +import ibanLib from '../src/modules/finance/iban'; const NON_SEEDED_BASED_RUN = 25; -describe('iban', () => { +describe('finance_iban', () => { describe('generic IBAN country checks', () => { it.each(ibanLib.formats.map((entry) => entry.country))('%s', (country) => { expect(country).toMatch(/^[A-Z]{2}$/); diff --git a/test/modules/git.spec.ts b/test/git.spec.ts similarity index 99% rename from test/modules/git.spec.ts rename to test/git.spec.ts index e43fafde8c9..30c00e8d98b 100644 --- a/test/modules/git.spec.ts +++ b/test/git.spec.ts @@ -1,6 +1,6 @@ import validator from 'validator'; import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ { diff --git a/test/modules/hacker.spec.ts b/test/hacker.spec.ts similarity index 99% rename from test/modules/hacker.spec.ts rename to test/hacker.spec.ts index 29410e3b6cc..d0311f724a3 100644 --- a/test/modules/hacker.spec.ts +++ b/test/hacker.spec.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ { diff --git a/test/modules/helpers.spec.ts b/test/helpers.spec.ts similarity index 99% rename from test/modules/helpers.spec.ts rename to test/helpers.spec.ts index 5df84c6fd21..e436e6dc3e7 100644 --- a/test/modules/helpers.spec.ts +++ b/test/helpers.spec.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it, vi } from 'vitest'; -import { faker } from '../../src'; -import { luhnCheck } from './../support/luhnCheck'; +import { faker } from '../src'; +import { luhnCheck } from './support/luhnCheck'; const seededRuns = [ { diff --git a/test/modules/image.spec.ts b/test/image.spec.ts similarity index 99% rename from test/modules/image.spec.ts rename to test/image.spec.ts index 8ef91daefc0..bbb99ffaaab 100644 --- a/test/modules/image.spec.ts +++ b/test/image.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; describe('image', () => { describe('lorempicsum', () => { diff --git a/test/modules/internet.spec.ts b/test/internet.spec.ts similarity index 99% rename from test/modules/internet.spec.ts rename to test/internet.spec.ts index c950b4ac417..c12284e221d 100644 --- a/test/modules/internet.spec.ts +++ b/test/internet.spec.ts @@ -1,7 +1,7 @@ import validator from 'validator'; import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; -import { times } from './../support/times'; +import { faker } from '../src'; +import { times } from './support/times'; const seededRuns = [ { diff --git a/test/modules/lorem.spec.ts b/test/lorem.spec.ts similarity index 99% rename from test/modules/lorem.spec.ts rename to test/lorem.spec.ts index 58fa090f353..1338e366502 100644 --- a/test/modules/lorem.spec.ts +++ b/test/lorem.spec.ts @@ -1,7 +1,7 @@ import validator from 'validator'; import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; -import { times } from './../support/times'; +import { faker } from '../src'; +import { times } from './support/times'; const seededRuns = [ { diff --git a/test/modules/mersenne.spec.ts b/test/mersenne.spec.ts similarity index 97% rename from test/modules/mersenne.spec.ts rename to test/mersenne.spec.ts index 527c5f6d80a..4097b1e0abf 100644 --- a/test/modules/mersenne.spec.ts +++ b/test/mersenne.spec.ts @@ -1,6 +1,6 @@ import { beforeAll, beforeEach, describe, expect, it } from 'vitest'; -import { FakerError } from '../../src/errors/faker-error'; -import { Mersenne } from '../../src/modules/mersenne'; +import { FakerError } from '../src/errors/faker-error'; +import { Mersenne } from '../src/modules/mersenne'; type SeededRun = { seed: number | number[]; diff --git a/test/modules/music.spec.ts b/test/music.spec.ts similarity index 97% rename from test/modules/music.spec.ts rename to test/music.spec.ts index 7a291b749a7..3fa51b8eaeb 100644 --- a/test/modules/music.spec.ts +++ b/test/music.spec.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ { diff --git a/test/modules/name.spec.ts b/test/name.spec.ts similarity index 99% rename from test/modules/name.spec.ts rename to test/name.spec.ts index 34c1469f6e8..a182f5f0856 100644 --- a/test/modules/name.spec.ts +++ b/test/name.spec.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ { diff --git a/test/modules/phone.spec.ts b/test/phone.spec.ts similarity index 97% rename from test/modules/phone.spec.ts rename to test/phone.spec.ts index 022c19e6a41..17180156008 100644 --- a/test/modules/phone.spec.ts +++ b/test/phone.spec.ts @@ -1,6 +1,6 @@ import { beforeEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; -import { luhnCheck } from './../support/luhnCheck'; +import { faker } from '../src'; +import { luhnCheck } from './support/luhnCheck'; const seededRuns = [ { diff --git a/test/modules/random.spec.ts b/test/random.spec.ts similarity index 99% rename from test/modules/random.spec.ts rename to test/random.spec.ts index e8312fb1f10..bf081b5c4cc 100644 --- a/test/modules/random.spec.ts +++ b/test/random.spec.ts @@ -1,6 +1,6 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { faker, FakerError } from '../../src'; -import { times } from './../support/times'; +import { faker, FakerError } from '../src'; +import { times } from './support/times'; const seededRuns = [ { diff --git a/test/modules/system.spec.ts b/test/system.spec.ts similarity index 99% rename from test/modules/system.spec.ts rename to test/system.spec.ts index 90ffc70d0cc..dc584ee6fde 100644 --- a/test/modules/system.spec.ts +++ b/test/system.spec.ts @@ -1,6 +1,6 @@ import validator from 'validator'; import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ { diff --git a/test/modules/time.spec.ts b/test/time.spec.ts similarity index 98% rename from test/modules/time.spec.ts rename to test/time.spec.ts index 2a1f5ed8198..c9b7068df99 100644 --- a/test/modules/time.spec.ts +++ b/test/time.spec.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ { diff --git a/test/modules/unique.spec.ts b/test/unique.spec.ts similarity index 98% rename from test/modules/unique.spec.ts rename to test/unique.spec.ts index 5b0d16cd638..909b26a4329 100644 --- a/test/modules/unique.spec.ts +++ b/test/unique.spec.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; -import { FakerError } from '../../src/errors/faker-error'; +import { faker } from '../src'; +import { FakerError } from '../src/errors/faker-error'; const seededRuns = [ { diff --git a/test/modules/vehicle.spec.ts b/test/vehicle.spec.ts similarity index 99% rename from test/modules/vehicle.spec.ts rename to test/vehicle.spec.ts index 7e48dcb2ca9..d6440814bb7 100644 --- a/test/modules/vehicle.spec.ts +++ b/test/vehicle.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ { diff --git a/test/modules/word.spec.ts b/test/word.spec.ts similarity index 99% rename from test/modules/word.spec.ts rename to test/word.spec.ts index dd53ac18bec..f3ef451c202 100644 --- a/test/modules/word.spec.ts +++ b/test/word.spec.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { faker } from '../../src'; +import { faker } from '../src'; const seededRuns = [ {