Skip to content

Support globing .gql files#77

Open
epicallan wants to merge 7 commits into
amount:masterfrom
epicallan:master
Open

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

Conversation

@epicallan

@epicallan epicallan commented Jun 13, 2017

Copy link
Copy Markdown
Contributor

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

coveralls commented Jun 13, 2017

Copy link
Copy Markdown

Coverage Status

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

Comment thread packages/util/package.json Outdated
"graphql": "^0.10.1",
"graphql-tag": "^2.2.2",
"graphql-tools": "^1.0.0",
"merge-graphql-schemas": "0.0.17"

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread packages/cli/src/index.ts Outdated
} else if (fileName) {
const schema: string = readFile(fileName);
let schema: string = '';
if (fileName.includes('*') && fileName.includes('.gql')) {

Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread packages/cli/src/index.ts Outdated
if (fileName.includes('*') && fileName.includes('.gql')) {
schema = gqlGlobHandler(fileName);
}
schema = readFile(fileName);

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread packages/cli/src/index.ts Outdated
process.stdin.on('end', () => run(JSON.parse(input), program as any));
} else if (fileName) {
const schema: string = readFile(fileName);
let schema: string = '';

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure

Comment thread test/data/products.gql Outdated
}
type Query {
products: [Product]
} No newline at end of file

Copy link
Copy Markdown
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
Copy Markdown
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

wrod7 commented May 1, 2018

Copy link
Copy Markdown

👀

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