Skip to content

Commit 188b1b6

Browse files
committed
bump astro and remix, fix builds
1 parent f07b12f commit 188b1b6

File tree

13 files changed

+3390
-3858
lines changed

13 files changed

+3390
-3858
lines changed

examples/framework-astro/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.astro/
3+
# Keep environment variables out of version control
4+
.env
+11-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
import { defineConfig } from 'astro/config'
2+
import node from '@astrojs/node'
23

34
// https://astro.build/config
45
export default defineConfig({
56
output: 'server',
7+
adapter: node({
8+
mode: 'standalone',
9+
}),
10+
611
// WARNING: this is only needed for our monorepo examples, dont do this
712
vite: {
813
ssr: {
9-
external: ['@keystone-6/core/context', '@keystone-6/core', '@keystone-6/core/fields'],
14+
external: [
15+
'@keystone-6/core',
16+
'@keystone-6/core/context',
17+
'@keystone-6/core/fields',
18+
'myprisma'
19+
],
1020
},
1121
},
1222
})

examples/framework-astro/keystone.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
import { config } from '@keystone-6/core'
99
import { lists } from './src/keystone/schema'
10+
import type { TypeInfo } from '.keystone/types'
1011

11-
export default config({
12+
export default config<TypeInfo>({
1213
db: {
1314
// we're using sqlite for the fastest startup experience
1415
// for more information on what database might be appropriate for you
@@ -18,7 +19,7 @@ export default config({
1819

1920
// WARNING: this is only needed for our monorepo examples, dont do this
2021
// we use using myprisma, not .myprisma, because vite
21-
prismaClientPath: 'node_modules/myprisma/client',
22+
prismaClientPath: 'node_modules/myprisma',
2223
},
2324
server: {
2425
// We're using a custom port for this example so Astro and Keystone can run at the same time

examples/framework-astro/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@
1212
"start": "astro dev"
1313
},
1414
"dependencies": {
15+
"@astrojs/node": "^8.3.2",
1516
"@keystone-6/core": "workspace:^",
1617
"@prisma/client": "catalog:",
17-
"astro": "^2.2.1"
18+
"astro": "^4.12.3"
1819
},
1920
"devDependencies": {
2021
"@types/node": "catalog:",
21-
"react": "catalog:",
2222
"@types/react-dom": "catalog:",
2323
"prisma": "catalog:",
24+
"react": "catalog:",
2425
"typescript": "catalog:"
2526
}
2627
}

examples/framework-astro/schema.prisma

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ datasource sqlite {
99

1010
generator client {
1111
provider = "prisma-client-js"
12-
output = "node_modules/myprisma/client"
12+
output = "node_modules/myprisma"
1313
}
1414

1515
model Post {

examples/framework-astro/src/keystone/context.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { getContext } from '@keystone-6/core/context'
2-
// Using myprisma/client as vite does not like .
3-
// This should be @prisma/client in a project outside of the Keystone monorepo
4-
import * as PrismaModule from 'myprisma/client'
2+
import * as PrismaModule from 'myprisma'
53
import config from '../../keystone'
64
import type { Context } from '.keystone/types'
75

examples/framework-astro/src/pages/index.astro

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
---
2-
import { keystoneContext } from '../keystone/context';
2+
import { keystoneContext } from '../keystone/context'
33
44
// Using Broswer Name from the user-agent request header to illustrate how to use the keystone context
55
// with a customised session from Astro.
66
// This is a contrived example of how Keystone's Access Control can work within Astro.
7-
const userAgent = Astro.request.headers.get('user-agent');
7+
const userAgent = Astro.request.headers.get('user-agent')
88
99
// Match the browser name using a regular expression
10-
const browserName = userAgent?.match(/(Chrome|Firefox)/)?.pop() ?? 'unknown';
11-
console.log('Browser name in Astro from userAgent header', browserName);
10+
const browserName = userAgent?.match(/(Chrome|Firefox)/)?.pop() ?? 'unknown'
11+
console.log('Browser name in Astro from userAgent header', browserName)
1212
1313
// Create a new context with a customised session
1414
const context = keystoneContext.withSession({
1515
browser: browserName.toLowerCase(),
1616
user: 'astro',
17-
});
17+
})
1818
const posts = await context.query.Post.findMany({
1919
query: 'title id',
20-
});
20+
})
2121
---
2222

2323
<html lang="en">

examples/framework-remix/app/utils/keystone.server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getContext } from '@keystone-6/core/context'
22
import config from '../../keystone'
3-
import * as PrismaModule from '.myprisma/client'
3+
import * as PrismaModule from 'myprisma'
44
import type { Context } from '.keystone/types'
55

66
// Making sure multiple prisma clients are not created during hot reloading

examples/framework-remix/keystone.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
import { list, config } from '@keystone-6/core'
22
import { allowAll } from '@keystone-6/core/access'
33
import { text } from '@keystone-6/core/fields'
4-
import { fixPrismaPath } from '../example-utils'
5-
64
import type { TypeInfo } from '.keystone/types'
75

86
export default config<TypeInfo>({
97
db: {
8+
// we're using sqlite for the fastest startup experience
9+
// for more information on what database might be appropriate for you
10+
// see https://keystonejs.com/docs/guides/choosing-a-database#title
1011
provider: 'sqlite',
1112
url: `file:${process.cwd()}/keystone.db`,
1213

13-
...fixPrismaPath,
14+
// WARNING: this is only needed for our monorepo examples, dont do this
15+
// we use using myprisma, not .myprisma, because vite
16+
prismaClientPath: 'node_modules/myprisma',
1417
},
1518
server: {
1619
port: 4000,

examples/framework-remix/package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111
"dependencies": {
1212
"@keystone-6/core": "workspace:^",
1313
"@prisma/client": "catalog:",
14-
"@remix-run/node": "^1.15.0",
15-
"@remix-run/react": "^1.15.0",
16-
"@remix-run/serve": "^1.15.0",
17-
"react": "catalog:",
18-
"react-dom": "catalog:"
14+
"@remix-run/node": "^1.18.0",
15+
"@remix-run/react": "^1.18.0",
16+
"@remix-run/serve": "^1.18.0",
17+
"isbot": "^5.1.13",
18+
"react": "^18.3.1",
19+
"react-dom": "^18.3.1"
1920
},
2021
"devDependencies": {
21-
"@remix-run/dev": "^1.15.0",
22+
"@remix-run/dev": "^1.18.0",
2223
"@types/react": "catalog:",
2324
"@types/react-dom": "catalog:",
2425
"prisma": "catalog:",
2526
"typescript": "catalog:"
26-
},
27-
"version": null
27+
}
2828
}

examples/framework-remix/schema.prisma

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ datasource sqlite {
99

1010
generator client {
1111
provider = "prisma-client-js"
12-
output = "node_modules/.myprisma/client"
12+
output = "node_modules/myprisma"
1313
}
1414

1515
model Post {

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"@types/jest": "^29.0.0",
3434
"@types/node": "^20.0.0",
3535
"@types/node-fetch": "^2.5.12",
36-
"@types/react": "^18.0.9",
37-
"@types/react-dom": "^18.0.4",
36+
"@types/react": "catalog:",
37+
"@types/react-dom": "catalog:",
3838
"esbuild": "catalog:",
3939
"esbuild-jest": "^0.5.0",
4040
"eslint": "^9.2.0",

0 commit comments

Comments
 (0)