Skip to content

Commit

Permalink
try basic test template
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamsi committed Jun 23, 2024
1 parent 05b74ca commit bfcb4af
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test-projects/basic/app/admin/.admin/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-disable */
import * as view0 from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/admin-ui/id-field-view'
import * as view1 from '@keystone-6/core/fields/types/text/views'
import * as view2 from '@keystone-6/core/fields/types/select/views'
import * as view3 from '@keystone-6/core/fields/types/checkbox/views'
import * as view4 from '@keystone-6/core/fields/types/relationship/views'
import * as view5 from '@keystone-6/core/fields/types/timestamp/views'

const adminConfig = {}

export const config = {
lazyMetadataQuery: {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"keystone","loc":{"start":22,"end":30}},"arguments":[],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adminMeta","loc":{"start":39,"end":48}},"arguments":[],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"config","loc":{"start":59,"end":65}},"arguments":[],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adminPath","loc":{"start":78,"end":87}},"arguments":[],"directives":[],"loc":{"start":78,"end":87}}],"loc":{"start":66,"end":97}},"loc":{"start":59,"end":97}},{"kind":"Field","name":{"kind":"Name","value":"lists","loc":{"start":106,"end":111}},"arguments":[],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"key","loc":{"start":124,"end":127}},"arguments":[],"directives":[],"loc":{"start":124,"end":127}},{"kind":"Field","name":{"kind":"Name","value":"isHidden","loc":{"start":138,"end":146}},"arguments":[],"directives":[],"loc":{"start":138,"end":146}},{"kind":"Field","name":{"kind":"Name","value":"fields","loc":{"start":157,"end":163}},"arguments":[],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"path","loc":{"start":178,"end":182}},"arguments":[],"directives":[],"loc":{"start":178,"end":182}},{"kind":"Field","name":{"kind":"Name","value":"createView","loc":{"start":195,"end":205}},"arguments":[],"directives":[],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fieldMode","loc":{"start":222,"end":231}},"arguments":[],"directives":[],"loc":{"start":222,"end":231}}],"loc":{"start":206,"end":245}},"loc":{"start":195,"end":245}}],"loc":{"start":164,"end":257}},"loc":{"start":157,"end":257}}],"loc":{"start":112,"end":267}},"loc":{"start":106,"end":267}}],"loc":{"start":49,"end":275}},"loc":{"start":39,"end":275}}],"loc":{"start":31,"end":281}},"loc":{"start":22,"end":281}}]}}]},
fieldViews: [view0,view1,view2,view3,view4,view5],
adminMetaHash: 'c4s9h8',
adminConfig,
apiPath: '/api/graphql',
listsKeyByPath: {"tasks":"Task","people":"Person","secret-plans":"SecretPlan"},
};
4 changes: 4 additions & 0 deletions tests/test-projects/basic/app/admin/[listKey]/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use client'
import { ItemPage } from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ItemPage'

export default ItemPage
4 changes: 4 additions & 0 deletions tests/test-projects/basic/app/admin/[listKey]/create/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use client'
import { CreateItemPage } from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/admin-ui/pages/CreateItemPage'

export default CreateItemPage
4 changes: 4 additions & 0 deletions tests/test-projects/basic/app/admin/[listKey]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use client'
import { ListPage } from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/admin-ui/pages/ListPage'

export default ListPage
16 changes: 16 additions & 0 deletions tests/test-projects/basic/app/admin/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use client'
import { Layout } from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/admin-ui/pages/App'
import { config } from './.admin'


export default function AdminLayout ({
children,
}: {
children: React.ReactNode
}) {
return (
<Layout config={config as any}>
{children}
</Layout>
)
}
3 changes: 3 additions & 0 deletions tests/test-projects/basic/app/admin/no-access/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { getNoAccessPage } from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/admin-ui/pages/NoAccessPage'

export default getNoAccessPage({"sessionsEnabled":false})
2 changes: 2 additions & 0 deletions tests/test-projects/basic/app/admin/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
'use client'
export { HomePage as default } from '@keystone-6/core/___internal-do-not-use-will-break-in-patch/admin-ui/pages/HomePage'
11 changes: 11 additions & 0 deletions tests/test-projects/basic/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default function RootLayout ({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}
4 changes: 4 additions & 0 deletions tests/test-projects/basic/keystone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ export default config({
// WARNING: this is only needed for examples, dont do this
...fixPrismaPath,
},
ui: {
basePath: '/admin',
tsx: true,
},
lists,
})
5 changes: 5 additions & 0 deletions tests/test-projects/basic/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
5 changes: 5 additions & 0 deletions tests/test-projects/basic/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,15 @@ type KeystoneMeta {
}

type KeystoneAdminMeta {
config: config!
lists: [KeystoneAdminUIListMeta!]!
list(key: String!): KeystoneAdminUIListMeta
}

type config {
adminPath: String!
}

type KeystoneAdminUIListMeta {
key: String!
itemQueryName: String!
Expand Down
34 changes: 34 additions & 0 deletions tests/test-projects/basic/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"compilerOptions": {
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"noEmit": true,
"incremental": true,
"module": "esnext",
"esModuleInterop": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"plugins": [
{
"name": "next"
}
]
},
"include": [
"next-env.d.ts",
".next/types/**/*.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}

0 comments on commit bfcb4af

Please sign in to comment.