Skip to content

Commit 222df9e

Browse files
committed
fix website and admin imports
1 parent e1ee407 commit 222df9e

File tree

16 files changed

+1827
-357
lines changed

16 files changed

+1827
-357
lines changed

apps/admin/.env.sample

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
GOOGLE_CLIENT_ID=
22
GOOGLE_CLIENT_SECRET=
33
NEXTAUTH_URL=http://localhost:3020
4-
NEXTAUTH_SECRET=LlKq6ZtYbr+hTC073mAmAh9/h2HwMfsFo4hrfCx5mLg=
4+
NEXTAUTH_SECRET=your-next-auth-secret-key
55
DATABASE_URL=

apps/admin/package.json

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "ra-prisma-nextjs-admin",
2+
"name": "admin",
33
"version": "0.0.0",
44
"private": true,
55
"scripts": {
@@ -10,30 +10,30 @@
1010
"kill": "kill -9 $(lsof -t -i:3020)"
1111
},
1212
"dependencies": {
13-
"@babel/core": "7.21.3",
14-
"@mui/icons-material": "^5.11.11",
15-
"@mui/material": "^5.11.13",
16-
"@mui/styles": "^5.11.13",
17-
"axios": "^0.27.2",
13+
"@babel/core": "7.21.4",
14+
"@mui/icons-material": "^5.11.16",
15+
"@mui/material": "^5.12.0",
16+
"@mui/styles": "^5.12.0",
17+
"axios": "^1.3.5",
1818
"db": "workspace:*",
1919
"lodash": "^4.17.21",
20-
"next": "13.2.4",
21-
"next-auth": "^4.20.1",
20+
"next": "13.3.0",
21+
"next-auth": "^4.22.0",
2222
"next-auth-prisma-adapter": "workspace:*",
2323
"ra-data-simple-prisma": "workspace:*",
2424
"react": "18.2.0",
25-
"react-admin": "^4.8.4",
25+
"react-admin": "^4.9.2",
2626
"react-admin-json-view": "^2.0.0",
2727
"react-dom": "18.2.0"
2828
},
2929
"devDependencies": {
30-
"@types/lodash": "^4.14.191",
31-
"@types/node": "18.15.3",
32-
"@types/react": "18.0.28",
30+
"@types/lodash": "^4.14.192",
31+
"@types/node": "18.15.11",
32+
"@types/react": "18.0.34",
3333
"@types/react-dom": "18.0.11",
3434
"config": "workspace:*",
35-
"eslint": "8.36.0",
36-
"eslint-config-next": "13.2.4",
37-
"typescript": "5.0.2"
35+
"eslint": "8.38.0",
36+
"eslint-config-next": "13.3.0",
37+
"typescript": "5.0.4"
3838
}
3939
}

apps/admin/pages/api/[resource].ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { NextApiRequest, NextApiResponse } from "next";
22
import { defaultHandler } from "ra-data-simple-prisma";
33
import { apiHandler } from "../../middlewares/apiHandler";
4-
import prismaClient from "db";
4+
import { prismaClient } from "db";
55

66
export default apiHandler(
77
async (req: NextApiRequest, res: NextApiResponse, auth) => {

apps/admin/pages/api/auth/[...nextauth].ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import NextAuth from "next-auth";
22
import GoogleProvider from "next-auth/providers/google";
33
import { PrismaAdapter } from "next-auth-prisma-adapter";
4-
import prismaClient from "db";
4+
import { prismaClient } from "db";
55
import CredentialsProvider from "next-auth/providers/credentials";
66

77
export default async function auth(req: any, res: any) {
@@ -50,8 +50,6 @@ export default async function auth(req: any, res: any) {
5050
return Promise.resolve(true);
5151
}
5252

53-
if (account?.provider === "google") return Promise.resolve(false);
54-
5553
//restrict domain
5654
if (
5755
process.env.RESTRICT_EMAIL_DOMAIN &&

apps/admin/pages/api/post.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import prismaClient from "db";
1+
import { prismaClient } from "db";
22
import type { NextApiRequest, NextApiResponse } from "next";
33
import {
44
defaultHandler,

apps/admin/pages/api/user.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
updateHandler,
66
} from "ra-data-simple-prisma";
77
import { apiHandler } from "../../middlewares/apiHandler";
8-
import prismaClient from "db";
8+
import { prismaClient } from "db";
99
import { Prisma } from "@prisma/client";
1010

1111
export default apiHandler(async (req: NextApiRequest, res: NextApiResponse) => {

apps/admin/resources/Post.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
EditProps,
2020
NumberInput,
2121
ReferenceField,
22+
CloneButton,
2223
} from "react-admin";
2324
import { AutocompleteFilter } from "../filters/AutocompleteFilter";
2425

@@ -53,6 +54,7 @@ export const PostList = (props: ListProps) => (
5354
<ChipField source="name" />
5455
</SingleFieldList>
5556
</ReferenceArrayField>
57+
<CloneButton />
5658
</Datagrid>
5759
</List>
5860
);

apps/admin/resources/Tag.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
Create,
99
SimpleForm,
1010
TextInput,
11+
CloneButton,
1112
} from "react-admin";
1213

1314
export const TagCreate = (props: CreateProps) => (
@@ -25,6 +26,7 @@ export const TagList = (props: ListProps) => (
2526
<TextField source="name" />
2627
<DateField source="createdAt" />
2728
<DateField source="updatedAt" />
29+
<CloneButton />
2830
</Datagrid>
2931
</List>
3032
);

apps/website/pages/api/auth/[...nextauth].ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import NextAuth, { Session, User } from "next-auth";
22
import GoogleProvider from "next-auth/providers/google";
3-
import prismaClient from "db";
3+
import { prismaClient } from "db";
44

55
export default async function auth(req: any, res: any) {
66
return await NextAuth(req, res, {

apps/website/pages/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GetServerSideProps, NextPage } from "next/types";
22
import { Post } from "@prisma/client";
3-
import prismaClient from "db";
3+
import { prismaClient } from "db";
44

55
const HomePage: NextPage<{ posts: Post[] }> = ({ posts }) => {
66
return (

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
"kill": "pnpm run kill --filter {'apps'}"
1414
},
1515
"devDependencies": {
16-
"turbo": "^1.8.3"
16+
"turbo": "^1.9.0"
1717
}
1818
}

packages/db/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
"test": "jest"
1515
},
1616
"dependencies": {
17-
"@prisma/client": "^4.11.0"
17+
"@prisma/client": "^4.12.0"
1818
},
1919
"devDependencies": {
2020
"jest": "^29.5.0",
21-
"prisma": "^4.11.0",
21+
"prisma": "^4.12.0",
2222
"tsup": "^6.7.0",
23-
"typescript": "^5.0.2"
23+
"typescript": "^5.0.4"
2424
}
2525
}

packages/next-auth-prisma-adapter/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ You can now override in your second app the model names:
122122

123123
```js
124124
import { PrismaAdapter } from "next-auth-prisma-adapter";
125-
import prismaClient from "path/to/your/client";
125+
import { prismaClient } from "path/to/your/client";
126126
...
127127

128128
return await NextAuth(req, res, {

packages/next-auth-prisma-adapter/package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"module": "./dist/index.mjs",
77
"types": "./dist/index.d.ts",
88
"scripts": {
9-
"build": "tsup src/index.ts --dts",
10-
"dev": "tsup src/index.ts --format esm,cjs --watch --dts",
9+
"build": "tsup src/index.ts --format esm,cjs --dts --treeshake",
10+
"dev": "pnpm build --watch",
1111
"lint": "TIMING=1 eslint src --fix",
1212
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
1313
"prepublish": "pnpm build",
@@ -31,7 +31,8 @@
3131
},
3232
"devDependencies": {
3333
"jest": "^29.5.0",
34+
"next-auth": "^4.22.0",
3435
"tsup": "^6.7.0",
35-
"typescript": "^5.0.2"
36+
"typescript": "^5.0.4"
3637
}
3738
}

packages/ra-data-simple-prisma/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"module": "./dist/index.mjs",
77
"types": "./dist/index.d.ts",
88
"scripts": {
9-
"build": "tsup src/index.ts --format esm,cjs --dts",
9+
"build": "tsup src/index.ts --format esm,cjs --dts --treeshake",
1010
"dev": "pnpm build --watch",
1111
"lint": "TIMING=1 eslint src --fix",
1212
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
@@ -29,7 +29,7 @@
2929
],
3030
"repository": {
3131
"type": "git",
32-
"url": "https://github.com/codeledge/ra-prisma-nextjs.git",
32+
"url": "https://github.com/codeledge/ra-data-simple-prisma.git",
3333
"directory": "packages/ra-data-simple-prisma"
3434
},
3535
"author": "Orlando Groppo <[email protected]>",

0 commit comments

Comments
 (0)