From 2fc54d5d8f2157fdaabc8c97cea9e0a7a3061b5d Mon Sep 17 00:00:00 2001 From: Mohamed Meabed Date: Mon, 5 Feb 2024 10:17:28 -0500 Subject: [PATCH 1/3] chore: update pkgs --- {tools => .scripts}/prepare.js | 11 +++++-- {test => __tests__}/carrier.test.ts | 0 {test => __tests__}/index.test.ts | 0 package.json | 4 +-- src/locales.ts | 46 ++--------------------------- 5 files changed, 12 insertions(+), 49 deletions(-) rename {tools => .scripts}/prepare.js (95%) rename {test => __tests__}/carrier.test.ts (100%) rename {test => __tests__}/index.test.ts (100%) diff --git a/tools/prepare.js b/.scripts/prepare.js similarity index 95% rename from tools/prepare.js rename to .scripts/prepare.js index eb3c319..a8807c4 100644 --- a/tools/prepare.js +++ b/.scripts/prepare.js @@ -16,7 +16,7 @@ const BSON = require('bson') const isDir = (source) => lstatSync(source).isDirectory() -const prepareLocale = async (localePath, locale, type) => { +async function prepareLocale(localePath, locale, type) { const fileRe = /[0-9]+\.txt/ const files = readdirSync(localePath).filter((source) => fileRe.test(source)) const lineRe = /^([0-9]+)\|(.*)$/ @@ -48,7 +48,7 @@ const prepareLocale = async (localePath, locale, type) => { } } -const preparePath = async (dataPath, type) => { +async function preparePath(dataPath, type) { const locales = readdirSync(dataPath).filter((source) => isDir(join(dataPath, source)) ) @@ -63,7 +63,7 @@ const preparePath = async (dataPath, type) => { return { locales } } -const prepareTimezones = async () => { +async function prepareTimezones() { const lineRe = /^([0-9]+)\|(.*)$/ let data = {} const file = join( @@ -119,4 +119,9 @@ const prepare = async () => { console.log('Creating types...') writeFileSync(join(__dirname, '/../src/locales.ts'), generatedTypes) } + prepare() + .then() + .catch((e) => { + console.error(`error`, e) + }) diff --git a/test/carrier.test.ts b/__tests__/carrier.test.ts similarity index 100% rename from test/carrier.test.ts rename to __tests__/carrier.test.ts diff --git a/test/index.test.ts b/__tests__/index.test.ts similarity index 100% rename from test/index.test.ts rename to __tests__/index.test.ts diff --git a/package.json b/package.json index ded2f5d..a46c9a0 100644 --- a/package.json +++ b/package.json @@ -34,9 +34,9 @@ ], "scripts": { "build": "rimraf lib && rollup -c --bundleConfigAsCjs", - "preparemetadata": "rimraf resources && node tools/prepare.js && rimraf resources/libphonenumber", + "preparemetadata": "rimraf resources && node .scripts/prepare.js && rimraf resources/libphonenumber", "prepublishOnly": "yarn build", - "prettier": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", + "prettier": "prettier --write \\\"src/**/*.ts\\\" \\\"__tests__/**/*.ts\\\"", "test": "jest", "watch": "rimraf lib && rollup -cw" }, diff --git a/src/locales.ts b/src/locales.ts index 0eaf57f..9d4412e 100644 --- a/src/locales.ts +++ b/src/locales.ts @@ -1,45 +1,3 @@ /* THIS FILE IS AUTOGENERATED. */ -export type GeocoderLocale = - | 'ar' - | 'be' - | 'bg' - | 'bs' - | 'de' - | 'el' - | 'en' - | 'es' - | 'fa' - | 'fi' - | 'fr' - | 'hr' - | 'hu' - | 'hy' - | 'id' - | 'it' - | 'iw' - | 'ja' - | 'ko' - | 'nl' - | 'pl' - | 'pt' - | 'ro' - | 'ru' - | 'sq' - | 'sr' - | 'sv' - | 'th' - | 'tr' - | 'uk' - | 'vi' - | 'zh' - | 'zh_Hant' -export type CarrierLocale = - | 'ar' - | 'be' - | 'en' - | 'fa' - | 'ko' - | 'ru' - | 'uk' - | 'zh' - | 'zh_Hant' +export type GeocoderLocale = 'ar' | 'be' | 'bg' | 'bs' | 'de' | 'el' | 'en' | 'es' | 'fa' | 'fi' | 'fr' | 'hr' | 'hu' | 'hy' | 'id' | 'it' | 'iw' | 'ja' | 'ko' | 'nl' | 'pl' | 'pt' | 'ro' | 'ru' | 'sq' | 'sr' | 'sv' | 'th' | 'tr' | 'uk' | 'vi' | 'zh' | 'zh_Hant'; +export type CarrierLocale = 'ar' | 'be' | 'en' | 'fa' | 'ko' | 'ru' | 'uk' | 'zh' | 'zh_Hant'; From bd9dbb6a9c13814761d4ae482eb6edb5bfc43d26 Mon Sep 17 00:00:00 2001 From: Mohamed Meabed Date: Mon, 5 Feb 2024 10:43:06 -0500 Subject: [PATCH 2/3] chore: update pkgs --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a46c9a0..d90f0c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devmehq/phone-number-validator-js", - "version": "1.2.12", + "version": "1.2.13", "description": "Verify phone number, validate format, checking carrier name, geo and timezone infos.", "keywords": [ "telephone", From d07070bdcad76bd85719c5a474a594c8845d39fa Mon Sep 17 00:00:00 2001 From: Mohamed Meabed Date: Mon, 5 Feb 2024 10:50:02 -0500 Subject: [PATCH 3/3] chore: update pkgs --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8d6b01..0e9c57e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## v1.2.13 +- Update dependencies +- Refactor tests + +## v1.2.12 +- Update dependencies + ## v1.2.11 - Update license from MIT to BSL-1.1 - Update dependencies