Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Commit

Permalink
0.0.10 (#16)
Browse files Browse the repository at this point in the history
* 0.0.10

* update packages

* stage fixed changes

* remove sentry env vars

* admin improvements

* export prisma

* update missing files

* update packages

* lock next-admin to 4.0.0
  • Loading branch information
nahtnam authored May 13, 2024
1 parent ceb26b8 commit 6ace5fb
Show file tree
Hide file tree
Showing 12 changed files with 307 additions and 571 deletions.
3 changes: 2 additions & 1 deletion lefthook.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"parallel": true,
"commands": {
"lint": {
"run": "npm run lint"
"run": "npm run lint",
"stage_fixed": true
},
"spellcheck": {
"run": "npm run spellcheck"
Expand Down
3 changes: 0 additions & 3 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ export default withSentryConfig(
nextConfig,
{
silent: true,
org: env.SENTRY_ORG,
project: env.SENTRY_PROJECT,
url: env.SENTRY_URL,
},
{
widenClientFileUpload: true,
Expand Down
807 changes: 269 additions & 538 deletions package-lock.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
"@hookform/resolvers": "^3.3.4",
"@lucia-auth/adapter-prisma": "^4.0.1",
"@nextui-org/react": "^2.3.6",
"@premieroctet/next-admin": "^4.1.0",
"@premieroctet/next-admin": "^4.0.0",
"@prisma/client": "^5.13.0",
"@react-email/components": "^0.0.17",
"@sentry/nextjs": "^7.113.0",
"@sentry/nextjs": "^7.114.0",
"@t3-oss/env-nextjs": "^0.9.2",
"@tanstack/react-query": "^5.35.1",
"@tanstack/react-query-devtools": "^5.35.1",
"@tanstack/react-query": "^5.36.0",
"@tanstack/react-query-devtools": "^5.36.0",
"@trpc/client": "^11.0.0-rc.354",
"@trpc/react-query": "^11.0.0-rc.354",
"@trpc/server": "^11.0.0-rc.354",
"@zenstackhq/runtime": "^2.0.3",
"cookies-next": "^4.1.1",
"framer-motion": "^11.1.7",
"framer-motion": "^11.1.9",
"lucia": "^3.2.0",
"ms": "^2.1.3",
"next": "^14.2.3",
Expand All @@ -41,27 +41,27 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-hook-form": "^7.51.4",
"react-icons": "^5.2.0",
"react-icons": "^5.2.1",
"sharp": "^0.33.3",
"sonner": "^1.4.41",
"tailwind-merge": "^2.3.0",
"tslog": "^4.9.2",
"uuid": "^9.0.1",
"zod": "^3.23.6",
"zod-validation-error": "^3.2.0"
"zod": "^3.23.8",
"zod-validation-error": "^3.3.0"
},
"devDependencies": {
"@biomejs/biome": "^1.7.2",
"@biomejs/biome": "^1.7.3",
"@tailwindcss/typography": "^0.5.13",
"@types/ms": "^0.7.34",
"@types/node": "^20.12.8",
"@types/node": "^20.12.11",
"@types/nodemailer": "^6.4.15",
"@types/react": "^18.3.1",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"@types/uuid": "^9.0.8",
"autoprefixer": "^10.4.19",
"cpx2": "^7.0.1",
"cspell": "^8.8.0",
"cspell": "^8.8.1",
"lefthook": "^1.6.10",
"next-superjson-plugin": "^0.6.3",
"postcss": "^8.4.38",
Expand All @@ -73,7 +73,7 @@
"zenstack": "^2.0.3"
},
"shipzen": {
"version": "0.0.9"
"version": "0.0.10"
},
"wireit": {
"build": {
Expand Down
10 changes: 7 additions & 3 deletions src/admin/app/admin/[[...nextadmin]]/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ import {
searchPaginatedResource,
submitForm,
} from '@premieroctet/next-admin/dist/actions';
import type { PrismaClient } from '@prisma/client';
import { notFound } from 'next/navigation';

export const action = async (params: ActionParams, formData: FormData) => {
const isAdmin = await verifyAdmin();
if (!isAdmin) return notFound();

const db = await getEnhancedDb();
return submitForm({ ...params, options, prisma: db }, formData);
return submitForm(
{ ...params, options, prisma: db as PrismaClient },
formData,
);
};

export const deleteAction = async (
Expand All @@ -27,7 +31,7 @@ export const deleteAction = async (

const db = await getEnhancedDb();

return deleteResourceItems(db, model, ids);
return deleteResourceItems(db as PrismaClient, model, ids);
};

export const searchPaginatedResourceAction = async (
Expand All @@ -40,7 +44,7 @@ export const searchPaginatedResourceAction = async (
const db = await getEnhancedDb();

return searchPaginatedResource(
{ ...actionParams, options, prisma: db },
{ ...actionParams, options, prisma: db as PrismaClient },
params,
);
};
3 changes: 2 additions & 1 deletion src/admin/app/admin/[[...nextadmin]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { options } from '@/admin';
import { getEnhancedDb, verifyAdmin } from '@/auth';
import { NextAdmin } from '@premieroctet/next-admin';
import { getPropsFromParams } from '@premieroctet/next-admin/dist/appRouter';
import type { PrismaClient } from '@prisma/client';
import { notFound } from 'next/navigation';
import { action, deleteAction, searchPaginatedResourceAction } from './actions';

Expand All @@ -23,7 +24,7 @@ export default async function AdminPage({
params: nextadmin,
searchParams,
options,
prisma: db,
prisma: db as PrismaClient,
schema,
action,
deleteAction,
Expand Down
10 changes: 7 additions & 3 deletions src/app/(shipzen)/(admin)/admin/[[...nextadmin]]/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ import {
searchPaginatedResource,
submitForm,
} from '@premieroctet/next-admin/dist/actions';
import type { PrismaClient } from '@prisma/client';
import { notFound } from 'next/navigation';

export const action = async (params: ActionParams, formData: FormData) => {
const isAdmin = await verifyAdmin();
if (!isAdmin) return notFound();

const db = await getEnhancedDb();
return submitForm({ ...params, options, prisma: db }, formData);
return submitForm(
{ ...params, options, prisma: db as PrismaClient },
formData,
);
};

export const deleteAction = async (
Expand All @@ -27,7 +31,7 @@ export const deleteAction = async (

const db = await getEnhancedDb();

return deleteResourceItems(db, model, ids);
return deleteResourceItems(db as PrismaClient, model, ids);
};

export const searchPaginatedResourceAction = async (
Expand All @@ -40,7 +44,7 @@ export const searchPaginatedResourceAction = async (
const db = await getEnhancedDb();

return searchPaginatedResource(
{ ...actionParams, options, prisma: db },
{ ...actionParams, options, prisma: db as PrismaClient },
params,
);
};
3 changes: 2 additions & 1 deletion src/app/(shipzen)/(admin)/admin/[[...nextadmin]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { options } from '@/admin';
import { getEnhancedDb, verifyAdmin } from '@/auth';
import { NextAdmin } from '@premieroctet/next-admin';
import { getPropsFromParams } from '@premieroctet/next-admin/dist/appRouter';
import type { PrismaClient } from '@prisma/client';
import { notFound } from 'next/navigation';
import { action, deleteAction, searchPaginatedResourceAction } from './actions';

Expand All @@ -23,7 +24,7 @@ export default async function AdminPage({
params: nextadmin,
searchParams,
options,
prisma: db,
prisma: db as PrismaClient,
schema,
action,
deleteAction,
Expand Down
4 changes: 2 additions & 2 deletions src/auth/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isProd } from '@/config/node';
import { dbAdmin } from '@/prisma';
import { _prisma, dbAdmin } from '@/prisma';
import { PrismaAdapter } from '@lucia-auth/adapter-prisma';
import { type User as DatabaseUser, UserRole } from '@prisma/client';
import { enhance } from '@zenstackhq/runtime';
Expand Down Expand Up @@ -55,7 +55,7 @@ export const getAuth = cache(
export const getEnhancedDb = cache(async () => {
const auth = await getAuth();

const db = enhance(dbAdmin, {
const db = enhance(_prisma, {
user: auth?.user as DatabaseUser,
});

Expand Down
3 changes: 0 additions & 3 deletions src/config/env.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ export const env = createEnv({
.string()
.optional()
.transform((s) => s === 'true'),
SENTRY_ORG: z.string(),
SENTRY_PROJECT: z.string(),
SENTRY_URL: z.string().url(),
SMTP_URL: z.string().url(),
},
client: {
Expand Down
4 changes: 2 additions & 2 deletions src/prisma/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { PrismaClient } from '@prisma/client';
import { enhance } from '@zenstackhq/runtime';

const prisma = new PrismaClient();
export const _prisma = new PrismaClient();

export const dbAdmin = enhance(prisma, undefined, { kinds: [] });
export const dbAdmin = enhance(_prisma, undefined, { kinds: [] });
2 changes: 1 addition & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const config: Config = {
content: [
'./src/**/*.{js,ts,jsx,tsx,mdx}',
'./node_modules/@nextui-org/theme/dist/**/*.{js,ts,jsx,tsx}',
'./node_modules/@premieroctet/next-admin/dist/**/*.js',
'./node_modules/@premieroctet/next-admin/dist/**/*.{js,ts,jsx,tsx}',
],
theme: {
extend: {
Expand Down

0 comments on commit 6ace5fb

Please sign in to comment.