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

codegen generate --watch breaks when used with concurrency #541

Closed
mohsen1 opened this issue Aug 9, 2018 · 8 comments
Closed

codegen generate --watch breaks when used with concurrency #541

mohsen1 opened this issue Aug 9, 2018 · 8 comments

Comments

@mohsen1
Copy link

mohsen1 commented Aug 9, 2018

When I use codegen generate --watch in a concurrency sequence I get this error:

TypeError: process.stdin.setRawMode is not a function

I think the watch mode should not exit on keypress and instead it should exit on common interrupts like ^C

Bug Repository

https://github.com/mohsen1/apollo-codegen-generate-watch-bug

CLI Output

 npm start                                                                                                                                                                                                                                                                                                        

> [email protected] start /Users/mohsen_nabiloo-azimi/Desktop/apollo-react
> concurrently 'npm run start-dev' 'npm run generate-types -- --watch'

[1]
[1] > [email protected] generate-types /Users/mohsen_nabiloo-azimi/Desktop/apollo-react
[1] > apollo codegen:generate --schema=api-schema.json  --target=typescript --queries='**/*.tsx' "--watch"
[1]
[0]
[0] > [email protected] start-dev /Users/mohsen_nabiloo-azimi/Desktop/apollo-react
[0] > react-scripts-ts start
[0]
[1] [10:27:39] Loading Apollo config [started]
[1] [10:27:39] Loading Apollo config [completed]
[1] [10:27:39] Resolving GraphQL document sets and dependencies [started]
[0] Starting type checking and linting service...
[0] Using 1 worker with 2048MB memory limit
[0] Watching: /Users/mohsen_nabiloo-azimi/Desktop/apollo-react/src
[1] [10:27:40] Scanning for GraphQL queries (20 found) [title changed]
[1] [10:27:40] Scanning for GraphQL queries (20 found) [completed]
[1] [10:27:40] Generating query files [started]
[1] [10:27:40] Generating query files with 'typescript' target [title changed]
[1] [10:27:40] Generating query files with 'typescript' target - wrote 0 files [title changed]
[1] [10:27:40] Generating query files with 'typescript' target - wrote 0 files [completed]
Starting the development server...
[0]
[0] ts-loader: Using [email protected] and /Users/mohsen_nabiloo-azimi/Desktop/apollo-react/tsconfig.json
[1] Press any key to stop.
[1] TypeError: process.stdin.setRawMode is not a function
[1]     at waitForKey (~/Desktop/apollo-react/node_modules/apollo/lib/commands/codegen/generate.js:14:19)
[1]     at Generate.run (~/Desktop/apollo-react/node_modules/apollo/lib/commands/codegen/generate.js:123:19)
[1]     at <anonymous>
[1] npm ERR! code ELIFECYCLE
npm ERR! errno 1
[1] npm ERR! [email protected] generate-types: `apollo codegen:generate --schema=api-schema.json  --target=typescript --queries='**/*.tsx' "--watch"`
[1] npm ERR! Exit status 1
[1] npm ERR!
npm ERR! Failed at the [email protected] generate-types script.
[1] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[1]
[1] npm ERR! A complete log of this run can be found in:
[1] npm ERR!     /Users/mohsen_nabiloo-azimi/.npm/_logs/2018-08-09T17_27_42_043Z-debug.log
[1] npm run generate-types -- --watch exited with code 1
[0] Compiled successfully!
[0]
[0] You can now view apollo-react in the browser.
[0]
[0]   Local:            http://localhost:3000/
[0]   On Your Network:  http://10.1.131.106:3000/
[0]
[0] Note that the development build is not optimized.
[0] To create a production build, use yarn build.
[0]
@trojanowski
Copy link
Contributor

I already created a PR which fixes that problem: apollographql/rover#534

@mohsen1
Copy link
Author

mohsen1 commented Aug 10, 2018

@trojanowski if your changes is published in [email protected] it's still not working in my bug report repo. I'm getting

TypeError: process.stdin.setRawMode is not a function

@shadaj
Copy link
Contributor

shadaj commented Aug 10, 2018

@mohsen1 #534 was included with v1.7.0. Could you post the logs when running with that version?

@mohsen1
Copy link
Author

mohsen1 commented Aug 10, 2018

Logs are exactly as I posted in the original post.

@trojanowski
Copy link
Contributor

#534 wasn't included in v1.7.0. The transpiled code doesn't have the tty.isatty check. Git history shows, that the Publish commit is before the #534 fix.

@mohsen1
Copy link
Author

mohsen1 commented Aug 21, 2018

@shadaj can you take a look?

@shadaj
Copy link
Contributor

shadaj commented Aug 23, 2018

v1.7.1 has been published with the latest fixes included! Apologies for the late release, I just started college this week so my schedule's been packed with orientation activities.

@shadaj shadaj closed this as completed Aug 23, 2018
@supermoos
Copy link

Nice, however it now looks like --watch is not working at all when the queries are defined in package.json instead of as a command line parameter.

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