Skip to content
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

🐛 FIX: consistant casing for kitql #267

Merged
merged 1 commit into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/curvy-mails-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kitql/all-in': patch
---

consistant casing for kitql
2 changes: 1 addition & 1 deletion .changeset/gold-peaches-drop.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@kitql/all-in': patch
---

rmv kitQLPrisma
rmv kitqlPrisma
4 changes: 2 additions & 2 deletions examples/demo-init/graphql.config.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// I have to make it better one day!
const kitQLConfig = require('@kitql/all-in/cjs.cjs');
const kitqlConfig = require('@kitql/all-in/cjs.cjs');

const scalars = {
Date: '../helpers/scalarTypes#CodegenDate',
Expand All @@ -9,7 +9,7 @@ const scalars = {
/** @type {import('@kitql/all-in').KitQLProjects} */
const config = {
projects: {
init: kitQLConfig({ scalars })
init: kitqlConfig({ scalars })
}
};

Expand Down
2 changes: 1 addition & 1 deletion examples/demo-init/src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { dev } from '$app/environment';
import { kitqlServer, type IKitQLContext } from '$lib/graphql/kitQLServer';
import { kitqlServer, type IKitQLContext } from '$lib/graphql/kitqlServer';
import { handleGraphiql } from '@kitql/all-in';
import { handleGraphql } from '@kitql/all-in';
import { sequence } from '@sveltejs/kit/hooks';
Expand Down
4 changes: 2 additions & 2 deletions graphql.config.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const kitQLConfig = require('./packages/all-in/src/lib/cjs.cjs')
const kitqlConfig = require('./packages/all-in/src/lib/cjs.cjs')

const scalars = {
Date: '../helpers/scalarTypes#CodegenDate',
Expand All @@ -8,7 +8,7 @@ const scalars = {
/** @type {import('@kitql/all-in').KitQLProjects} */
const config = {
projects: {
myPrj: kitQLConfig({ scalars, projectLocation: './packages/all-in' }),
myPrj: kitqlConfig({ scalars, projectLocation: './packages/all-in' }),
},
}

Expand Down
2 changes: 1 addition & 1 deletion packages/all-in/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@

### Patch Changes

- [`a7594a8`](https://github.com/jycouet/kitql/commit/a7594a8095eb94d11472585442daabd3b27f1c5e) Thanks [@jycouet](https://github.com/jycouet)! - rmv kitQLPrisma
- [`a7594a8`](https://github.com/jycouet/kitql/commit/a7594a8095eb94d11472585442daabd3b27f1c5e) Thanks [@jycouet](https://github.com/jycouet)! - rmv kitqlPrisma

- [`5ef6e2e`](https://github.com/jycouet/kitql/commit/5ef6e2eee71e70fa7897bf4bba8ec6553fe3be05) Thanks [@jycouet](https://github.com/jycouet)! - rmv @prisma/client for now

Expand Down
6 changes: 3 additions & 3 deletions packages/all-in/src/lib/cjs.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function kitQLCodegen(projectLocation, scalars) {
function kitqlCodegen(projectLocation, scalars) {
return {
generates: {
// [`${projectLocation}/src/lib/graphql/$kitql/graphqlTypes.ts`]: {
Expand Down Expand Up @@ -29,7 +29,7 @@ function kitQLCodegen(projectLocation, scalars) {
}
}

module.exports = function kitQLConfig(options) {
module.exports = function kitqlConfig(options) {
const { projectLocation = '.', scalars = {} } = options || {}

return {
Expand All @@ -39,7 +39,7 @@ module.exports = function kitQLConfig(options) {
],
documents: [`${projectLocation}/src/**/*.gql`, `${projectLocation}/$houdini/graphql/documents.gql`],
extensions: {
codegen: kitQLCodegen(projectLocation, scalars),
codegen: kitqlCodegen(projectLocation, scalars),
},
}
}
47 changes: 0 additions & 47 deletions packages/all-in/src/lib/graphql/graphqlConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import type { CodegenConfig } from '@graphql-codegen/cli'
import type { IGraphQLProject } from 'graphql-config'

export interface KitQLProjects {
Expand All @@ -13,49 +12,3 @@ export type KitQLConfig = {
}

export type KitQLScalar = Record<string, string>

// needs to be cjs for "GraphQL.vscode-graphql" extension!

// function kitQLCodegen(projectLocation: string, scalars: KitQLScalar): CodegenConfig {
// return {
// generates: {
// [`${projectLocation}src/lib/graphql/$kitql/graphqlTypes.ts`]: {
// plugins: ['typescript'],
// },
// [`${projectLocation}src/lib/modules/`]: {
// preset: 'graphql-modules',
// presetConfig: {
// baseTypesPath: '../graphql/$kitql/graphqlTypes.ts',
// importBaseTypesFrom: '$graphql/$kitql/graphqlTypes',
// filename: '$kitql/moduleTypes.ts',
// },
// plugins: ['typescript', 'typescript-resolvers'],
// config: {
// contextType: '$graphql/kitQLServer#IKitQLContext',
// scalars,
// },
// },
// },
// config: {
// useTypeImports: true,
// },
// }
// }

// export function kitQLConfig(options?: KitQLConfig): IGraphQLProject {
// const { projectLocation = './', scalars = {} } = options || {}

// return {
// schema: [
// `${projectLocation}src/lib/modules/**/typedefs/*.graphql`,
// `${projectLocation}$houdini/graphql/schema.graphql`,
// ],
// documents: [
// `${projectLocation}src/lib/modules/**/graphql/*.gql`,
// `${projectLocation}$houdini/graphql/documents.gql`,
// ],
// extensions: {
// codegen: kitQLCodegen(projectLocation, scalars),
// },
// }
// }
2 changes: 1 addition & 1 deletion packages/all-in/src/lib/graphql/kitqlServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type IKitQLContext = ReturnType<typeof getContext>

// then, make use of "IKitQLContext" in code gen, generate resolvers fully typed!
// config:
// contextType: $graphql/kitQLServer#IKitQLContext
// contextType: $graphql/kitqlServer#IKitQLContext

export const kitqlServer: KitQLHandleGraphQL<IKitQLContext, Record<string, any>> = {
plugins,
Expand Down
6 changes: 3 additions & 3 deletions packages/all-in/src/lib/hooks/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ export function handleGraphql<TUserContext, TServerContext>(
schema: createSchema({
typeDefs: `
type Query {
is_it_working: String
_greetings: String
}
`,
resolvers: {
Query: {
is_it_working: () =>
'Yes yoga is up and running! Now, to make it work with your own schema, you need to send kitQLModules(modules) via plugins',
_greetings: () =>
'Yes yoga is up and running! Now, to make it work with your own schema, you need to `useKitqlModules(modules)` via plugins',
},
},
}),
Expand Down
5 changes: 3 additions & 2 deletions packages/all-in/src/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ export { gm }

// SvelteKit hooks
export { type KitQLHandleGraphQL, handleGraphql } from './hooks/graphql.js'
export { type KitQLHandleGraphiQL, handleGraphiql } from './hooks/graphiql.js'
export { handleGraphiql } from './hooks/graphiql.js'
export type { KitQLHandleGraphiQL } from './hooks/graphiqlCommon.js'

// Prisma
// export { getKitQLPrisma } from './prisma/kitQLPrisma'
// export { getKitQLPrisma } from './prisma/kitqlPrisma'

// GraphQL Config
export type { CodegenConfig as KitQLCodegenConfig } from '@graphql-codegen/cli'
Expand Down
2 changes: 1 addition & 1 deletion packages/all-in/src/lib/vite/actionModuleContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function actionModuleContext(

if (withDbProvider) {
dataCtxModules.push(`import { load_DataLoader } from '../../../../lib/graphql/helpers/dataLoaderHelper';`)
dataCtxModules.push(`import type { IKitQLContext } from '../../../../lib/graphql/kitQLServer';`)
dataCtxModules.push(`import type { IKitQLContext } from '../../../../lib/graphql/kitqlServer';`)
if (functionsName.length > 0) {
dataCtxModules.push(`import type { ${moduleNamePascalCase} } from '${importBaseTypesFrom}';`)
}
Expand Down
6 changes: 3 additions & 3 deletions website/src/pages/docs/setup/02_server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Now, let's build the `kitqlServer` const 👇

### `kitqlServer`

This is the file where you will create your kitQL Server. To start, it should look like:
This is the file where you will create your KitQL Server. To start, it should look like:

```ts filename="src/lib/graphql/kitqlServer.ts"
import { useKitqlModules, type KitQLHandleGraphQL } from '@kitql/all-in'
Expand Down Expand Up @@ -86,7 +86,7 @@ Now, we just need to generate everything... to have typings & modules.
Create a config file `graphql.config.cjs` with the following content:

```js filename="graphql.config.cjs"
const kitQLConfig = require('@kitql/all-in/cjs.cjs')
const kitqlConfig = require('@kitql/all-in/cjs.cjs')

const scalars = {
Date: '../helpers/scalarTypes#CodegenDate',
Expand All @@ -96,7 +96,7 @@ const scalars = {
/** @type {import('@kitql/all-in').KitQLProjects} */
const config = {
projects: {
init: kitQLConfig({ scalars })
init: kitqlConfig({ scalars })
}
}

Expand Down