Skip to content

Commit

Permalink
Fix schemas for create-keystone-app (#9275)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrei Luca <1881266+iamandrewluca@users.noreply.github.com>
  • Loading branch information
dcousens and iamandrewluca authored Aug 13, 2024
1 parent b640b74 commit 855bc25
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 472 deletions.
5 changes: 5 additions & 0 deletions .changeset/moved-create-app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-keystone-app": patch
---

Update generated schemas
9 changes: 1 addition & 8 deletions packages/create/starter/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ import { createAuth } from '@keystone-6/auth'
// see https://keystonejs.com/docs/apis/session for the session docs
import { statelessSessions } from '@keystone-6/core/session'

// for a stateless session, a SESSION_SECRET should always be provided
// especially in production (statelessSessions will throw if SESSION_SECRET is undefined)
let sessionSecret = process.env.SESSION_SECRET
if (!sessionSecret && process.env.NODE_ENV !== 'production') {
sessionSecret = randomBytes(32).toString('hex')
}

// withAuth is a function we can use to wrap our base configuration
const { withAuth } = createAuth({
listKey: 'User',
Expand Down Expand Up @@ -60,7 +53,7 @@ const sessionMaxAge = 60 * 60 * 24 * 30
// you can find out more at https://keystonejs.com/docs/apis/session#session-api
const session = statelessSessions({
maxAge: sessionMaxAge,
secret: sessionSecret!,
secret: process.env.SESSION_SECRET,
})

export { withAuth, session }
3 changes: 1 addition & 2 deletions packages/create/starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"scripts": {
"dev": "keystone dev",
"start": "keystone start",
"build": "keystone build",
"postinstall": "keystone build --no-ui --frozen"
"build": "keystone build"
},
"dependencies": {
"@keystone-6/auth": "^8.0.0",
Expand Down
Loading

0 comments on commit 855bc25

Please sign in to comment.