-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
--watch
doesn't work for multi-project
#9233
Comments
I was about to make a new issue for a similar bug, but I think it's the same underlying cause as this. In my case the bug is that watch mode only applies to documents below the current working directory. However, it's valid config (and build mode succeeds) to have documents matched outside the current directory, e.g. (from our config): types/console.tsx:
schema:
- "../gql-api/schema/unified_schema.graphql"
documents:
- "../console/**/*.graphql" Changes to I believe this is the cause of some complaints mentioned in the comments of #9009 Specifically, the bug is here: });
watcherSubscription = await parcelWatcher.subscribe(
process.cwd(),
async (_, events) => {
// it doesn't matter what has changed, need to run whole process anyway
await Promise.all( This only listens for changes below the current working directory. However, it's possible for glob patterns to reference changes above the current working directory. I'm not sure what the best fix is. Ideally, we could compile all the glob patterns to pass them to |
Here's a reproduction. However, it seems From repo: https://www.github.com/milesrichardson/repro-npm-graphql-codegen-watch-outside-cwd |
I have a PR for this, incoming in next hour |
I tested it for my project and it works! Thank you! |
@SeokminHong Nice, glad to hear it's fixed for you 😄 Note that you'll probably notice watch mode is now pretty aggressive, since it's using the "highest common directory," and if that's your repo root, it will rebuild on changes within This is tracked in #9270 and should be fixed in #9275, so keep an eye out for that to be merged, and make sure to update once that release is available. |
Which packages are impacted by your issue?
@graphql-codegen/cli
Describe the bug
--watch
flag doesn't work for multi-project config. It throws following error:Your Example Website or App
https://stackblitz.com/edit/github-kf5dtb?file=codegen.ts&view=editor
Steps to Reproduce the Bug or Issue
graphql-codegen
with--watch
configExpected behavior
The
--watch
flag whould workScreenshots or Videos
No response
Platform
graphql
version: [e.g. 16.3.0]@graphql-codegen/*
version(s): [e.g. 2.6.2]Codegen Config File
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: