Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

npx and stream redirection don't mix well #115

Closed
lorefnon opened this issue Jul 17, 2022 · 1 comment · Fixed by #116
Closed

npx and stream redirection don't mix well #115

lorefnon opened this issue Jul 17, 2022 · 1 comment · Fixed by #116

Comments

@lorefnon
Copy link
Contributor

If the package is not locally installed, npx writes to stdout to confirm if user wants the package to be installed or not.

In the README, tql recommends invoking the code generator as npx @timkendall/tql-gen <schema> > sdk.ts

This leaves npx waiting for user input with no output (because stdout was redirected to file) giving the impression that the generator has hung. After enter is pressed we end up with an invalid file looking like this:

Need to install the following packages:
@timkendall/tql-gen
Ok to proceed? (y) import { buildASTSchema, Kind, OperationTypeNode } from "graphql";
...

I propose that the generator accepts a --output/-o file as the recommended means to specify a file to be written to (similar to many other such tools). This can be backward compatible.

@timkendall
Copy link
Owner

Ah good catch. Agreed. Will get this in tomorrow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants