GithubHelp home page GithubHelp logo

swydo / meteor-graphql Goto Github PK

View Code? Open in Web Editor NEW
58.0 58.0 5.0 55 KB

Compiler plugin that supports GraphQL files in Meteor

License: MIT License

JavaScript 100.00%
build-tool graphql import meteor package

meteor-graphql's People

Contributors

cliffzz avatar dependabot-preview[bot] avatar greenkeeper[bot] avatar jamiter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

meteor-graphql's Issues

TypeDefs split up into multiple files

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?

graphql file can't contain only import statements

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
}

An in-range update of eslint is breaking the build 🚨

Version 4.17.0 of eslint was just published.

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.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

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

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Still work, when don't use import?

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)

An in-range update of eslint-plugin-import is breaking the build 🚨

Version 2.4.0 of eslint-plugin-import just got published.

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 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

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

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Import multiple queries on client

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.

Errors from graphql-tag are not reported

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!

Typescript usage

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?

Error: `typeDefs` must be a string or array

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.

Conflict with persistgraphql package

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.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .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.

More information on this issue

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 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

importing .graphql file with interface not working.

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?

Support Field Descriptions

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!

import comments do not work

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)

If I have 2 .graphql schemas that import each other:

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.