Skip to content

Commit

Permalink
1.4.3 (#9)
Browse files Browse the repository at this point in the history
* fix: better files in build

* fix: reduce bundle changing axios to fetch
  • Loading branch information
fedeya authored May 29, 2022
1 parent 653617b commit 2b5ce2e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 29 deletions.
24 changes: 17 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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"
},
Expand Down
19 changes: 12 additions & 7 deletions src/client.ts
Original file line number Diff line number Diff line change
@@ -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<User>('/api/sanity/signUp', {
...data
export const signUp = async (payload: SignUpPayload): Promise<User> => {
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;
};
4 changes: 2 additions & 2 deletions src/credentials.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
12 changes: 0 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 2b5ce2e

Please sign in to comment.