Skip to content

Commit

Permalink
refactor: create some module sub folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed May 3, 2022
1 parent 0a214d5 commit 18a0099
Show file tree
Hide file tree
Showing 15 changed files with 23 additions and 25 deletions.
2 changes: 0 additions & 2 deletions scripts/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...
Expand All @@ -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,
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/modules/finance.ts → src/modules/finance/index.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 5 additions & 5 deletions src/modules/image.ts → src/modules/image/index.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Faker } from '../..';
import type { Faker } from '../../..';

/**
* Module to generate links to random images on `https://picsum.photos/`.
Expand Down
Original file line number Diff line number Diff line change
@@ -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/`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Faker } from '../..';
import type { Faker } from '../../..';

/**
* Module to generate links to random images on `https://source.unsplash.com/`.
Expand Down
4 changes: 2 additions & 2 deletions src/modules/internet.ts → src/modules/internet/index.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
4 changes: 2 additions & 2 deletions src/modules/mersenne.ts → src/modules/mersenne/index.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/modules/unique.ts → src/modules/unique/index.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/utils/unique.ts → src/modules/unique/unique.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FakerError } from '../errors/faker-error';
import { FakerError } from '../../errors/faker-error';

export type RecordKey = string | number | symbol;

Expand Down
2 changes: 1 addition & 1 deletion test/modules/finance.spec.ts
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion test/utils/iban.spec.ts
Original file line number Diff line number Diff line change
@@ -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;

Expand Down

0 comments on commit 18a0099

Please sign in to comment.