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 project references, upgrade @types/graphql #2497

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/monaco-graphql-react-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"devDependencies": {
"vite": "^2.7.0",
"@vitejs/plugin-react": "^1.1.1",
"@types/react": "^17.0.37",
"@types/react": "^18.0.12",
"vite-plugin-monaco-editor": "^1.0.10"
},
"scripts": {
Expand Down
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@
"npm": "please_use_yarn_instead"
},
"scripts": {
"build": "yarn build:clean && yarn build:packages && yarn build:graphiql-react && yarn build:graphiql",
"build": "yarn build:clean && yarn tsc && yarn build:graphiql-react",
"build-bundles": "yarn prebuild-bundles && wsrun -p -m -s build-bundles",
"build-bundles-clean": "rimraf '{packages,examples,plugins}/**/{bundle,cdn,webpack}' && yarn workspace graphiql run build-bundles-clean",
"build-clean": "wsrun -m build-clean ",
"build-clean": "wsrun -m build-clean",
"build-demo": "wsrun -m -s build-demo",
"build-docs": "rimraf 'packages/graphiql/typedoc' && typedoc 'packages'",
"build:clean": "yarn tsc --clean && yarn tsc --clean resources/tsconfig.graphiql.json",
"build:graphiql": "yarn tsc resources/tsconfig.graphiql.json",
"build:clean": "yarn tsc --clean",
"build:graphiql-react": "yarn workspace @graphiql/react run build",
"build:packages": "yarn tsc",
"build:watch": "yarn tsc --watch",
Expand Down Expand Up @@ -99,8 +98,6 @@
"@types/jest": "^26.0.22",
"@types/node": "^14.14.22",
"@types/prettier": "^2.0.0",
"@types/react": "^17.0.37",
"@types/theme-ui": "^0.3.1",
"@types/ws": "^7.4.0",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/graphiql-react/src/editor/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { fillLeafs, GetDefaultFieldNamesFn, mergeAst } from '@graphiql/toolkit';
import { EditorChange } from 'codemirror';
import copyToClipboard from 'copy-to-clipboard';
import { parse, print } from 'graphql';
import { RefObject, useCallback, useEffect, useRef } from 'react';
import { useCallback, useEffect } from 'react';

import { useExplorerContext } from '../explorer';
import { useSchemaContext } from '../schema';
Expand Down Expand Up @@ -160,7 +160,7 @@ export function useMergeQuery({ caller }: { caller?: Function } = {}) {
return;
}

queryEditor.setValue(print(mergeAst(documentAST, schema)));
queryEditor?.setValue(print(mergeAst(documentAST, schema)));
}, [queryEditor, schema]);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/editor/query-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export function useQueryEditor({
}
});

newEditor.on('beforeChange', (editorInstance, change) => {
newEditor.on('beforeChange', (_editorInstance, change) => {
// The update function is only present on non-redo, non-undo events.
if (change.origin === 'paste') {
const text = change.text.map(normalizeWhitespace);
Expand Down
6 changes: 1 addition & 5 deletions packages/graphiql-react/src/execution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ import { getFragmentDependenciesForAST } from 'graphql-language-service';
import { ReactNode, useCallback, useMemo, useRef, useState } from 'react';
import setValue from 'set-value';

import {
useAutoCompleteLeafs,
useEditorContext,
UseQueryEditorArgs,
} from './editor';
import { useAutoCompleteLeafs, useEditorContext } from './editor';
import { EditCallback } from './editor/hooks';
import { useHistoryContext } from './history';
import { createContextHook, createNullableContext } from './utility/context';
Expand Down
30 changes: 30 additions & 0 deletions packages/graphiql-react/tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"extends": "../../resources/tsconfig.base.esm.json",
"compilerOptions": {
"rootDir": "./src",
"outDir": "./esm",
"composite": false,
"jsx": "react",
"baseUrl": ".",
"target": "es5"
},
"include": ["src"],
"exclude": [
"**/__tests__/**",
"**/dist/**.*",
"**/*.spec.ts",
"**/*.spec.js",
"**/*-test.ts",
"**/*-test.js",
"**/*.stories.js",
"**/*.stories.ts"
],
"references": [
{
"path": "../graphiql-toolkit"
},
{
"path": "../codemirror-graphql"
}
]
}
11 changes: 9 additions & 2 deletions packages/graphiql-react/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extends": "../../resources/tsconfig.base.cjs.json",
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
Expand All @@ -16,8 +17,14 @@
"jsx": "react-jsx",
"declaration": true,
"declarationDir": "types",
"outDir": "tsc"
"outDir": "dist"
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
"references": [
{ "path": "./tsconfig.node.json" },
{ "path": "../graphiql-toolkit" },
{
"path": "../codemirror-graphql"
}
]
}
2 changes: 1 addition & 1 deletion packages/graphiql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
},
"devDependencies": {
"@testing-library/jest-dom": "^5.4.0",
"@testing-library/react": "9.4.1",
"@testing-library/react": "13.3.0",
"@types/codemirror": "^5.60.5",
"@types/markdown-it": "^12.2.3",
"@types/node": "^14.14.22",
Expand Down
4 changes: 2 additions & 2 deletions resources/tsconfig.base.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"downlevelIteration": true,
"removeComments": true,
"strict": true,
"jsx": "react",
"jsx": "react-jsx",
"noImplicitAny": true,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": true,
Expand All @@ -21,7 +21,7 @@
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"lib": ["dom", "es2017", "es2018", "esnext"],
"types": ["node", "jest"],
"types": ["node", "jest", "react"],
"baseUrl": "."
},
"exclude": [
Expand Down
3 changes: 3 additions & 0 deletions resources/tsconfig.build.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
{
"path": "../packages/graphiql-toolkit"
},
{
"path": "../packages/graphiql-react"
},
{
"path": "../packages/monaco-graphql"
},
Expand Down
12 changes: 0 additions & 12 deletions resources/tsconfig.graphiql.build.cjs.json

This file was deleted.

12 changes: 0 additions & 12 deletions resources/tsconfig.graphiql.build.esm.json

This file was deleted.

15 changes: 0 additions & 15 deletions resources/tsconfig.graphiql.json

This file was deleted.

Loading