diff --git a/package.json b/package.json index 8068a1d..ee16f0a 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "next-auth-sanity", "description": "NextAuth Adapter for Sanity", - "version": "1.4.1", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "version": "1.4.3", + "main": "index.js", + "types": "index.d.ts", "repository": { "type": "git", "url": "git+https://github.com/Fedeya/next-auth-sanity.git" @@ -12,8 +12,18 @@ "license": "MIT", "private": false, "files": [ - "dist/*.{js,d.ts}", - "dist/**/*.{js,d.ts}" + "index.js", + "index.d.ts", + "queries.js", + "queries.d.ts", + "adapter.js", + "adapter.d.ts", + "client.js", + "client.d.ts", + "schemas.js", + "schemas.d.ts", + "credentials.js", + "credentials.d.ts" ], "keywords": [ "next-auth", @@ -23,7 +33,8 @@ ], "scripts": { "build": "tsc", - "prepublish": "tsc" + "clean": "rm -rf index.js index.d.ts queries.js queries.ts queries.d.ts adapter.js adapter.ts adapter.d.ts client.js client.ts client.d.ts schemas.js schemas.ts schemas.d.ts credentials.js credentials.ts credentials.d.ts", + "prepublishOnly": "yarn build" }, "devDependencies": { "@types/lru-cache": "^5.1.0", @@ -34,7 +45,6 @@ "@sanity/client": "^2.8.0", "@sanity/uuid": "^3.0.1", "argon2": "^0.27.2", - "axios": "^0.21.1", "groq": "^2.2.6", "next-auth": "^4.3.2" }, diff --git a/src/client.ts b/src/client.ts index 980a694..2c20039 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,17 +1,22 @@ -import { User } from 'next-auth'; -import axios from 'axios'; +import type { User } from 'next-auth'; -export interface SignUpData { +export interface SignUpPayload { email: string; password: string; name?: string; image?: string; } -export const signUp = async (data: SignUpData) => { - const res = await axios.post('/api/sanity/signUp', { - ...data +export const signUp = async (payload: SignUpPayload): Promise => { + const res = await fetch('/api/sanity/signUp', { + method: 'POST', + body: JSON.stringify(payload), + headers: { + 'Content-Type': 'application/json' + } }); - return res.data; + const user = await res.json(); + + return user; }; diff --git a/src/credentials.ts b/src/credentials.ts index 3418d76..04ac52f 100644 --- a/src/credentials.ts +++ b/src/credentials.ts @@ -1,6 +1,6 @@ -import { CredentialsProvider } from 'next-auth/providers'; +import type { CredentialsProvider } from 'next-auth/providers'; import Credentials from 'next-auth/providers/credentials'; -import { SanityClient } from '@sanity/client'; +import type { SanityClient } from '@sanity/client'; import { getUserByEmailQuery } from './queries'; import argon2 from 'argon2'; import { uuid } from '@sanity/uuid'; diff --git a/tsconfig.json b/tsconfig.json index 9985023..c89c97c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,7 @@ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./dist", /* Redirect output structure to the directory. */ + "outDir": ".", /* Redirect output structure to the directory. */ "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ diff --git a/yarn.lock b/yarn.lock index bf25b1f..8a1a8a0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -146,13 +146,6 @@ argon2@^0.27.2: node-addon-api "^3.0.2" opencollective-postinstall "^2.0.3" -axios@^0.21.1: - version "0.21.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" - integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== - dependencies: - follow-redirects "^1.10.0" - balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -253,11 +246,6 @@ eventsource@^1.0.6: dependencies: original "^1.0.0" -follow-redirects@^1.10.0: - version "1.14.0" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.0.tgz#f5d260f95c5f8c105894491feee5dc8993b402fe" - integrity sha512-0vRwd7RKQBTt+mgu87mtYeofLFZpTas2S9zY+jIeuLJMNvudIgF52nr19q40HOwH5RrhWIPuj9puybzSJiRrVg== - follow-redirects@^1.2.4: version "1.13.3" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.3.tgz#e5598ad50174c1bc4e872301e82ac2cd97f90267"