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

Glob pattern for includes flag on client:generate not finding any matches #1367

Closed
ericbiewener opened this issue Jun 29, 2019 · 4 comments
Closed

Comments

@ericbiewener
Copy link

I'm finding that all glob patterns fail to find matches, while includes values that don't have any patterns are successful.

For example, this finds no matches:

node_modules/.bin/apollo codegen:generate --localSchemaFile=graphql-schema.json --target=typescript --includes=src/client/store/*.ts --tagName=gql --addTypename --globalTypesFile=src/client/types/queries.ts queryTypes

But if I change --includes=src/client/store/*.ts to point to a single file, e.g. --includes=src/client/store/registry.ts, it does work. It doesn't seem to matter if I prepend ./ before the path, or use absolute paths.

I am using v2.15.0.

@ericbiewener
Copy link
Author

Ah, needed to put quotes around the glob: --includes='src/client/store/*.ts'

@THPubs
Copy link

THPubs commented Dec 7, 2019

Awesome thanks! It's all about quotes!

@miracle2k
Copy link

I'll add this here since I was lucky to find it accidentally after wading through the source: In next.js, when using parameters in routes, your files will have names such as [id].tsx. If you don't quote the argument to --includes, a glob will be resolved by your shell, and the internal glob logic of apollo-codegen will receive [id].tsx, which it seems is a glob instruction itself, and will then not yield the actual file as a result.

@selrond
Copy link

selrond commented Sep 30, 2020

Ah, needed to put quotes around the glob: --includes='src/client/store/*.ts'

This should really be in the docs...

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

No branches or pull requests

4 participants