swydo / meteor-graphql Goto Github PK
View Code? Open in Web Editor NEWCompiler plugin that supports GraphQL files in Meteor
License: MIT License
Compiler plugin that supports GraphQL files in Meteor
License: MIT License
We were doing something like this before:
import playerSchema from 'playerSchema';
`
${playerSchema}
${fixtureSchema}
${clubSchema}
`
Is this possible with this package? We no longer get a string when importing the .graphql
files. So how would this be done?
if i have a file typeDefs.graphql
which contains
#import "./Query.graphql"
#import "./Mutation.graphql"
#import "./User.graphql"
then i get this error:
imports/api/graphql/typeDefs.graphql:3:25: Syntax Error: Unexpected <EOF>
workaround is to add a dummy type at the end:
#import "./Query.graphql"
#import "./Mutation.graphql"
#import "./User.graphql"
type Test {
test: Boolean
}
Branch | Build failing 🚨 |
---|---|
Dependency | eslint |
Current Version | 4.16.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
eslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
The new version differs by 11 commits.
2af9446
4.17.0
5ad3fb2
Build: changelog update for 4.17.0
1da1ada
Update: Add "multiline" type to padding-line-between-statements (#8668)
bb213dc
Chore: Use messageIds in some of the core rules (#9648)
1aa1970
Docs: remove outdated rule naming convention (#9925)
3afaff6
Docs: Add prefer-destructuring variable reassignment example (#9873)
d20f6b4
Fix: Typo in error message when running npm (#9866)
51ec6a7
Docs: Use GitHub Multiple PR/Issue templates (#9911)
dc80487
Update: space-unary-ops uses astUtils.canTokensBeAdjacent (fixes #9907) (#9906)
084351b
Docs: Fix the messageId example (fixes #9889) (#9892)
9cbb487
Docs: Mention the globals
key in the no-undef docs (#9867)
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
I have 2 schema Assignee and Task
type Assignee {
_id: String!
name: String!
gender: String!
}
#import "../assignees/schema.graphql"
type Task {
_id: String!
title: String!
description: String
assignee: Assignee
}
It work fine.
But still work, if I remove #import ....
?
Could explain me?
(I use merge-graphql-schemas
to merge)
Branch | Build failing 🚨 |
---|---|
Dependency | eslint-plugin-import |
Current Version | 2.3.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As eslint-plugin-import is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.
I recommend you give this issue a high priority. I’m sure you can resolve this 💪
The new version differs by 10 commits.
44ca158
update utils changelog
a3728d7
bump eslint-module-utils to v2.1.0
3e29169
bump v2.4.0
ea9c92c
Merge pull request #737 from kevin940726/master
8f9b403
fix typos, enforce type of array of strings in allow option
95315e0
update CHANGELOG.md
28e1623
eslint-module-utils: filePath in parserOptions (#840)
2f690b4
update CI to build on Node 6+7 (#846)
7d41745
write doc, add two more tests
dedfb11
add allow glob for rule no-unassigned-import, fix #671
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
It doesn't seem that I can rename query
on import. For instance, if I try the following:
import testQuery from './test.graphql';
or
import { query as testQuery } from './test.graphql';
I receive the following error:
Exception in defer callback: TypeError: Cannot read property 'kind' of undefined
at checkDocument (http://localhost:3000/packages/modules.js?hash=401da39174ff7894f4c0f56bdb7e1fd90ca15cb0:1213:13)
at getQueryDefinition (http://localhost:3000/packages/modules.js?hash=401da39174ff7894f4c0f56bdb7e1fd90ca15cb0:1253:5)
at QueryManager.watchQuery (http://localhost:3000/packages/modules.js?hash=401da39174ff7894f4c0f56bdb7e1fd90ca15cb0:4215:31)
at ApolloClient.watchQuery (http://localhost:3000/packages/modules.js?hash=401da39174ff7894f4c0f56bdb7e1fd90ca15cb0:4798:34)
at Blaze.TemplateInstance.gqlQuery (http://localhost:3000/packages/swydo_blaze-apollo.js?hash=7915f676b5c961fc380b475b07e249564591b4b2:250:28)
at Blaze.View.<anonymous> (http://localhost:3000/app/app.js?hash=25bc50a15f463632fc27b8e1e3858cb6fb3a4cc0:2277:26)
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1934:20
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12)
at http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1932:29
at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2271:12)
The consequence of this is that I can only import one query per JavaScript document. I know that I can do comment includes of other graphql files; however, this doesn't help me on the client where each query accepts different variables.
Hi,
when a .graphql
file has syntax errors, Meteor just reports Error: Cannot find module 'myFile.graphql'
instead of printing an error from graphql-tag
loader.
f.e.
/schema.graphql
# 'typ' instead of 'type'
typ Query
test: String
}
/index.ts
import schema from './schema.graphql';
will fail with Cannot find module './schema.graphql'
. When I fix the syntax error, everything works fine.
I've played around with the package a bit, and the file.error
get's called here, but Meteor seems to ignore that for some reason.
I'm not sure if it's a problem with the package or Meteor or my code.
I use [email protected]
Thanks!
I was wondering if you guys have tried this plugin with typescript? I want to import a .graphql in a typescript file, but it tries to load it as a module. My module resolution in tsconfig is set to node. So the following does not work for me:
import * as schema from "../models/typeDefs.graphql";
However, If I use require like the following, it will work:
const schema = require("../models/typeDefs.graphql");
I don't want to use require since it's discouraged by the TS community and my linting rules. Any idea how I can get this to work?
server.js
import { createApolloServer } from 'meteor/apollo';
import { makeExecutableSchema } from 'graphql-tools';
import typeDefs from '/imports/api/schema.graphql'; // No need to parse it!
import resolvers from '/imports/api/resolvers';
const schema = makeExecutableSchema({
typeDefs,
resolvers,
});
createApolloServer({
schema,
});
'imports/api/schema.graphql'
type Foo {
bar: Int
}
from console.log(typeDefs)
I20170410-01:11:01.923(6.5)? { kind: 'Document',
I20170410-01:11:01.923(6.5)? definitions:
I20170410-01:11:01.924(6.5)? [ { kind: 'ObjectTypeDefinition',
I20170410-01:11:01.925(6.5)? name: [Object],
I20170410-01:11:01.926(6.5)? interfaces: [],
I20170410-01:11:01.926(6.5)? directives: [],
I20170410-01:11:01.927(6.5)? fields: [Object] } ],
I20170410-01:11:01.927(6.5)? loc: { start: 0, end: 26 } }
error
W20170410-01:02:57.061(6.5)? (STDERR) Warning - the `printer` exports from `graphql-tag` will be removed in the next major version.
W20170410-01:02:57.062(6.5)? (STDERR) See https://github.com/apollographql/graphql-tag/issues/54 for more information.
W20170410-01:02:57.062(6.5)? (STDERR) /Users/username/.meteor/packages/meteor-tool/.1.4.3_2.1ta6ley++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20170410-01:02:57.063(6.5)? (STDERR) throw(ex);
W20170410-01:02:57.063(6.5)? (STDERR) ^
W20170410-01:02:57.065(6.5)? (STDERR)
W20170410-01:02:57.075(6.5)? (STDERR) Error: `typeDefs` must be a string or array
=> Exited with code: 1
^C Building the application
I've been looking through things for a while and it isn't working. I've tried adjusting the schema, but it's not working. Works fine if I use the javascript file instead of .graphql. Not sure what's wrong.
Can I import a fragment from one .graphql
file into another?
we need to open a file with a .graphql extension for each graphql operation.
do we do this in a single page ? How do we collect our work in a file so that our work can be more regular and smooth ?
If you have both swydo:graphql and persistgraphql packages installed, swydo will throw an error on the index.js file inside the persistgraphql package, causing the program to not run.
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
My app is very modular and provides an interface
that can be implemented by other types.
Example:
//animal.graphql
enum A{
hunted,
hunter,
}
interface Animal{
_id: String!
name: String!
group: A!
}
//dog.graphql
#import "./animal.graphql";
type Dog implements Animal{
_id: String!
name: String!
ayes: Int!
}
Is it possible to import a .graphql
file where an interface is defined?
Hi!
I ran in to this rather severe bug (apollographql/graphql-tag#168) when using meteor-graphql. It seems that a fix was released in [email protected].
While its possible to import everything into another .graphql
using the import comment#import "./personSchema.graphql"
, is it possible to import individual types?
This is similar to graphql-import where they would have # import Person from "./personSchema.graphql"
I noticed that when I use this package, field descriptions stopped showing up in GraphiQL. Consider the example:
test.graphql
:
#import './channel.graphql'
#import './user.graphql'
# test type description
type Query {
# test field description
channels: [Channel],
# test field description
user: User,
}
GraphiQL shows "No Description" for all types and fields. Do I need to do some sort of configuraton to get the descriptions to show up? Thanks!
I want to distribute the typedefs into multiple files,
so that i have one "index"- graphql file that just imports everything else
e.g. this contains something like
#import "./types/Query.graphql"
#import "./types/Mutation.graphql"
#import "./types/User.graphql"
# ...
but it does not work, it says Error: "Query" defined in resolvers, but not in schema
. Also if import a file that does not exist, nothing happens ( no error)
This is a very common scenario:
// Comment.graphql
#import './User'
type Comment {
title: String!
isDone: Boolean!
createdAt: Date!
user: User
}
// User.graphql
#import './Comment'
type User {
_id: ID!
firstName: String!
lastName: String!
age: Int
comments: [Comment]
}
Fails with:
W20180310-07:05:55.673(2)? (STDERR) TypeError: Cannot read property 'filter' of undefined
W20180310-07:05:55.673(2)? (STDERR) at unique (/Users/theodor/Projects/graphql-live/.meteor/local/build/programs/server/app/app.js:30:19)
W20180310-07:05:55.673(2)? (STDERR) at Comment.graphql.js (/Users/theodor/Projects/graphql-live/.meteor/local/build/programs/server/app/app.js:43:44)
W20180310-07:05:55.673(2)? (STDERR) at fileEvaluate (packages/modules-runtime.js:343:9)
W20180310-07:05:55.674(2)? (STDERR) at require (packages/modules-runtime.js:238:16)
Running 0.2.0 descriptions aren't shown in grqphiql
#4
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.