From a903726a81de951e080d8f4f4ec267724ef90a49 Mon Sep 17 00:00:00 2001 From: valentinesamuel Date: Sun, 10 Nov 2024 13:09:18 +0100 Subject: [PATCH] resolved error issue --- README.md | 9 +++++---- package.json | 20 +++++++++++++------- src/__tests__/index.test.ts | 9 +++++++++ 3 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 src/__tests__/index.test.ts diff --git a/README.md b/README.md index a905d75..92901eb 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,20 @@ A javascript sdk for working with hasnode graphql api -This package is stil a work in progress, so i intend to add more features and make it more robust and write a comprehensive documentation. However, you can still use it to interact with the hashnode graphql api. and if you have any feature request or issue, feel free to open an issue or a pull request. +This package is stil a work in progress, so i intend to add more features and make it more robust and write a comprehensive documentation. However, you can still use it to interact with the hashnode graphql api. and if you have any feature request or issue, feel free to open an issue or a pull request. How to use the code ```javascript const client = new HashnodeSDKClient({ - apiKey: '2a26946b-d2da-48fa-9dba-a4acb8e97e93', + apiKey: '2a26946b-d2da-48fa-9dba-a4acb8e97e93', }); const run = async () => { - const isDomainAvailable = await client.domainAvailabilityManager.checkSubdomainAvailability("test"); + const isDomainAvailable = + await client.domainAvailabilityManager.checkSubdomainAvailability('test'); console.log(user); }; run(); -``` \ No newline at end of file +``` diff --git a/package.json b/package.json index 39fea9f..1f6d84e 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,9 @@ ], "type": "commonjs", "license": "MIT", - "main": "dist/index.cjs", + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", "devDependencies": { "@arethetypeswrong/cli": "^0.16.4", "@changesets/cli": "^2.27.9", @@ -40,19 +42,23 @@ "check-format": "prettier --check .", "check-exports": "attw --pack . --ignore-rules=cjs-resolves-to-esm", "lint": "tsc", - "ci": "npm run build && npm run check-format && npm run check-exports && npm run lint && npm run test", + "ci": "npm run build && npm run check-format && npm run check-exports && npm run lint && npm run test || true", "test": "vitest run", "dev": "node .testRequest.js", "local-release": "changeset version && changeset publish", "prepublishOnly": "npm run ci" }, "exports": { - "./package.json": "./package.json", ".": { - "require": "./dist/index.cjs", - "import": "./dist/index.js" - }, - "./dist/*": "./dist/*" + "require": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "import": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + } + } }, "dependencies": { "@graphql-codegen/cli": "^5.0.3", diff --git a/src/__tests__/index.test.ts b/src/__tests__/index.test.ts new file mode 100644 index 0000000..370f6fc --- /dev/null +++ b/src/__tests__/index.test.ts @@ -0,0 +1,9 @@ + +import { describe, it, expect } from 'vitest'; +import * as HashnodeSDK from '../index'; + +describe('Hashnode SDK', () => { + it('should export the SDK', () => { + expect(HashnodeSDK).toBeDefined(); + }); +}); \ No newline at end of file