diff --git a/packages/i18nify-js/banking.js b/packages/i18nify-js/banking.js new file mode 100644 index 00000000..341cd6d0 --- /dev/null +++ b/packages/i18nify-js/banking.js @@ -0,0 +1 @@ +export * from './lib/esm/banking'; diff --git a/packages/i18nify-js/geo.js b/packages/i18nify-js/geo.js new file mode 100644 index 00000000..316dc015 --- /dev/null +++ b/packages/i18nify-js/geo.js @@ -0,0 +1 @@ +export * from './lib/esm/geo'; diff --git a/packages/i18nify-js/jest.config.ts b/packages/i18nify-js/jest.config.ts index d51a3aec..52d3ffd1 100644 --- a/packages/i18nify-js/jest.config.ts +++ b/packages/i18nify-js/jest.config.ts @@ -4,7 +4,11 @@ const config = { testEnvironment: 'jsdom', testMatch: ['**/__tests__/**/*.test.[jt]s?(x)', '**/?(*.)+test.[jt]s?(x)'], collectCoverageFrom: ['**/*.{ts,js}', '!coverage/**/*.{ts,tsx,js,jsx}'], - coveragePathIgnorePatterns: ['blackbox', '.spec.ts'], + coveragePathIgnorePatterns: [ + 'blackbox', + '.spec.ts', + 'modules/shared/index.ts$', + ], coverageThreshold: { './src/': { statements: 0, diff --git a/packages/i18nify-js/scripts/generate-root-imports.js b/packages/i18nify-js/scripts/generate-root-imports.js index e21c97ec..1195c3cd 100644 --- a/packages/i18nify-js/scripts/generate-root-imports.js +++ b/packages/i18nify-js/scripts/generate-root-imports.js @@ -13,7 +13,14 @@ const fs = require('fs'); const path = require('path'); // TODO: Currently, we will have to manually add every new module that we create. Automate this in future. -const EXPORT_MODULES = ['currency', 'phoneNumber', 'core', 'types']; +const EXPORT_MODULES = [ + 'currency', + 'phoneNumber', + 'core', + 'types', + 'geo', + 'banking', +]; const BUILD_DIRECTORY = 'lib'; try { diff --git a/packages/i18nify-js/src/modules/banking/getListOfBanks.ts b/packages/i18nify-js/src/modules/banking/getListOfBanks.ts index 9b9ad83f..87e5611a 100644 --- a/packages/i18nify-js/src/modules/banking/getListOfBanks.ts +++ b/packages/i18nify-js/src/modules/banking/getListOfBanks.ts @@ -3,7 +3,7 @@ import { I18nifyCountryCodeType } from '../geo/types'; import { I18NIFY_DATA_SOURCE, I18NIFY_DATA_SUPPORTED_COUNTRIES, -} from '../sourceConstants'; +} from '../shared/sourceConstants'; /** * Retrieves the list of all banks available for a specified country. diff --git a/packages/i18nify-js/src/modules/geo/__tests__/getFlagOfCountry.test.ts b/packages/i18nify-js/src/modules/geo/__tests__/getFlagOfCountry.test.ts index 2052758d..983d93ce 100644 --- a/packages/i18nify-js/src/modules/geo/__tests__/getFlagOfCountry.test.ts +++ b/packages/i18nify-js/src/modules/geo/__tests__/getFlagOfCountry.test.ts @@ -1,6 +1,9 @@ import { getFlagOfCountry } from '../index'; import { LIST_OF_ALL_COUNTRIES } from '../data/listOfAllCountries'; -import { FLAG_4X3_BASE_PATH, FLAG_BASE_PATH } from '../../sourceConstants'; +import { + FLAG_4X3_BASE_PATH, + FLAG_BASE_PATH, +} from '../../shared/sourceConstants'; import { CountryCodeType } from '../../types'; describe('geo - getFlagOfCountry', () => { diff --git a/packages/i18nify-js/src/modules/geo/__tests__/getFlagsForAllCountries.test.ts b/packages/i18nify-js/src/modules/geo/__tests__/getFlagsForAllCountries.test.ts index 3b29976f..10cd442d 100644 --- a/packages/i18nify-js/src/modules/geo/__tests__/getFlagsForAllCountries.test.ts +++ b/packages/i18nify-js/src/modules/geo/__tests__/getFlagsForAllCountries.test.ts @@ -1,6 +1,9 @@ import { getFlagsForAllCountries } from '../index'; import { LIST_OF_ALL_COUNTRIES } from '../data/listOfAllCountries'; -import { FLAG_4X3_BASE_PATH, FLAG_BASE_PATH } from '../../sourceConstants'; +import { + FLAG_4X3_BASE_PATH, + FLAG_BASE_PATH, +} from '../../shared/sourceConstants'; import { CountryCodeType } from '../../types'; describe('geo - getFlagsForAllCountries', () => { diff --git a/packages/i18nify-js/src/modules/geo/getAllCountries.ts b/packages/i18nify-js/src/modules/geo/getAllCountries.ts index c1df148b..b4772bf3 100644 --- a/packages/i18nify-js/src/modules/geo/getAllCountries.ts +++ b/packages/i18nify-js/src/modules/geo/getAllCountries.ts @@ -1,6 +1,6 @@ import { withErrorBoundary } from '../../common/errorBoundary'; import { CountryCodeType } from '../types'; -import { I18NIFY_DATA_SOURCE } from '../sourceConstants'; +import { I18NIFY_DATA_SOURCE } from '../shared/sourceConstants'; import { CountryMetaType } from './types'; /** diff --git a/packages/i18nify-js/src/modules/geo/getCities.ts b/packages/i18nify-js/src/modules/geo/getCities.ts index 66d83ab4..7f4eec81 100644 --- a/packages/i18nify-js/src/modules/geo/getCities.ts +++ b/packages/i18nify-js/src/modules/geo/getCities.ts @@ -2,7 +2,7 @@ import { withErrorBoundary } from '../../common/errorBoundary'; import { I18NIFY_DATA_SOURCE, I18NIFY_DATA_SUPPORTED_COUNTRIES, -} from '../sourceConstants'; +} from '../shared/sourceConstants'; import { I18nifyCountryCodeType } from './types'; /** diff --git a/packages/i18nify-js/src/modules/geo/getFlagOfCountry.ts b/packages/i18nify-js/src/modules/geo/getFlagOfCountry.ts index 8ec82f58..d75ac8d6 100644 --- a/packages/i18nify-js/src/modules/geo/getFlagOfCountry.ts +++ b/packages/i18nify-js/src/modules/geo/getFlagOfCountry.ts @@ -1,6 +1,6 @@ import { CountryCodeType, GetFlagReturnType } from '../types'; import { withErrorBoundary } from '../../common/errorBoundary'; -import { FLAG_4X3_BASE_PATH, FLAG_BASE_PATH } from '../sourceConstants'; +import { FLAG_4X3_BASE_PATH, FLAG_BASE_PATH } from '../shared/sourceConstants'; import { isCountryValid } from './utils'; /** diff --git a/packages/i18nify-js/src/modules/geo/getFlagsForAllCountries.ts b/packages/i18nify-js/src/modules/geo/getFlagsForAllCountries.ts index 17549363..01163b24 100644 --- a/packages/i18nify-js/src/modules/geo/getFlagsForAllCountries.ts +++ b/packages/i18nify-js/src/modules/geo/getFlagsForAllCountries.ts @@ -1,6 +1,6 @@ import { withErrorBoundary } from '../../common/errorBoundary'; import { LIST_OF_ALL_COUNTRIES } from './data/listOfAllCountries'; -import { FLAG_4X3_BASE_PATH, FLAG_BASE_PATH } from '../sourceConstants'; +import { FLAG_4X3_BASE_PATH, FLAG_BASE_PATH } from '../shared/sourceConstants'; import { GetFlagReturnType, CountryCodeType } from '../types'; /** diff --git a/packages/i18nify-js/src/modules/geo/getStates.ts b/packages/i18nify-js/src/modules/geo/getStates.ts index 0fb1a9c1..6d5ec2f6 100644 --- a/packages/i18nify-js/src/modules/geo/getStates.ts +++ b/packages/i18nify-js/src/modules/geo/getStates.ts @@ -2,7 +2,7 @@ import { withErrorBoundary } from '../../common/errorBoundary'; import { I18NIFY_DATA_SOURCE, I18NIFY_DATA_SUPPORTED_COUNTRIES, -} from '../sourceConstants'; +} from '../shared/sourceConstants'; import { I18nifyCountryCodeType } from './types'; /** diff --git a/packages/i18nify-js/src/modules/geo/getZipcodes.ts b/packages/i18nify-js/src/modules/geo/getZipcodes.ts index ec749f88..4c3511ed 100644 --- a/packages/i18nify-js/src/modules/geo/getZipcodes.ts +++ b/packages/i18nify-js/src/modules/geo/getZipcodes.ts @@ -3,7 +3,7 @@ import { CountryCodeType } from '../types'; import { I18NIFY_DATA_SOURCE, I18NIFY_DATA_SUPPORTED_COUNTRIES, -} from '../sourceConstants'; +} from '../shared/sourceConstants'; import { CountryDetailType } from './types'; /** diff --git a/packages/i18nify-js/src/modules/shared/index.ts b/packages/i18nify-js/src/modules/shared/index.ts new file mode 100644 index 00000000..f748496a --- /dev/null +++ b/packages/i18nify-js/src/modules/shared/index.ts @@ -0,0 +1,6 @@ +export { + FLAG_4X3_BASE_PATH, + FLAG_BASE_PATH, + I18NIFY_DATA_SOURCE, + I18NIFY_DATA_SUPPORTED_COUNTRIES, +} from './sourceConstants'; diff --git a/packages/i18nify-js/src/modules/sourceConstants.ts b/packages/i18nify-js/src/modules/shared/sourceConstants.ts similarity index 100% rename from packages/i18nify-js/src/modules/sourceConstants.ts rename to packages/i18nify-js/src/modules/shared/sourceConstants.ts