formatjs / formatjs-old

The monorepo home to all of the FormatJS related libraries.
https://formatjs.io/
156 stars 53 forks source link

[@formatjs/cli] Clearer error message when no files found #598

Closed atomcorp closed 4 years ago

atomcorp commented 4 years ago

Which package? @formatjs/cli

Is your feature request related to a problem? Please describe. Currently if you use an invalid glob (great that you added those btw!) or the cli can't find any files for whatever reason you get a strange warning: warning Reading source file from TTY. and the process hangs, indefinitely.

Describe the solution you'd like The check happens in extract.ts, there just needs to be a warning message and the process should exit. I would make a pull request myself, but I'm not sure about what's happening after.

pyrocat101 commented 4 years ago

Ah, this is because the current CLI's stdin reading logic isn't updated when glob is introduced. Previously, before glob was introduced, if the resolved files to process is empty, the CLI assumes that you are feeding the input from stdin.

I am gonna send a fix for this soon.