-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move defaults to initConfig
#9027
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
73f203a
move most Keystone defaults to system.initConfig
dcousens c3f38ad
Use `idField` type of `{ kind: number, kind: Int | BigInt }` internal…
dcousens 3a30e9b
flatten lib/
dcousens f9420a6
prefer charAt(0) for string mutations, less duplicates
dcousens c3cc854
use KeystoneConfig for printPrismaSchema
dcousens 4860d3e
fix prismaClientPath outputs
dcousens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
---- | ||
'@keystone-6/core': patch | ||
---- | ||
|
||
Use `idField` type of `{ kind: 'number', kind: 'Int' | 'BigInt' }` internally for singletons | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
export const toLabel = (str: string) => str.slice(0, 1).toUpperCase() + str.slice(1) | ||
export function capitalise (s: string) { | ||
return s.charAt(0).toUpperCase() + s.slice(1) | ||
} | ||
|
||
const VOWELS = ['a', 'e', 'i', 'o', 'u'] | ||
export const aAn = (before: string) => `a${VOWELS.includes(before.charAt(0)) ? 'n' : ''}` | ||
export function aAn (before: string) { | ||
return `a${VOWELS.includes(before.charAt(0)) ? 'n' : ''}` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import { createRequire } from 'node:module' | |
import { printSchema, GraphQLSchema } from 'graphql' | ||
import { getGenerators, formatSchema } from '@prisma/internals' | ||
import type { KeystoneConfig } from './types' | ||
import { printGeneratedTypes } from './lib/schema-type-printer' | ||
import { printGeneratedTypes } from './lib/typescript-schema-printer' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renamed to align with |
||
import { ExitError } from './scripts/utils' | ||
import { initialiseLists } from './lib/core/initialise-lists' | ||
import { printPrismaSchema } from './lib/core/prisma-schema-printer' | ||
|
@@ -21,15 +21,7 @@ export function getFormattedGraphQLSchema (schema: string) { | |
|
||
export async function getCommittedArtifacts (config: KeystoneConfig, graphQLSchema: GraphQLSchema) { | ||
const lists = initialiseLists(config) | ||
const prismaSchema = printPrismaSchema( | ||
lists, | ||
config.db.prismaClientPath, | ||
config.db.provider, | ||
config.db.prismaPreviewFeatures, | ||
config.db.additionalPrismaDatasourceProperties, | ||
config.db.extendPrismaSchema | ||
) | ||
|
||
const prismaSchema = printPrismaSchema(config, lists) | ||
return { | ||
graphql: getFormattedGraphQLSchema(printSchema(graphQLSchema)), | ||
prisma: await formatPrismaSchema(prismaSchema), | ||
|
@@ -88,9 +80,11 @@ function posixify (s: string) { | |
} | ||
|
||
export function getSystemPaths (cwd: string, config: KeystoneConfig) { | ||
const prismaClientPath = config.db.prismaClientPath | ||
? path.join(cwd, config.db.prismaClientPath) | ||
: null | ||
const prismaClientPath = config.db.prismaClientPath === '@prisma/client' | ||
? null | ||
: config.db.prismaClientPath | ||
? path.join(cwd, config.db.prismaClientPath) | ||
: null | ||
|
||
const builtTypesPath = config.types?.path | ||
? path.join(cwd, config.types.path) // TODO: enforce initConfig before getSystemPaths | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just have static value for this?
may be
global-config
orsettings
or just add to list config applicable whenisSingleton
is true;There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gautamsi I didn't see a reason why we should prevent developers from having this kind of identifier type available for their own usage, while additionally allowing me me to remove
isSingleton
logic from theid-field