Skip to content
This repository was archived by the owner on Oct 9, 2024. It is now read-only.

Commit d4e30ae

Browse files
committed
v2.2.5
1 parent 48cd293 commit d4e30ae

12 files changed

+103
-99
lines changed

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# 🛠️ CHANGELOG
22

3+
## 2.2.5
4+
5+
- Updated package.json to Next 14
6+
7+
- Switched to static semantic versioning in package.json
8+
9+
- Updated to iron-session 8.0.1
10+
11+
- Improved and cleaned up api macro
12+
313
## 2.2.4
414

515
- Fix default `layout.tsx` suspense boundary.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## Automation Tooling for Next, Redux and Prisma
66

77
![license](https://img.shields.io/badge/license-AGPLv3-blue.svg)
8-
![version](https://img.shields.io/badge/version-2.2.4-blue.svg)
8+
![version](https://img.shields.io/badge/version-2.2.5-blue.svg)
99
[![CircleCI](https://circleci.com/gh/PrinterFramework/CLI.svg?style=svg)](https://circleci.com/gh/PrinterFramework/CLI)
1010

1111
**Printer v1.x.x** is compatible with the old Next patterns. You can review the documentation on the v1 website: [v1.prntr.click/docs](https://v1.prntr.click/docs)

dist/src/printer.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/templates/api.template

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
import { NextRequest, NextResponse } from 'next/server'
2-
import { getSession, createResponse } from 'util/session'
1+
import { NextRequest } from 'next/server'
2+
import { getSession } from 'util/session'
33

44
export async function GET(req: NextRequest) {
5-
const res = new NextResponse()
6-
const session = await getSession(req, res)
5+
const session = await getSession()
76
const { searchParams } = new URL(req.url)
8-
res.headers.set('Content-Type', 'application/json')
97

108
try {
11-
return createResponse(
12-
res,
13-
JSON.stringify({
9+
return Response.json(
10+
{
1411
status: 'OK',
15-
session
16-
}),
12+
result: null
13+
},
1714
{ status: 200 }
1815
)
1916
} catch (error) {
2017
console.error(error)
21-
return createResponse(
22-
res,
23-
JSON.stringify({ status: 'ERROR', error }),
18+
return Response.json(
19+
{
20+
status: 'ERROR',
21+
error
22+
},
2423
{ status: 500 }
2524
)
2625
}

dist/src/templates/new/package.json.template

+27-27
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,34 @@
1111
"prisma:update": "npx prisma generate && npx prisma db push"
1212
},
1313
"dependencies": {
14-
"@prisma/client": "^5.3.1",
15-
"@reduxjs/toolkit": "^1.9.6",
16-
"iron-session": "8.0.0-alpha.0",
17-
"next": "^13.5.3",
18-
"prisma": "^5.3.1",
19-
"react": "^18.2.0",
20-
"react-dom": "^18.2.0",
21-
"react-redux": "^8.1.3",
22-
"sass": "^1.68.0",
23-
"superagent": "^8.1.2"
14+
"@prisma/client": "5.6.0",
15+
"@reduxjs/toolkit": "1.9.7",
16+
"iron-session": "8.0.1",
17+
"next": "14.0.3",
18+
"prisma": "5.6.0",
19+
"react": "18.2.0",
20+
"react-dom": "18.2.0",
21+
"react-redux": "8.1.3",
22+
"sass": "1.69.5",
23+
"superagent": "8.1.2"
2424
},
2525
"devDependencies": {
26-
"@types/node": "^20.8.0",
27-
"@types/superagent": "^4.1.19",
28-
"@typescript-eslint/eslint-plugin": "^6.7.3",
29-
"@typescript-eslint/parser": "^6.7.3",
30-
"eslint": "^8.50.0",
31-
"eslint-config-next": "^13.5.3",
32-
"eslint-config-prettier": "^9.0.0",
33-
"eslint-config-standard": "^17.1.0",
34-
"eslint-plugin-import": "^2.28.1",
35-
"eslint-plugin-n": "^16.1.0",
36-
"eslint-plugin-node": "^11.1.0",
37-
"eslint-plugin-prettier": "^5.0.0",
38-
"eslint-plugin-promise": "^6.1.1",
39-
"eslint-plugin-react": "^7.33.2",
40-
"node-sass": "^9.0.0",
41-
"prettier": "^3.0.3",
42-
"typescript": "^5.2.2"
26+
"@types/node": "20.9.5",
27+
"@types/superagent": "4.1.22",
28+
"@typescript-eslint/eslint-plugin": "6.12.0",
29+
"@typescript-eslint/parser": "6.12.0",
30+
"eslint": "8.54.0",
31+
"eslint-config-next": "14.0.3",
32+
"eslint-config-prettier": "9.0.0",
33+
"eslint-config-standard": "17.1.0",
34+
"eslint-plugin-import": "2.29.0",
35+
"eslint-plugin-n": "16.3.1",
36+
"eslint-plugin-node": "11.1.0",
37+
"eslint-plugin-prettier": "5.0.1",
38+
"eslint-plugin-promise": "6.1.1",
39+
"eslint-plugin-react": "7.33.2",
40+
"node-sass": "9.0.0",
41+
"prettier": "3.1.0",
42+
"typescript": "5.3.2"
4343
}
4444
}
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { NextRequest, NextResponse } from 'next/server'
2-
import { getIronSession, createResponse } from 'iron-session'
1+
import { getIronSession } from 'iron-session'
2+
import { cookies } from 'next/headers'
33

44
export const password =
55
process.env.SESSION_SECRET ||
6-
'{{password}}'
6+
'ad75fbbbddbf8005cb60e3089d6f156440f9c8ac1d13ad33a8e4758fdff73ff8'
77

88
export interface SessionI {
99
counter?: number
1010
}
1111

12-
export function getSession(req: NextRequest, res: NextResponse) {
13-
return getIronSession<SessionI>(req, res, {
12+
export function getSession() {
13+
return getIronSession<SessionI>(cookies(), {
1414
password,
1515
cookieName: 'printer',
1616
cookieOptions: {
@@ -21,5 +21,3 @@ export function getSession(req: NextRequest, res: NextResponse) {
2121
}
2222
})
2323
}
24-
25-
export { createResponse }

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@printerframework/cli",
33
"description": "🖨️ Automation Tooling for Next, Redux and Prisma.",
4-
"version": "2.2.4",
4+
"version": "2.2.5",
55
"private": false,
66
"preferGlobal": true,
77
"repository": "https://github.com/PrinterFramework/CLI.git",

src/printer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { SuperagentTypes, injectSupergent } from './generators/superagent'
2020
export const Printer = new Command('🖨️ Printer')
2121

2222
Printer
23-
.version('2.2.4')
23+
.version('2.2.5')
2424
.description('🖨️ Printer: Automation Tooling for Next, Redux and Prisma.')
2525
.option('-a, --no-action', 'do not inject actions', false)
2626
.option('-s, --no-state', 'do not inject state', false)

src/templates/api.template

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
import { NextRequest, NextResponse } from 'next/server'
2-
import { getSession, createResponse } from 'util/session'
1+
import { NextRequest } from 'next/server'
2+
import { getSession } from 'util/session'
33

44
export async function GET(req: NextRequest) {
5-
const res = new NextResponse()
6-
const session = await getSession(req, res)
5+
const session = await getSession()
76
const { searchParams } = new URL(req.url)
8-
res.headers.set('Content-Type', 'application/json')
97

108
try {
11-
return createResponse(
12-
res,
13-
JSON.stringify({
9+
return Response.json(
10+
{
1411
status: 'OK',
15-
session
16-
}),
12+
result: null
13+
},
1714
{ status: 200 }
1815
)
1916
} catch (error) {
2017
console.error(error)
21-
return createResponse(
22-
res,
23-
JSON.stringify({ status: 'ERROR', error }),
18+
return Response.json(
19+
{
20+
status: 'ERROR',
21+
error
22+
},
2423
{ status: 500 }
2524
)
2625
}

src/templates/new/package.json.template

+27-27
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,34 @@
1111
"prisma:update": "npx prisma generate && npx prisma db push"
1212
},
1313
"dependencies": {
14-
"@prisma/client": "^5.3.1",
15-
"@reduxjs/toolkit": "^1.9.6",
16-
"iron-session": "8.0.0-alpha.0",
17-
"next": "^13.5.3",
18-
"prisma": "^5.3.1",
19-
"react": "^18.2.0",
20-
"react-dom": "^18.2.0",
21-
"react-redux": "^8.1.3",
22-
"sass": "^1.68.0",
23-
"superagent": "^8.1.2"
14+
"@prisma/client": "5.6.0",
15+
"@reduxjs/toolkit": "1.9.7",
16+
"iron-session": "8.0.1",
17+
"next": "14.0.3",
18+
"prisma": "5.6.0",
19+
"react": "18.2.0",
20+
"react-dom": "18.2.0",
21+
"react-redux": "8.1.3",
22+
"sass": "1.69.5",
23+
"superagent": "8.1.2"
2424
},
2525
"devDependencies": {
26-
"@types/node": "^20.8.0",
27-
"@types/superagent": "^4.1.19",
28-
"@typescript-eslint/eslint-plugin": "^6.7.3",
29-
"@typescript-eslint/parser": "^6.7.3",
30-
"eslint": "^8.50.0",
31-
"eslint-config-next": "^13.5.3",
32-
"eslint-config-prettier": "^9.0.0",
33-
"eslint-config-standard": "^17.1.0",
34-
"eslint-plugin-import": "^2.28.1",
35-
"eslint-plugin-n": "^16.1.0",
36-
"eslint-plugin-node": "^11.1.0",
37-
"eslint-plugin-prettier": "^5.0.0",
38-
"eslint-plugin-promise": "^6.1.1",
39-
"eslint-plugin-react": "^7.33.2",
40-
"node-sass": "^9.0.0",
41-
"prettier": "^3.0.3",
42-
"typescript": "^5.2.2"
26+
"@types/node": "20.9.5",
27+
"@types/superagent": "4.1.22",
28+
"@typescript-eslint/eslint-plugin": "6.12.0",
29+
"@typescript-eslint/parser": "6.12.0",
30+
"eslint": "8.54.0",
31+
"eslint-config-next": "14.0.3",
32+
"eslint-config-prettier": "9.0.0",
33+
"eslint-config-standard": "17.1.0",
34+
"eslint-plugin-import": "2.29.0",
35+
"eslint-plugin-n": "16.3.1",
36+
"eslint-plugin-node": "11.1.0",
37+
"eslint-plugin-prettier": "5.0.1",
38+
"eslint-plugin-promise": "6.1.1",
39+
"eslint-plugin-react": "7.33.2",
40+
"node-sass": "9.0.0",
41+
"prettier": "3.1.0",
42+
"typescript": "5.3.2"
4343
}
4444
}
+5-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import { NextRequest, NextResponse } from 'next/server'
2-
import { getIronSession, createResponse } from 'iron-session'
1+
import { getIronSession } from 'iron-session'
2+
import { cookies } from 'next/headers'
33

44
export const password =
55
process.env.SESSION_SECRET ||
6-
'{{password}}'
6+
'ad75fbbbddbf8005cb60e3089d6f156440f9c8ac1d13ad33a8e4758fdff73ff8'
77

88
export interface SessionI {
99
counter?: number
1010
}
1111

12-
export function getSession(req: NextRequest, res: NextResponse) {
13-
return getIronSession<SessionI>(req, res, {
12+
export function getSession() {
13+
return getIronSession<SessionI>(cookies(), {
1414
password,
1515
cookieName: 'printer',
1616
cookieOptions: {
@@ -21,5 +21,3 @@ export function getSession(req: NextRequest, res: NextResponse) {
2121
}
2222
})
2323
}
24-
25-
export { createResponse }

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
"src/**/*.ts",
2222
"test/**/*.ts"
2323
]
24-
}
24+
}

0 commit comments

Comments
 (0)