Skip to content

Support globing .gql files#77

Open
epicallan wants to merge 7 commits intoamount:masterfrom
epicallan:master
Open

Support globing .gql files#77
epicallan wants to merge 7 commits intoamount:masterfrom
epicallan:master

Conversation

@epicallan
Copy link
Contributor

@epicallan epicallan commented Jun 13, 2017

PR for #75 I introduced quite a couple of new dependencies which may not be ideal. Anyhow Its just an early attempt let me know what you think and I will make the required changes.

@coveralls
Copy link

coveralls commented Jun 13, 2017

Coverage Status

Coverage increased (+0.06%) to 96.497% when pulling 154b5d5 on epicallan:master into 5378c5a on avantcredit:master.

"graphql": "^0.10.1",
"graphql-tag": "^2.2.2",
"graphql-tools": "^1.0.0",
"merge-graphql-schemas": "0.0.17"
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks like the only new ones should be glob and merge-graphql-schemas, right?

can we remove the others?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

some of those were merge-graphql-schemas peer dependencies, will see how to get rid of them.

} else if (fileName) {
const schema: string = readFile(fileName);
let schema: string = '';
if (fileName.includes('*') && fileName.includes('.gql')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we might want to support .graphql as well

maybe something like:

['gql', 'graphql'].some(ext => fileName.endsWith(ext))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cool, will make that change

if (fileName.includes('*') && fileName.includes('.gql')) {
schema = gqlGlobHandler(fileName);
}
schema = readFile(fileName);
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be in an else condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes should be.

process.stdin.on('end', () => run(JSON.parse(input), program as any));
} else if (fileName) {
const schema: string = readFile(fileName);
let schema: string = '';
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps we should throw all of this into a function in util - or maybe add the functionality to readFile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

}
type Query {
products: [Product]
} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can you add a new line character?

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 agree

@wrod7
Copy link

wrod7 commented May 1, 2018

👀

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