-
Notifications
You must be signed in to change notification settings - Fork 0
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
hijack and make it work how I would imagine it #1
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
module.exports = { | ||
extends: [ | ||
`@yarnpkg`, | ||
], | ||
}; | ||
module.exports = {}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
.yarn/* | ||
!.yarn/releases | ||
.pnp.* | ||
/lib | ||
node_modules |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
demo/gql |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
{ | ||
"search.exclude": { | ||
"**/.yarn": true, | ||
"**/.pnp.*": true | ||
}, | ||
"typescript.tsdk": ".yarn/sdks/typescript/lib", | ||
"typescript.enablePromptUseWorkspaceTsdk": true, | ||
"eslint.nodePath": ".yarn/sdks" | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true | ||
} |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
schema: ./schema.graphql | ||
documents: './demo/**/*.ts' | ||
documents: "./demo/src/**/*.ts" | ||
|
||
require: | ||
- ts-node/register/transpile-only | ||
|
||
pluckConfig: | ||
skipIndent: true | ||
|
||
generates: | ||
./demo/gql/: | ||
preset: graphql-typescript-integration | ||
plugins: [graphql-typescript-integration/empty] | ||
preset: ./lib/preset.js | ||
plugins: [./lib/plugin.js] |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
|
||
import { gql } from "@app/gql"; | ||
|
||
const FooQuery = gql(/* GraphQL */ ` | ||
query Foo { | ||
Tweets { | ||
id | ||
} | ||
} | ||
`); | ||
|
||
const LelFragment = gql(/* GraphQL */ ` | ||
fragment Lel on Tweet { | ||
id | ||
body | ||
} | ||
`); | ||
|
||
const BarQuery = gql(/* GraphQL */ ` | ||
query Bar { | ||
Tweets { | ||
...Lel | ||
} | ||
} | ||
`); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
diff --git a/node_modules/@graphql-codegen/cli/bin.js b/node_modules/@graphql-codegen/cli/bin.js | ||
index 1307a11..7fdc41d 100755 | ||
--- a/node_modules/@graphql-codegen/cli/bin.js | ||
+++ b/node_modules/@graphql-codegen/cli/bin.js | ||
@@ -514,7 +514,13 @@ async function loadDocuments(documentPointers, config) { | ||
const loaders = [new codeFileLoader.CodeFileLoader(), new gitLoader.GitLoader(), new githubLoader.GithubLoader(), new graphqlFileLoader.GraphQLFileLoader()]; | ||
const loadedFromToolkit = await load.loadDocuments(documentPointers, { | ||
...defaultDocumentsLoadOptions, | ||
- ignore: Object.keys(config.generates).map(p => path.join(process.cwd(), p)), | ||
+ ignore: Object.keys(config.generates).map(p => { | ||
+ let ignorePath = path.join(process.cwd(), p) | ||
+ if (ignorePath.endsWith("**/*") === false) { | ||
+ ignorePath += "**/*" | ||
+ } | ||
+ return ignorePath | ||
+ }), | ||
loaders, | ||
...config, | ||
...config.config, | ||
@@ -738,7 +744,7 @@ class CodegenContext { | ||
const documents = await this._graphqlConfig.getProject(this._project).loadDocuments(pointer, config); | ||
return documents; | ||
} | ||
- return loadDocuments(pointer, config); | ||
+ return loadDocuments(pointer, config) | ||
} | ||
} | ||
function ensureContext(input) { |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
diff --git a/node_modules/@graphql-tools/code-file-loader/index.js b/node_modules/@graphql-tools/code-file-loader/index.js | ||
index 7f34ec1..9660b6d 100644 | ||
--- a/node_modules/@graphql-tools/code-file-loader/index.js | ||
+++ b/node_modules/@graphql-tools/code-file-loader/index.js | ||
@@ -244,8 +244,11 @@ class CodeFileLoader { | ||
const content = await readFile(normalizedFilePath, { encoding: 'utf-8' }); | ||
const sources = await graphqlTagPluck.gqlPluckFromCodeString(normalizedFilePath, content, options.pluckConfig); | ||
if (sources.length) { | ||
+ | ||
+ const document = graphql.concatAST(sources.map(source => graphql.parse(source.body, options))) | ||
return { | ||
- document: graphql.concatAST(sources.map(source => graphql.parse(source, options))), | ||
+ document, | ||
+ rawSDL: sources.map(source => source.body).join(`\n#-#\n`), | ||
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. The rawSDL is used for building the operation string to Type mapping. Since multiple If we don't provide For three
|
||
location: pointer, | ||
}; | ||
} |
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.
I don't have an exact idea what is going on here and this patch probably breaks other stuff. I noticed that the following codegen config:
Would result in the following error:
I dug into it and it seems that the folder is not properly ignored because the string must be a glob pattern. So I simply added it there.