Yarn Tips

Windix Feng
1 min readJun 16, 2022

--

Yarn would add a fancy header and footer to the standard output:

yarn run v1.22.17
$ (the actual command)

... the actual output ...

✨ Done in 3.44s.

Normally this won’t be an issue (and would be pretty useful for debugging). But in case you need to pipe the output to another command to process, that’s a disaster.

In my case, this ruins the GraphQL SDL output when using apollo rover cli to publish schema update to apollo studio.

❯ yarn rover subgraph introspect http://localhost:4004/account/graphql | yarn rover subgraph check graph@current --name account --schema -
yarn run v1.22.17
$ ....
error: Could not parse partial schema as AST.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The simple solution is just to use npx instead of yarn (but this won't be an issue if the entire command is inside package.json and run by yarn).

--

--

No responses yet