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

Stop Bundling GraphQL in the module #46

Merged
merged 5 commits into from
Feb 8, 2017
Merged

Stop Bundling GraphQL in the module #46

merged 5 commits into from
Feb 8, 2017

Conversation

abhiaiyer91
Copy link
Contributor

No description provided.

index.js Outdated
@@ -156,5 +164,7 @@ function gql(/* arguments */) {
gql.default = gql;
gql.resetCaches = resetCaches;
gql.disableFragmentWarnings = disableFragmentWarnings;
gql.print = require('graphql/language/printer');
gql.parser = parser
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like these two names are consistent - should it be "parse" rather than "parser"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stubailo I did a search:
https://github.com/apollographql/apollo-client/search?utf8=%E2%9C%93&q=parser

and saw some typings expecting parser

What do you suggest? parse?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module is called parser, but the function exported is called parse.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay i will export the parse function instead of the whole parser

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was exporting the whole lib var parser = require('graphql/language/parser');

@stubailo
Copy link
Contributor

stubailo commented Feb 1, 2017

Also it looks like this is adding a yarn lock file, I don't think we want that in the repository.

@abhiaiyer91
Copy link
Contributor Author

@stubailo I added the lock file because I manage dependencies with yarn. Are we opposed to managing the dependencies and their versions with yarn?

@stubailo
Copy link
Contributor

stubailo commented Feb 1, 2017

@abhiaiyer91 no, but you can install dependencies with yarn without adding a lock file. Lock files are perfect for applications, but not the right solution for packages, where we need to be constantly testing with new versions.

@abhiaiyer91
Copy link
Contributor Author

Sounds good, will remove the yarn.lock

@abhiaiyer91
Copy link
Contributor Author

Alright updates made!

index.js Outdated
@@ -90,6 +93,11 @@ function stripLoc (doc, removeLocAtThisLevel) {
delete doc.loc;
}

if (doc.loc) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could use a comment - im not fully certain why we'd want to delete these properties. linking to the issue should be sufficient

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add a comment, the parser's loc fields include references to the query string and as your AST is deeper it becomes more overhead to ship/store the query

Copy link
Contributor

@jnwng jnwng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this lgtm, but @stubailo should probably sign off.

@stubailo
Copy link
Contributor

stubailo commented Feb 8, 2017

Yeah I think this is a great change although it is majorly breaking for anyone that was using graphql-tag/parser and graphql-tag/printer. So we should make sure to bump the major version IMO.

Also, are we worried about importing print unconditionally? It's possible that some apps might not be using that, maybe we should just instruct people to import from graphql/language/printer directly?

@stubailo
Copy link
Contributor

stubailo commented Feb 8, 2017

(Consider that a sign-off, we can always fix it later if we think this increases the bundle size unnecessarily)

@abhiaiyer91
Copy link
Contributor Author

abhiaiyer91 commented Feb 8, 2017

@stubailo I think people should import printer/parser themselves. They are already going to have graphql due to the peer dependency.

So i would say next steps:

Remove the re-export of both libraries and ship a major version.

@abhiaiyer91
Copy link
Contributor Author

#49

@abhiaiyer91 abhiaiyer91 merged commit f7cf4c2 into master Feb 8, 2017
@abhiaiyer91 abhiaiyer91 deleted the ParsePrint branch February 8, 2017 00:34
jnwng added a commit to jnwng/graphql-tag that referenced this pull request Feb 24, 2017
jnwng added a commit to jnwng/graphql-tag that referenced this pull request Feb 28, 2017
…rint"

This reverts commit f7cf4c2, reversing
changes made to c5332e0.
jnwng added a commit to jnwng/graphql-tag that referenced this pull request Feb 28, 2017
This reverts commit 7413172.

# Conflicts:
#	index.js
#	parser.js
#	printer.js
#	webpack.config.js
@PowerKiKi
Copy link
Contributor

PowerKiKi commented Apr 6, 2017

Slightly off-topic but yarn.lock file should be committed if you decide to support yarn, as is well explained here.

Would you accept a PR for that ?

@jnwng
Copy link
Contributor

jnwng commented Apr 7, 2017

thanks for sharing that article, i was fairly certain we shouldn't be adding yarn.lock files. would be happy to accept a PR!

@PowerKiKi PowerKiKi mentioned this pull request Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants