Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gre-dev committed Sep 18, 2024
1 parent aa23d87 commit 7b9e009
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 23 deletions.
4 changes: 2 additions & 2 deletions __tests__/greip.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as dotenv from "dotenv";
import Greip from "../src/index";
import Greip from "../src/index.mjs";

let greip: Greip;

Expand Down Expand Up @@ -32,7 +32,7 @@ describe("Greip", () => {

test("EmailValidation", async () => {
const data: any = await greip.EmailValidation({
email: "name[at]domain.com"
email: "name[ar]domain.com"
});
expect(data.isValid).toBeFalsy();
});
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"name": "greip-node",
"version": "1.2.1",
"version": "1.2.8",
"description": "Official Node.js library for Greip API",
"author": {
"name": "Greip",
"email": "info@greip.io",
"url": "https://greip.io"
},
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
"type": "module",
"main": "dist/cjs/index.cjs.js",
"types": "dist/cjs/index.d.ts",
"exports": {
"import": "./dist/src/index.js",
"require": "./dist/src/index.js"
},
".": {
"import": "./dist/esm/index.mjs.js",
"require": "./dist/cjs/index.cjs.js"
}
},
"scripts": {
"build:cjs": "tsc --project tsconfig.cjs.json",
"build:esm": "tsc --project tsconfig.esm.json",
Expand All @@ -22,7 +23,7 @@
"test": "jest",
"test --watch": "jest --watchAll",
"format": "prettier --write \"src/**/*.ts\"",
"lint": "tslint -p tsconfig.json",
"lint": "tslint -p tsconfig.cjs.json",
"prepare": "npm run build",
"prepublishOnly": "npm test && npm run lint",
"preversion": "npm run lint",
Expand Down
2 changes: 2 additions & 0 deletions src/index.cjs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Greip from './index.mjs';
module.exports = Greip;
7 changes: 3 additions & 4 deletions src/index.ts → src/index.mjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Greip {
lang1 = lang1.toUpperCase();

// Validate the ip variable
if (ip1.length < 7) {
if (ip1.length < 3) {
reject(new Error("You should pass the `ip` parameter."));
}

Expand Down Expand Up @@ -114,7 +114,7 @@ class Greip {
const mode1 = options.mode || "live";

// Validate the ip variable
if (ip1.length < 7) {
if (ip1.length < 3) {
reject(new Error("You should pass the `ip` parameter."));
}

Expand Down Expand Up @@ -593,7 +593,6 @@ class Greip {
};
}

export { Greip };
// export { Greip };

export default Greip;
module.exports = Greip;
12 changes: 9 additions & 3 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
"compilerOptions": {
"outDir": "./dist",
"module": "commonjs",
"target": "es5",
"moduleResolution": "node"
"target": "es2020",
"outDir": "./dist/cjs",
"rootDir": "./src",
"declaration": true,
"esModuleInterop": true,
"sourceMap": true,
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"strict": true,
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/__tests__/*"]
Expand Down
14 changes: 10 additions & 4 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
{
{
"compilerOptions": {
"outDir": "./dist",
"module": "esnext",
"target": "es6",
"moduleResolution": "node"
"target": "es2020",
"outDir": "./dist/esm",
"rootDir": "./src",
"declaration": true,
"esModuleInterop": true,
"sourceMap": true,
"moduleResolution": "node",
"forceConsistentCasingInFileNames": true,
"strict": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/__tests__/*"]
Expand Down

0 comments on commit 7b9e009

Please sign in to comment.