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

Commit

Permalink
v2.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCates committed Nov 24, 2023
1 parent 48cd293 commit d4e30ae
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 99 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# 🛠️ CHANGELOG

## 2.2.5

- Updated package.json to Next 14

- Switched to static semantic versioning in package.json

- Updated to iron-session 8.0.1

- Improved and cleaned up api macro

## 2.2.4

- Fix default `layout.tsx` suspense boundary.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Automation Tooling for Next, Redux and Prisma

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

**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)
Expand Down
2 changes: 1 addition & 1 deletion dist/src/printer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 12 additions & 13 deletions dist/src/templates/api.template
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
import { NextRequest, NextResponse } from 'next/server'
import { getSession, createResponse } from 'util/session'
import { NextRequest } from 'next/server'
import { getSession } from 'util/session'

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

try {
return createResponse(
res,
JSON.stringify({
return Response.json(
{
status: 'OK',
session
}),
result: null
},
{ status: 200 }
)
} catch (error) {
console.error(error)
return createResponse(
res,
JSON.stringify({ status: 'ERROR', error }),
return Response.json(
{
status: 'ERROR',
error
},
{ status: 500 }
)
}
Expand Down
54 changes: 27 additions & 27 deletions dist/src/templates/new/package.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@
"prisma:update": "npx prisma generate && npx prisma db push"
},
"dependencies": {
"@prisma/client": "^5.3.1",
"@reduxjs/toolkit": "^1.9.6",
"iron-session": "8.0.0-alpha.0",
"next": "^13.5.3",
"prisma": "^5.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.1.3",
"sass": "^1.68.0",
"superagent": "^8.1.2"
"@prisma/client": "5.6.0",
"@reduxjs/toolkit": "1.9.7",
"iron-session": "8.0.1",
"next": "14.0.3",
"prisma": "5.6.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-redux": "8.1.3",
"sass": "1.69.5",
"superagent": "8.1.2"
},
"devDependencies": {
"@types/node": "^20.8.0",
"@types/superagent": "^4.1.19",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"eslint": "^8.50.0",
"eslint-config-next": "^13.5.3",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-n": "^16.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.33.2",
"node-sass": "^9.0.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2"
"@types/node": "20.9.5",
"@types/superagent": "4.1.22",
"@typescript-eslint/eslint-plugin": "6.12.0",
"@typescript-eslint/parser": "6.12.0",
"eslint": "8.54.0",
"eslint-config-next": "14.0.3",
"eslint-config-prettier": "9.0.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-n": "16.3.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "5.0.1",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-react": "7.33.2",
"node-sass": "9.0.0",
"prettier": "3.1.0",
"typescript": "5.3.2"
}
}
12 changes: 5 additions & 7 deletions dist/src/templates/new/util/session.ts.template
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { NextRequest, NextResponse } from 'next/server'
import { getIronSession, createResponse } from 'iron-session'
import { getIronSession } from 'iron-session'
import { cookies } from 'next/headers'

export const password =
process.env.SESSION_SECRET ||
'{{password}}'
'ad75fbbbddbf8005cb60e3089d6f156440f9c8ac1d13ad33a8e4758fdff73ff8'

export interface SessionI {
counter?: number
}

export function getSession(req: NextRequest, res: NextResponse) {
return getIronSession<SessionI>(req, res, {
export function getSession() {
return getIronSession<SessionI>(cookies(), {
password,
cookieName: 'printer',
cookieOptions: {
Expand All @@ -21,5 +21,3 @@ export function getSession(req: NextRequest, res: NextResponse) {
}
})
}

export { createResponse }
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@printerframework/cli",
"description": "🖨️ Automation Tooling for Next, Redux and Prisma.",
"version": "2.2.4",
"version": "2.2.5",
"private": false,
"preferGlobal": true,
"repository": "https://github.com/PrinterFramework/CLI.git",
Expand Down
2 changes: 1 addition & 1 deletion src/printer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { SuperagentTypes, injectSupergent } from './generators/superagent'
export const Printer = new Command('🖨️ Printer')

Printer
.version('2.2.4')
.version('2.2.5')
.description('🖨️ Printer: Automation Tooling for Next, Redux and Prisma.')
.option('-a, --no-action', 'do not inject actions', false)
.option('-s, --no-state', 'do not inject state', false)
Expand Down
25 changes: 12 additions & 13 deletions src/templates/api.template
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
import { NextRequest, NextResponse } from 'next/server'
import { getSession, createResponse } from 'util/session'
import { NextRequest } from 'next/server'
import { getSession } from 'util/session'

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

try {
return createResponse(
res,
JSON.stringify({
return Response.json(
{
status: 'OK',
session
}),
result: null
},
{ status: 200 }
)
} catch (error) {
console.error(error)
return createResponse(
res,
JSON.stringify({ status: 'ERROR', error }),
return Response.json(
{
status: 'ERROR',
error
},
{ status: 500 }
)
}
Expand Down
54 changes: 27 additions & 27 deletions src/templates/new/package.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@
"prisma:update": "npx prisma generate && npx prisma db push"
},
"dependencies": {
"@prisma/client": "^5.3.1",
"@reduxjs/toolkit": "^1.9.6",
"iron-session": "8.0.0-alpha.0",
"next": "^13.5.3",
"prisma": "^5.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.1.3",
"sass": "^1.68.0",
"superagent": "^8.1.2"
"@prisma/client": "5.6.0",
"@reduxjs/toolkit": "1.9.7",
"iron-session": "8.0.1",
"next": "14.0.3",
"prisma": "5.6.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-redux": "8.1.3",
"sass": "1.69.5",
"superagent": "8.1.2"
},
"devDependencies": {
"@types/node": "^20.8.0",
"@types/superagent": "^4.1.19",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"eslint": "^8.50.0",
"eslint-config-next": "^13.5.3",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-n": "^16.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.33.2",
"node-sass": "^9.0.0",
"prettier": "^3.0.3",
"typescript": "^5.2.2"
"@types/node": "20.9.5",
"@types/superagent": "4.1.22",
"@typescript-eslint/eslint-plugin": "6.12.0",
"@typescript-eslint/parser": "6.12.0",
"eslint": "8.54.0",
"eslint-config-next": "14.0.3",
"eslint-config-prettier": "9.0.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-n": "16.3.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "5.0.1",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-react": "7.33.2",
"node-sass": "9.0.0",
"prettier": "3.1.0",
"typescript": "5.3.2"
}
}
12 changes: 5 additions & 7 deletions src/templates/new/util/session.ts.template
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { NextRequest, NextResponse } from 'next/server'
import { getIronSession, createResponse } from 'iron-session'
import { getIronSession } from 'iron-session'
import { cookies } from 'next/headers'

export const password =
process.env.SESSION_SECRET ||
'{{password}}'
'ad75fbbbddbf8005cb60e3089d6f156440f9c8ac1d13ad33a8e4758fdff73ff8'

export interface SessionI {
counter?: number
}

export function getSession(req: NextRequest, res: NextResponse) {
return getIronSession<SessionI>(req, res, {
export function getSession() {
return getIronSession<SessionI>(cookies(), {
password,
cookieName: 'printer',
cookieOptions: {
Expand All @@ -21,5 +21,3 @@ export function getSession(req: NextRequest, res: NextResponse) {
}
})
}

export { createResponse }
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
"src/**/*.ts",
"test/**/*.ts"
]
}
}

0 comments on commit d4e30ae

Please sign in to comment.