Skip to content

Commit

Permalink
Add prisma 5 support (#59)
Browse files Browse the repository at this point in the history
* Add prisma 5 support

* Upgrade Nextra

* Fix types

* Set images unoptimized

* Typescript upgrade & Small convenience changes (#60)

* Add .env to gitignore

* Upgrade typescript version

* Add test:prepare script

* Fix workflow

* Run prepare step before tsc

* ts-ignore

* Fix dmmf type

* Fix linting

* Dynamic license date, add v3 precision in readme

* Add v3 precision in docs

---------

Co-authored-by: Ratul Maharaj <[email protected]>
  • Loading branch information
foyarash and RatulMaharaj authored Sep 18, 2023
1 parent af26326 commit 6c12dce
Show file tree
Hide file tree
Showing 29 changed files with 2,978 additions and 5,300 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [15.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v2
Expand All @@ -33,9 +33,9 @@ jobs:
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn
- name: Prepare prisma for tests
run: yarn test:prepare
- name: Check Types
run: yarn tsc --noEmit
- name: Prepare prisma for tests
run: yarn add @prisma/client@^4 && cd __tests__/adapters/prisma && npx prisma@4 db push
- name: Run tests
run: yarn test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules/
dist
coverage/
*.db
.DS_Store
.DS_Store
.env*
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

`next-crud` is a helper library that creates CRUD API routes with one simple function based on a Prisma model for Next.js.

**Starting from version 3 of the lib, we only support Prisma v5 and above. Please install version 2 of the lib if you are using Prisma v4 or older.**

# Documentation

The documentation is available [here](https://next-crud-pi.vercel.app/)
Expand Down
2 changes: 1 addition & 1 deletion docs/components/Logo.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Logo = ({ width }) => (
}
}`}
</style>
<g clip-path="url(#clip0)">
<g clipPath="url(#clip0)">
<rect width="101" height="69" />
<path
d="M46.7321 3C46.3748 2.3812 45.7145 2 45 2C44.2855 2 43.6252 2.3812 43.2679 3L9.49296 61.5C9.13569 62.1188 9.13569 62.8812 9.49296 63.5C9.85022 64.1188 10.5105 64.5 11.225 64.5H78.775C79.4895 64.5 80.1498 64.1188 80.507 63.5C80.8643 62.8812 80.8643 62.1188 80.507 61.5L46.7321 3Z"
Expand Down
5 changes: 4 additions & 1 deletion docs/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
8 changes: 6 additions & 2 deletions docs/next.config.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
const withNextra = require('nextra')('nextra-theme-docs', './theme.config.js')
module.exports = withNextra()
const withNextra = require('nextra')('nextra-theme-docs', './theme.config.tsx')
module.exports = withNextra({
images: {
unoptimized: true,
},
})
16 changes: 8 additions & 8 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
"export": "next export"
},
"dependencies": {
"next": "^10.0.3",
"nextra": "^0.3.1",
"nextra-theme-docs": "^1.0.1",
"react": "16.13.1",
"react-dom": "16.13.1"
"next": "^13.4.19",
"nextra": "^2.12.3",
"nextra-theme-docs": "^2.12.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "^14.14.12",
"@types/react": "^17.0.0",
"typescript": "^4.1.2"
"@types/node": "^18",
"@types/react": "^18.2.21",
"typescript": "^5.2.2"
}
}
15 changes: 3 additions & 12 deletions docs/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
import 'nextra-theme-docs/style.css'
import type { AppProps } from 'next/app'
import Head from 'next/head'
import '../styles.css'

export default function App({ Component, pageProps }: AppProps) {
return (
<>
<Head>
<link rel="icon" href="/icon.svg" />
</Head>
<Component {...pageProps} />
</>
)
export default function App({ Component, pageProps }) {
return <Component {...pageProps} />
}
1 change: 0 additions & 1 deletion docs/pages/meta.json → docs/pages/_meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"index": "Next Crud",
"getting-started": "Getting started",
"query-params": "Query params",
"pagination": "Pagination",
"swagger": "Swagger",
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/pages/api-docs/middlewares.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Callout from 'nextra-theme-docs/callout'
import { Callout } from 'nextra/components'

# Middlewares

Expand Down
2 changes: 2 additions & 0 deletions docs/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import Link from 'next/link'

`next-crud` is a helper library that creates CRUD API routes with one simple function based on a Prisma model for Next.js.

**Starting from version 3 of the lib, we only support Prisma v5 and above. Please install version 2 of the lib if you are using Prisma v4 or older.**

## Installation

```
Expand Down
21 changes: 21 additions & 0 deletions docs/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
body {
font-family: 'Inter var', sans-serif;
}

.logo {
display: flex;
gap: 0.5rem;
align-items: center;
}

.logo .name {
font-size: 1.125rem;
line-height: 1.75rem;
font-weight: bold;
}

.logo .description {
font-size: 0.875rem;
line-height: 1.25rem;
color: #6b7280;
}
35 changes: 18 additions & 17 deletions docs/theme.config.js → docs/theme.config.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
import { ThemeConfig } from 'nextra'
import Logo from './components/Logo'

export default {
repository: 'https://github.com/premieroctet/next-crud',
branch: 'master', // branch of docs
path: 'docs', // path of docs
titleSuffix: ' – Next Crud - Full-featured CRUD routes for Next.js',
nextLinks: true,
prevLinks: true,
search: true,
customSearch: null, // customizable, you can use algolia for example
const config: ThemeConfig = {
search: {},
darkMode: true,
footer: true,
footerText: 'MIT 2020 © Premier Octet.',
footerEditOnGitHubLink: true, // will link to the docs repo
project: {
link: 'https://github.com/premieroctet/next-crud',
},
docsRepositoryBase:
'https://github.com/premieroctet/next-crud/tree/master/docs',
footer: {
text: `MIT ${new Date().getFullYear()} © Premier Octet.`,
},
logo: (
<div className="flex items-center">
<div className="logo">
<Logo width={45} />
<span className="text-lg ml-2 font-bold">Next Crud</span>
<span className="text-gray-500 ml-2 text-sm">
Full-featured CRUD routes for Next.js
</span>
<span className="name">Next Crud</span>
<span className="description">Full-featured CRUD routes for Next.js</span>
</div>
),
head: (
Expand Down Expand Up @@ -50,6 +47,10 @@ export default {
content="https://next-crud-pi.vercel.app/oggraph.png"
/>
<meta name="apple-mobile-web-app-title" content="Next Crud" />
<link rel="icon" href="/icon.svg" />
<link rel="stylesheet" href="https://rsms.me/inter/inter.css" />
</>
),
}

export default config
3 changes: 2 additions & 1 deletion docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
"jsx": "preserve",
"incremental": true
},
"include": [
"next-env.d.ts",
Expand Down
Loading

0 comments on commit 6c12dce

Please sign in to comment.