Skip to content

Commit

Permalink
Cleanup: Update all dependancies, fix all tests, fix all typescript e…
Browse files Browse the repository at this point in the history
…rrors.
  • Loading branch information
ayalon committed Jan 23, 2024
1 parent e888e83 commit 19f4676
Show file tree
Hide file tree
Showing 38 changed files with 4,430 additions and 5,196 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [19.x]
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
419 changes: 222 additions & 197 deletions apollo/package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions apollo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@apollo/server": "^4.1.1",
"@types/node": "^18.11.9",
"graphql": "^16.6.0",
"typescript": "^4.9.3"
"@apollo/server": "^4.10.0",
"@types/node": "^20.11.5",
"graphql": "^16.8.1",
"typescript": "^5.3.3"
}
}
4 changes: 2 additions & 2 deletions apollo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": true,
"types": ["node"]
}
"types": ["node"],
},
}
4 changes: 2 additions & 2 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"allowJs": true,
"baseUrl": "../node_modules",
"types": ["cypress"],
"noEmit": true
"noEmit": true,
},
"include": ["**/*.*"],
"exclude": ["../node_modules/**"]
"exclude": ["../node_modules/**"],
}
8,742 changes: 3,865 additions & 4,877 deletions package-lock.json

Large diffs are not rendered by default.

51 changes: 27 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-graphql-middleware",
"version": "4.0.0-beta.9",
"version": "4.0.0",
"description": "Module to perform GraphQL requests as a server middleware.",
"repository": {
"type": "git",
Expand All @@ -23,18 +23,21 @@
"scripts": {
"prepack": "nuxt-module-build && npm run client:build",
"dev": "nuxi dev playground --trace-warnings",
"debug": "nuxi dev playground --inspect",
"dev:build": "nuxi build playground",
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground",
"dev:start": "node ./playground/.output/server/index.mjs",
"client:build": "nuxi generate client",
"client:dev": "nuxi dev client --port 3300",
"typedoc": "typedoc --plugin typedoc-plugin-markdown --out foobar",
"typecheck": "nuxi typecheck",
"docs:dev": "vitepress dev docs --port 5000",
"docs:build": "vitepress build docs",
"docs:serve": "vitepress serve docs --port 5000",
"cypress": "cypress run --e2e",
"cypress:open": "cypress open --e2e",
"test": "vitest",
"test:debug": "vitest --inspect --no-file-parallelism",
"test:ci": "vitest run",
"test:coverage": "vitest run --coverage",
"prettier": "prettier --check .",
Expand All @@ -47,34 +50,34 @@
"@graphql-codegen/typescript-generic-sdk": "^4.0.0",
"@graphql-codegen/typescript-operations": "^4.0.1",
"@graphql-fragment-import/lib": "^3.0.0",
"@graphql-tools/utils": "^10.0.6",
"@nuxt/devtools-kit": "0.8.5",
"@nuxt/kit": "^3.7.4",
"@graphql-tools/utils": "^10.0.13",
"@nuxt/devtools-kit": "1.0.8",
"@nuxt/kit": "^3.9.3",
"cli-table": "^0.3.11",
"inquirer": "^9.2.11",
"minisearch": "^6.1.0"
"inquirer": "^9.2.12",
"minisearch": "^6.3.0"
},
"devDependencies": {
"@iconify-json/carbon": "^1.1.21",
"@nuxt/devtools": "^0.8.5",
"@nuxt/devtools-ui-kit": "0.8.5",
"@nuxt/module-builder": "^0.5.2",
"@nuxt/schema": "^3.7.4",
"@iconify-json/carbon": "^1.1.28",
"@nuxt/devtools": "^1.0.8",
"@nuxt/devtools-ui-kit": "1.0.8",
"@nuxt/module-builder": "^0.5.5",
"@nuxt/schema": "^3.9.3",
"@nuxtjs/eslint-config-typescript": "^12.1.0",
"@types/capture-console": "^1.0.2",
"@types/cli-table": "^0.3.2",
"@types/inquirer": "^9.0.3",
"cypress": "^13.3.0",
"eslint": "^8.50.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
"@types/capture-console": "^1.0.5",
"@types/cli-table": "^0.3.4",
"@types/inquirer": "^9.0.7",
"cypress": "^13.6.3",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"jsdoc-to-markdown": "^8.0.0",
"nuxt": "^3.7.4",
"prettier": "^3.0.3",
"nuxt": "^3.9.3",
"prettier": "^3.2.4",
"strip-ansi": "^7.1.0",
"typedoc": "^0.25.1",
"typedoc-plugin-markdown": "^3.16.0",
"vitepress": "^1.0.0-rc.20",
"vitest": "^0.34.6"
"typedoc": "^0.25.7",
"typedoc-plugin-markdown": "^3.17.1",
"vitepress": "^1.0.0-rc.40",
"vitest": "^1.2.1"
}
}
2 changes: 1 addition & 1 deletion playground/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineNuxtConfig } from 'nuxt/config'
import graphqlMiddlewareModule, { ModuleOptions } from './../src/module'
import graphqlMiddlewareModule, { type ModuleOptions } from './../src/module'
const IS_DEV = process.env.NODE_ENV === 'development'

const graphqlMiddleware: ModuleOptions = {
Expand Down
10 changes: 5 additions & 5 deletions playground/pages/multipleQueries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ query queryTwo {
}
}

query queryThree {
three: users {
...user
}
}
#query queryThree {
# three: users {
# ...user
# }
#}

fragment foobarQuery on Query {
foobar: users {
Expand Down
2 changes: 1 addition & 1 deletion playground/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ input UserData {
email: String!
firstName: String!
lastName: String!
}
}
6 changes: 3 additions & 3 deletions src/codegen/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { generate, executeCodegen } from '@graphql-codegen/cli'
import { Types } from '@graphql-codegen/plugin-helpers'
import { SchemaASTConfig } from '@graphql-codegen/schema-ast'
import { type Types } from '@graphql-codegen/plugin-helpers'
import { type SchemaASTConfig } from '@graphql-codegen/schema-ast'
import * as PluginTypescript from '@graphql-codegen/typescript'
import * as PluginTypescriptOperations from '@graphql-codegen/typescript-operations'
import * as PluginSchemaAst from '@graphql-codegen/schema-ast'
import * as PluginNuxtGraphqlMiddleware from './plugin'
import * as PluginNuxtGraphqlMiddlewareDocuments from './pluginDocuments'
import { GraphqlMiddlewareTemplate } from './../runtime/settings'
import { ModuleOptions } from './../module'
import { type ModuleOptions } from './../module'

/**
* Loads the correct plugin for graphql-codegen.
Expand Down
4 changes: 2 additions & 2 deletions src/codegen/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
Types,
PluginFunction,
type Types,
type PluginFunction,
oldVisit,
} from '@graphql-codegen/plugin-helpers'
import { concatAST } from 'graphql'
Expand Down
4 changes: 2 additions & 2 deletions src/codegen/pluginDocuments.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
Types,
PluginFunction,
type Types,
type PluginFunction,
oldVisit,
} from '@graphql-codegen/plugin-helpers'
import { concatAST } from 'graphql'
Expand Down
2 changes: 1 addition & 1 deletion src/devtools.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { existsSync } from 'fs'
import { Nuxt } from 'nuxt/schema'
import { type Nuxt } from 'nuxt/schema'

const DEVTOOLS_UI_ROUTE = '/__nuxt-graphql-middleware'
const DEVTOOLS_UI_LOCAL_PORT = 3300
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import type {
import { parse, Source, print, visit, Kind } from 'graphql'
import { falsy } from '../runtime/helpers'
import { generateSchema, generateTemplates } from './../codegen'
import { GraphqlMiddlewareDocument } from './../types'
import { ModuleOptions } from './../module'
import { type GraphqlMiddlewareDocument } from './../types'
import { type ModuleOptions } from './../module'

export const logger = useLogger('nuxt-graphql-middleware')

Expand Down Expand Up @@ -509,7 +509,7 @@ export async function generate(
}
})

logger.log("GraphQL code generation table:\n" + table.toString());
logger.log('GraphQL code generation table:\n' + table.toString())
}

process.stdout.write('\n')
Expand Down
12 changes: 6 additions & 6 deletions src/module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { fileURLToPath } from 'url'
import type { Types } from '@graphql-codegen/plugin-helpers'
import { SchemaASTConfig } from '@graphql-codegen/schema-ast'
import { type SchemaASTConfig } from '@graphql-codegen/schema-ast'
import { resolve } from 'pathe'
import { defu } from 'defu'
import { BirpcGroup } from 'birpc'
import { type BirpcGroup } from 'birpc'
import {
defineNuxtModule,
addServerHandler,
Expand All @@ -14,7 +14,7 @@ import {
addImports,
} from '@nuxt/kit'
import inquirer from 'inquirer'
import { TypeScriptDocumentsPluginConfig } from '@graphql-codegen/typescript-operations'
import { type TypeScriptDocumentsPluginConfig } from '@graphql-codegen/typescript-operations'
import { extendServerRpc, onDevToolsInitialized } from '@nuxt/devtools-kit'
import { name, version } from '../package.json'
import { setupDevToolsUI } from './devtools'
Expand All @@ -28,9 +28,9 @@ import {
fileExists,
outputDocuments,
} from './helpers'
import { CodegenResult } from './codegen'
import { ClientFunctions, ServerFunctions } from './rpc-types'
import { GraphqlMiddlewareDocument } from './types'
import { type CodegenResult } from './codegen'
import { type ClientFunctions, type ServerFunctions } from './rpc-types'
import { type GraphqlMiddlewareDocument } from './types'
export type { GraphqlMiddlewareServerOptions } from './types'

export interface ModuleOptions {
Expand Down
2 changes: 1 addition & 1 deletion src/rpc-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GraphqlMiddlewareDocument } from './types'
import { type GraphqlMiddlewareDocument } from './types'

// rpc-types.ts
export interface ServerFunctions {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/composables/nuxtApp.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { FetchOptions } from 'ofetch'
import { useGraphqlState } from './useGraphqlState'
import { GraphqlResponse, getEndpoint } from './shared'
import { type GraphqlResponse, getEndpoint } from './shared'

export function performRequest(
operation: string,
Expand Down
18 changes: 9 additions & 9 deletions src/runtime/composables/server.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { FetchOptions } from 'ofetch'
import {
GraphqlResponse,
type GraphqlResponse,
getEndpoint,
GraphqlMiddlewareQueryName,
GetQueryArgs,
QueryObjectArgs,
GetQueryResult,
GraphqlMiddlewareMutationName,
GetMutationArgs,
MutationObjectArgs,
GetMutationResult,
type GraphqlMiddlewareQueryName,
type GetQueryArgs,
type QueryObjectArgs,
type GetQueryResult,
type GraphqlMiddlewareMutationName,
type GetMutationArgs,
type MutationObjectArgs,
type GetMutationResult,
} from './shared'
import { buildRequestParams } from './../helpers'
import type {
Expand Down
8 changes: 4 additions & 4 deletions src/runtime/composables/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export type GetQueryArgs<
> = M[T][0] extends null
? [T]
: M[T][1] extends false
? [T, M[T][0]]
: [T, M[T][0]?]
? [T, M[T][0]]
: [T, M[T][0]?]

// Determine the argument signature for the mutation method.
export type GetMutationArgs<
Expand All @@ -29,8 +29,8 @@ export type GetMutationArgs<
> = M[T][0] extends null
? [T]
: M[T][1] extends false
? [T, M[T][0]]
: [T, M[T][0]?]
? [T, M[T][0]]
: [T, M[T][0]?]

// Type for the query or mutation responses.
export type GraphqlResponse<T> = {
Expand Down
8 changes: 4 additions & 4 deletions src/runtime/composables/useGraphqlMutation.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
GraphqlMiddlewareMutationName,
GetMutationArgs,
MutationObjectArgs,
GetMutationResult,
type GraphqlMiddlewareMutationName,
type GetMutationArgs,
type MutationObjectArgs,
type GetMutationResult,
} from './shared'
import { performRequest } from './nuxtApp'
import type { GraphqlMiddlewareMutation } from '#build/nuxt-graphql-middleware'
Expand Down
8 changes: 4 additions & 4 deletions src/runtime/composables/useGraphqlQuery.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
GraphqlMiddlewareQueryName,
GetQueryArgs,
QueryObjectArgs,
GetQueryResult,
type GraphqlMiddlewareQueryName,
type GetQueryArgs,
type QueryObjectArgs,
type GetQueryResult,
} from './shared'
import { buildRequestParams } from './../helpers'
import { performRequest } from './nuxtApp'
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/composables/useGraphqlState.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NuxtApp, useNuxtApp } from '#app'
import { GraphqlMiddlewareState } from './../../types'
import { type NuxtApp, useNuxtApp } from '#app'
import { type GraphqlMiddlewareState } from './../../types'

export const useGraphqlState = function (
providedApp?: NuxtApp,
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/plugins/provideState.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineNuxtPlugin } from 'nuxt/app'
import { GraphqlMiddlewareState } from './../../types'
import { type GraphqlMiddlewareState } from './../../types'

/**
* Create and provide the state singleton for the composables.
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/serverHandler/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QueryObject } from 'ufo'
import { type QueryObject } from 'ufo'
import type { H3Event } from 'h3'
import { createError } from 'h3'
import type { FetchOptions, FetchResponse, FetchError } from 'ofetch'
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/serverHandler/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineEventHandler, getQuery, readBody } from 'h3'
import { GraphqlMiddlewareRuntimeConfig } from '../../types'
import { type GraphqlMiddlewareRuntimeConfig } from '../../types'
import {
queryParamToVariables,
getEndpoint,
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/serverOptions/defineGraphqlServerOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GraphqlMiddlewareServerOptions } from './../../types'
import { type GraphqlMiddlewareServerOptions } from './../../types'

export function defineGraphqlServerOptions(
options: GraphqlMiddlewareServerOptions,
Expand Down
10 changes: 5 additions & 5 deletions test/codegen/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ type User {

exports[`generateTemplates > Generates the correct delarations. > graphql-documents.mjs 1`] = `
"const documents = {
\\"query\\": {
\\"translate\\": \\"\\\\n query translate($text: String!) {\\\\n translate(text: $text)\\\\n }\\\\n \\",
\\"getText\\": \\"query getText {\\\\n getText\\\\n }\\"
"query": {
"translate": "\\n query translate($text: String!) {\\n translate(text: $text)\\n }\\n ",
"getText": "query getText {\\n getText\\n }"
},
\\"mutation\\": {
\\"login\\": \\"\\\\n fragment user on User {\\\\n name\\\\n email\\\\n }\\\\n mutation login($user: String!, $password: String!) {\\\\n login(user: $user, password: $password) {\\\\n ...user\\\\n }\\\\n }\\\\n \\"
"mutation": {
"login": "\\n fragment user on User {\\n name\\n email\\n }\\n mutation login($user: String!, $password: String!) {\\n login(user: $user, password: $password) {\\n ...user\\n }\\n }\\n "
}
};
export { documents };"
Expand Down
Loading

0 comments on commit 19f4676

Please sign in to comment.